導航:首頁 > 動漫圖片 > vb怎麼使圖片大小

vb怎麼使圖片大小

發布時間:2025-04-01 14:20:28

㈠ 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控制項實現圖片放大和圖片縮小功能



(1)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如何使圖片和界面大小一致

Image控制項有stretch屬性,是自動拉伸圖片,適應控制項大小。
Picture控制項有AutoSize屬性,是自動適應圖片大小。
如果是其它的控制項,沒有自然屬性的話,只能手動編程。

窗體改變大小時候觸發Resize事件,如果要圖片框和窗體大小一樣,則需要在窗體的Resize事件中加入代碼。
不過,如果要讓此圖片當背景,可以直接給窗體的Picture屬性賦圖片,不用加個圖片框來當背景。

閱讀全文

與vb怎麼使圖片大小相關的資料

熱點內容
小女生陰部圖片 瀏覽:982
胖女生穿搭圖片 瀏覽:44
戴帽子的編發圖片女生 瀏覽:390
用紙做衣服圖片大全 瀏覽:345
淘寶衣服圖片拍攝 瀏覽:3
女生與女生接吻圖片大全圖片 瀏覽:22
男小動物頭像圖片可愛 瀏覽:221
簡單老鼠圖片百度網盤 瀏覽:335
初中男生圖片真實拍照帥氣 瀏覽:735
文字圖片一個人 瀏覽:875
泰拉瑞亞怪物大全圖片 瀏覽:411
3歲女寶中長發型圖片 瀏覽:229
圖片頭像霸氣男生 瀏覽:952
女士吊墜圖片及價格 瀏覽:266
裁剪衣服圖片公式 瀏覽:726
門鈴圖片大全 瀏覽:439
可愛指甲圖片大全圖片大全 瀏覽:155
抽煙傷感圖片唯美女生 瀏覽:954
小狗圖片卡通圖片大全可愛 瀏覽:832
動漫陽光暖男男生圖片 瀏覽:582