7,759
社区成员
发帖
与我相关
我的任务
分享
'大概是这样,自己修改一下.仅供参考
Option Explicit
Private Declare Function GetPixel Lib "gdi32.dll" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Private Declare Function BitBlt Lib "gdi32.dll" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Const SRCCOPY As Long = &HCC0020
Private Sub Command1_Click()
Dim a As Long, b As Long, i As Long, j As Long
Dim PRGB As Long
a = Picture1.ScaleWidth
b = Picture1.ScaleHeight
For i = 1 To b
For j = 1 To a
PRGB = GetPixel(Picture1.hdc, j, i)
If PRGB = 0 Then
Call BitBlt(Picture2.hdc, j, i, 1, 1, Picture1.hdc, j, i, SRCCOPY)
'Picture2.PSet (i, j), RGB(0, 0, 0)
Text1.Text = i & ";" & j
Text1.Refresh
End If
Next
DoEvents
Next
End Sub
Private Sub Form_Load()
Picture1.ScaleMode = 3
Picture2.ScaleMode = 3
Picture2.Width = Picture1.Width
Picture2.Height = Picture1.Height
End Sub
Private Sub Command1_Click()
Dim a As Long, b As Long, i As Long, j As Long
a = Picture1.Width / Screen.TwipsPerPixelX
b = Picture1.Height / Screen.TwipsPerPixelY
For i = 1 To a
For j = 1 To b
If Picture1.Point(i, j) = 0 Then
Picture2.PSet (i, j), RGB(0, 0, 0)
'Text1.Text = i & ";" & j
'Text1.Refresh
End If
Next j
DoEvents
Next i
End Sub