7,763
社区成员
发帖
与我相关
我的任务
分享
Option Explicit
Private Sub test(Pic As PictureBox, ByVal BMPFile As String, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long)
On Error GoTo errhandle
Dim SM As Integer '暂时保存原有ScaleMode,处理后还原
SM = Pic.ScaleMode
Pic.AutoRedraw = True
Pic.ScaleMode = 3
Set Pic.Picture = LoadPicture(BMPFile)
Pic.Line (X1, Y1)-(X2, Y2), vbRed, B
Pic.ScaleMode = SM
Exit Sub
errhandle:
End Sub
Private Sub Command1_Click()
test Me.Picture1, "C:\test.bmp", 10, 10, 100, 100
End Sub