We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Paint Fill

bradsoblesky
bradsoblesky asked
on
Medium Priority
273 Views
Last Modified: 2010-04-30
I would like to know how to get the screen to fill or be painted with respect to lines as boundries. Like the paint bucket in MSPaint.
Comment
Watch Question

Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
Where do I put each of these? So I click on the picture or form and it does it.

Commented:
I would suggest the MouseUp event of the picture control:

Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  If Button = vbLeftButton Then
    'lColor is set elsewhere
    FillArea X, Y, lColor
  End If
End Sub

Author

Commented:
This is not working for me it tells me that lcolor is not defined and something about the part of the sub int "()" is not valid. Help.  

Commented:
You need to define lColor either globally or at module level and assign it a value (it would default to 0 which is black)

In the FillArea procedure, add the following line just before the FillColor line:
  Picture1.FillStyle = vbFSSolid
Finally, in the MouseUp routine, make this small change to the Call to FillArea():
    FillArea CLng(X), CLng(Y), lColor

Author

Commented:
Sorry about all the trouble. Thanks.

Commented:
No problem.  Glad I could help.  :)
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.