Introduction
Paint Brush tool is similar to the pencil (Free hand) with more features. It too can be used in different colors, the shape and size of the Paint Brush can also be changed.
Project Idea
Global Variable
Steps
In mouse down
In mouse move
Problem
If we run the previous code, the free hand will work but if we stop in drawing we will note that , pen is still drawing however the mouse up so we will make flag and test through it where flag will be true if mouse down and set flag to be false while mouse up.
Change Color of Pencil
Steps:
In event of Label : make all label in one event
Note: I add flag named colorflag because I give default color to pen when app run first , I depend on getting color if user press click on label so if I do not make this flag and user start to draw without choose color exception will occur, so I avoid this by given default color and if make something like sensor to know if user click on label and if this done I will switch to take user color.
Change Size of pencil
Surprise!!!
After we ended from paint brush if we minimize the form to taskbar we will note that the form not contains any graphics and like a blank page.
Solution
I will class that store each point p1, p2 and pen and for each line I do I will store it in Arraylist then I will retrieve data stored in Arraylist in event Paint.
Save Your Image
Future develpoement
if Allah wishes i will add the following to the following
add undo & redo to lines.
open image
make paint brush client-server
1 التعليقات:
really nice work keep it up
but i can't download the source please solve this problem soon and thnx very much
إرسال تعليق