7,757
社区成员
发帖
与我相关
我的任务
分享
'窗体上加上 PictureBox 和 CommandButton'
Option Explicit
Private Sub Command1_Click()
Dim pic As IPictureDisp
Dim y As Long
Dim picHeight As Long
Set pic = LoadPicture("D:\temp\1.bmp")'截图'
picHeight = ScaleY(pic.Height, vbHimetric, vbPixels)
Picture1.ScaleMode = vbPixels
Picture1.PaintPicture pic, 0, 0
For y = 0 To picHeight - 1
If Picture1.Point(0, y) = vbRed Then Exit For
Next
MsgBox FormatPercent((picHeight - y) / picHeight)
End Sub