ZoomFactor的值就可以了。
以下是简单的图片缩放
Public Class Form1
Dim MapWidth As Integer
Dim MapHeight As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'设置窗体自动添加滚动条
Me.AutoScroll = True
'设置图片框内的图片自动拉伸
PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
'加载位图
Dim MapImage As New Bitmap(Application.StartupPath &"\ch4.png", True)
'图片框加载图片
PictureBox1.Image = MapImage
'设置图片框大小
PictureBox1.Size = New Size(MapImage.Width, MapImage.Height)
'记录原始大小
MapWidth = MapImage.Width
MapHeight = MapImage.Height
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
PictureBox1.Width = PictureBox1.Width * 2
PictureBox1.Height = PictureBox1.Height * 2
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
PictureBox1.Width = PictureBox1.Width / 2
PictureBox1.Height = PictureBox1.Height / 2
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
PictureBox1.Width = MapWidth
PictureBox1.Height = MapHeight
End Sub
End Class
horizontalHeader() ->setStretchLastSection(true),就是最后一列自动适应宽度,简单理解就是和table的右边连在一起。然后有点没搞懂你说的,你是说不要出现滚动条?那你需要调整一下每一列的宽度
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)