导航:首页 > 图片大全 > vb中如何缩小图片

vb中如何缩小图片

发布时间:2024-11-23 20:40:48

❶ vb如何把一个文件夹中的所由图片缩小到指定尺寸,并保存

先打开指定图片,创建DC,将此图片hdc赋予DC,然后用StretchBlt 函数缩小到指定尺寸,然后从DC中取出图片,并保存

❷ VB中如何才能自动放大缩小图片填充到图片框中啊

实现代码:

VERSION 5.00

BeginVB.FormForm1

Caption="使用PictureBox控件实现图像放大和缩小"

ClientHeight=5580

ClientLeft=60

ClientTop=345

ClientWidth=7935

LinkTopic="Form1"

ScaleHeight=5580

ScaleWidth=7935

StartUpPosition=3'窗口缺省

BeginVB.PictureBoxPicture1

AutoRedraw=-1'True

AutoSize=-1'True

Height=3960

Left=-15

Picture="Form1.frx":0000

ScaleHeight=3900

ScaleWidth=6240

TabIndex=2

Top=15

Width=6300

End

BeginVB.CommandButtonCommand2

Caption="放大"

Height=360

Left=6540

TabIndex=1

Top=5070

Width=1140

End

BeginVB.CommandButtonCommand1

Caption="缩小"

Height=360

Left=5160

TabIndex=0

Top=5070

Width=1140

End

End

AttributeVB_Name="Form1"

AttributeVB_GlobalNameSpace=False

AttributeVB_Creatable=False

AttributeVB_PredeclaredId=True

AttributeVB_Exposed=False

DimiAsInteger

DimjAsInteger

PrivateSubCommand1_Click()

Picture1.Cls

i=i-100:j=j-100

Picture1.PaintPicturePicture1.Picture,0,0,i,j

Picture1.Width=i:Picture1.Height=j

EndSub

PrivateSubCommand2_Click()

Picture1.Cls

Picture1.Width=i:Picture1.Height=j

i=i+100:j=j+100

Picture1.PaintPicturePicture1.Picture,0,0,i,j

EndSub

PrivateSubForm_Load()

i=Picture1.Width:j=Picture1.Height

Picture1.Cls

EndSub

VB6.0通过PictureBox控件实现图片放大和图片缩小功能



(2)vb中如何缩小图片扩展阅读:

其它方法:

例子前请先下载Gdiplus.tlb,并将其放置到C:\Windows\System32中

Gdiplus.tlb下载

VisualBasiccode

使用Gdiplus.tlb,将其放到system32中,然后添加对其的引用

手动设置Form的AutoRedraw=True,ScaleMode=Pixels

OptionExplicit

DimlngGraphicsAsLong

DimlngImageHandleAsLong

DimlngTextureBrushAsLong

DimgpPAsGpStatus

DimlngPen1AsLong

DimlngTokenAsLong

PrivateSubCommand1_Click()

DimintPAsInteger

gpP=GdipCreateFromHDC(Me.hDC,lngGraphics)'创建绘图区域设备场景

gpP=GdipLoadImageFromFile(App.Path&"\启动.png",lngImageHandle)'读取图片到内存

gpP=GdipDrawImage(lngGraphics,lngImageHandle,0,0)'等大小绘制

gpP=GdipDrawImageRect(lngGraphics,lngImageHandle,200,0,300,300)'在指定的区域内绘制(放大或缩小)

gpP=GdipDrawImageRectRectI(lngGraphics,lngImageHandle,550,0,400,400,20,20,80,80,UnitPixel)'在400*400的区域内显示图片部分区域

gpP=GdipCreateTexture(lngImageHandle,WrapModeTile,lngTextureBrush)'设置一定排列方式的刷子平铺方式

gpP=GdipFillRectangle(lngGraphics,lngTextureBrush,0,300,400,300)'在指定区域内按指定的格式绘制图片

IflngGraphics<>

IflngImageHandle<>

IflngTextureBrush<>

Me.Refresh

EndSub

PrivateSubForm_Load()

DimbolPAsBoolean

WithMe

.Caption="GDIPlus范例"

.Width=960*15

.Height=720*15

.Left=(Screen.Width-.Width)*0.5

.Top=(Screen.Height-.Height)*0.5

EndWith

GpInput.GdiplusVersion=1

IflngToken=0ThenbolP=(GdiplusStartup(lngToken,GpInput)=Ok)

EndSub

阅读全文

与vb中如何缩小图片相关的资料

热点内容
表格图片如何转换word 浏览:195
改短发发型图片 浏览:309
报名排队可爱的图片 浏览:225
图片卡通女孩流行 浏览:219
袖子加长衣服图片 浏览:427
微信聊天背景图片4k高清炫酷 浏览:656
在word文档怎么在图片中加图片 浏览:44
怎么给图片弄箭头 浏览:803
小女孩三年级发型图片 浏览:611
女生化妆穿搭图片 浏览:573
在存储中删除的微信图片怎么恢复 浏览:378
空姐做鸡图片大全 浏览:816
白色个性女生图片 浏览:637
儿童少数民族的衣服图片 浏览:838
儿童寸头发型图片男潮 浏览:371
怎么把扫描的图片弄到word 浏览:959
圆脸女孩有流海好看还是没有流海好看图片 浏览:936
男生犯困图片可爱 浏览:759
背影女孩素描壁纸图片 浏览:527
lr上如何查看图片大小尺寸 浏览:652