实现图片的放大缩小可以通过改变图片的宽度和高度来实现,下面举例说明。
点击下载此附件
操作步骤:
打开ACCESS,新增一空白窗体,在窗体中添加一个图像控件,修改图片名称,设定图片来源,如下图:
在窗体中添加两按钮,标题分别为“放大”,“缩小”,名称分别为”cmdBigger”,”cmdSmaller”,为两按钮的单击事件编写代码如下:
Private Sub cmdBigger_Click()
Dim intWidth As Integer
Dim intHeight As Integer
With Image2
intWidth = .Width
intHeight = .Height
.Width = intWidth * 4.05
.Height = intHeight * 4.05
.SizeMode = acOLESizeZoom
End With
' Allow Access time to Repaint Screen
' since we have Autorepeat set to TRUE for
' this Command Button
DoEvents
End Sub
Private Sub cmdSmaller_Click()
Dim intWidth As Integer
Dim intHeight As Integer
With Image2
intWidth = .Width
intHeight = .Height
.Width = intWidth / 1.05
.Height = intHeight / 1.05
.SizeMode = acOLESizeZoom
End With
' Allow Access time to Repaint Screen
' since we have Autorepeat set to TRUE for
' this Command Button
DoEvents
End Sub
保存运行即可!