Image控件--处理尺寸不同图片是否用StretchVB codeWith Form1.Image1.Picture ImageList1.ListImages(1)
Image控件--处理尺寸不同图片是否用Stretch
- VB code
With Form1 .Image1.Picture = ImageList1.ListImages(1).Picture kk = .Image1.Picture.Height / .Image1.Picture.Width With .Image1 '.Picture .Top = 10 .Left = 4000 .Width = 11000 .Height = .Width * kk '.Stretch = True End With End With
在此讨论的问题:
1用Stretch = True将不同尺寸调整为统一尺寸---有时有变形,图形效果不好。
2用AcdSee等软件,处理图片尺寸为统一尺寸格式,.Stretch = False
谢谢。
[解决办法]
就像下面这样:
- VB code
Picture1.BorderStyle = 0 '设置picture的属性,无论有多少图,有这一 '个 picturebox就够了,可以重复用 Picture1.AutoRedraw = True Picture1.AutoSize = True Picture1.Visible = False Picture1.Picture = LoadPicture("c:\3.jpg") Dim bili As Single bili = Picture1.Height / Picture1.Width '原图的长宽比,保存在这个变量里 Picture1.PaintPicture Picture1.Picture, 0, 0, 4000, 4000 * bili '假设你希望每个图的宽度都是4000缇 Set Image1.Picture = Picture1.Image 