怎么放大和缩小QWidget中的控件

怎么放大和缩小QWidget中的控件,第1张

Pegasus的ImagXpress 8.0控件,支持各种格式文件的加载。控件封装了右键局部区域放大的功能,要实现图片的缩放,把AutoResize属性设置为PegasusImaging.WinForms.ImagXpress8.AutoResizeType.CropImage,修改

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的右边连在一起。

然后有点没搞懂你说的,你是说不要出现滚动条?那你需要调整一下每一列的宽度


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/tougao/11343703.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-15
下一篇 2023-05-15

发表评论

登录后才能评论

评论列表(0条)

保存