网站首页 > 文章中心 > 其它

vb.net框选放大图像

作者:小编 更新时间:2023-09-06 11:18:01 浏览量:456人看过

vb.net 如何放大和缩小图片

Sub 图片缩放()

Dim PicOld As Image = Image.FromFile("原图片路径")

Dim PicNew As New System.Drawing.Bitmap(PicOld, PicOld.Width * SngPer, PicOld.Height * SngPer)

PicNew.Save("新图片路径", Drawing.Imaging.ImageFormat.Jpeg)

vb.net框选放大图像-图1

End Sub

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

实现代码:

BeginVB.FormForm1

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

LinkTopic="Form1"

BeginVB.PictureBoxPicture1

AutoRedraw=-1'True

AutoSize=-1'True

Picture="Form1.frx":0000

End

Caption="放大"

TabIndex=1

BeginVB.CommandButtonCommand1

Caption="缩小"

TabIndex=0

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

i=i+100:j=j+100

PrivateSubForm_Load()

i=Picture1.Width:j=Picture1.Height

扩展资料:

其它方法:

VisualBasiccode

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

OptionExplicit

DimlngGraphicsAsLong

DimlngImageHandleAsLong

DimlngTextureBrushAsLong

DimgpPAsGpStatus

DimlngPen1AsLong

DimlngTokenAsLong

DimGpInputAsGdiplusStartupInput

DimintPAsInteger

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

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

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

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

IflngGraphics<>0ThenGdipDeleteGraphicslngGraphics

IflngImageHandle<>0ThenGdipDisposeImagelngImageHandle

IflngTextureBrush<>0ThenGdipDeleteBrushlngTextureBrush

Me.Refresh

DimbolPAsBoolean

WithMe

.Caption="GDIPlus范例"

EndWith

GpInput.GdiplusVersion=1

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

vb.net中怎么实现图片缩小和放大

以上就是土嘎嘎小编为大家整理的vb.net框选放大图像相关主题介绍,如果您觉得小编更新的文章只要能对粉丝们有用,就是我们最大的鼓励和动力,不要忘记讲本站分享给您身边的朋友哦!!

版权声明:倡导尊重与保护知识产权。未经许可,任何人不得复制、转载、或以其他方式使用本站《原创》内容,违者将追究其法律责任。本站文章内容,部分图片来源于网络,如有侵权,请联系我们修改或者删除处理。

编辑推荐

热门文章