Private Declare Function GetPixel Lib "gdi32" _
(ByVal hdc As Long, ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function SetPixelV Lib "gdi32" _
(ByVal hdc As Long, ByVal X As Long, _
ByVal Y As Long, ByVal crColor As Long) As Long
Private Function Blue(ByVal mlColor As Long) As Long
Blue = (mlColor \ &H10000) And &HFF
End Function
Private Function Red(ByVal mlColor As Long) As Long
Red = mlColor And &HFF
End Function
Private Function Green(ByVal mlColor As Long) As Long
Green = (mlColor \ &H100) And &HFF
End Function
rgb5 = GetPixel(hdc5, i, j)
bBlue = Blue(rgb5)
bRed = Red(rgb5)
bGreen = Green(rgb5)
rgb5 = RGB(bRed, bGreen, bBlue)
SetPixelV hdc5, 你要的位置, 你要的位置, rgb5
(ByVal hdc As Long, ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function SetPixelV Lib "gdi32" _
(ByVal hdc As Long, ByVal X As Long, _
ByVal Y As Long, ByVal crColor As Long) As Long
Private Function Blue(ByVal mlColor As Long) As Long
Blue = (mlColor \ &H10000) And &HFF
End Function
Private Function Red(ByVal mlColor As Long) As Long
Red = mlColor And &HFF
End Function
Private Function Green(ByVal mlColor As Long) As Long
Green = (mlColor \ &H100) And &HFF
End Function
rgb5 = GetPixel(hdc5, i, j)
bBlue = Blue(rgb5)
bRed = Red(rgb5)
bGreen = Green(rgb5)
rgb5 = RGB(bRed, bGreen, bBlue)
SetPixelV hdc5, 你要的位置, 你要的位置, rgb5
如:在窗体上画线
先设置me.forecolor=xxxxxx
这样用line方法画出的线就是你想要的颜色了。