vb picturebox
就是要将文本框显示的文字区域抓图到picturebox中,然后在picturebox中判断字的颜色,符合指定颜色条件的像素点的颜色修改为我们红色。怎么些这个程序啊,我自己...
就是要将文本框显示的文字区域抓图到picturebox中,然后在picturebox中判断字的颜色,符合指定颜色条件的像素点的颜色修改为我们红色。怎么些这个程序啊,我自己写了,不行,拜托谢谢
展开
1个回答
展开全部
Private Const SRCCOPY = &HCC0020
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Private Declare Function BitBlt Lib "gdi32" (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 Sub Form_Load()
Text1.ForeColor = &HFF00&
Text1.Text = "12345"
Picture1.AutoRedraw = True
Picture1.ScaleMode = 3
End Sub
Private Sub Command1_Click()
Dim thdc As Long
thdc = GetDC(Text1.hwnd)
BitBlt Picture1.hdc, 0, 0, 100, 100, thdc, 0, 0, SRCCOPY
ReleaseDC Text1.hwnd, thdc
Dim i As Long
Dim j As Long
For i = 0 To 100
For j = 0 To 100
If Picture1.Point(i, j) = &HFF00& Then Picture1.PSet (i, j), &HFF
Next j
Next i
Picture1.Refresh
End Sub
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Private Declare Function BitBlt Lib "gdi32" (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 Sub Form_Load()
Text1.ForeColor = &HFF00&
Text1.Text = "12345"
Picture1.AutoRedraw = True
Picture1.ScaleMode = 3
End Sub
Private Sub Command1_Click()
Dim thdc As Long
thdc = GetDC(Text1.hwnd)
BitBlt Picture1.hdc, 0, 0, 100, 100, thdc, 0, 0, SRCCOPY
ReleaseDC Text1.hwnd, thdc
Dim i As Long
Dim j As Long
For i = 0 To 100
For j = 0 To 100
If Picture1.Point(i, j) = &HFF00& Then Picture1.PSet (i, j), &HFF
Next j
Next i
Picture1.Refresh
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询