Hi friends, This is Sunny. i am trying to create a paint brush. almost i have done it but there is a problem in filling color.
Actually i have done it in vb6 but when i use vb.net it does not work.
here i write vb6 code :

Private Declare Function ExtFloodFill Lib "Gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal crColor As Long, ByVal wFillType As Long) As Long

Dim X1 As Long, Y1 As Long
Dim draw As Byte

Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
draw = 1
If Button = 1 Then
X1 = X
Y1 = Y
ElseIf Button = 2 Then
Randomize
Picture1.FillColor = RGB(Int(Rnd * 255), Int(Rnd * 255), Int(Rnd * 255))
ExtFloodFill Picture1.hdc, X, Y, Picture1.Point(X, Y), 1
End If
End Sub

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
If draw = 1 Then
Picture1.Line (X1, Y1)-(X, Y)
X1 = X
Y1 = Y
End If
End If
End Sub

Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
draw = 0
End Sub

but in vb.net it shows errors. like 'hdc' not works in vb.net.
please try to solve the problem.
thanks !

Recommended Answers

All 2 Replies

See my reply on coderewind.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.