- Green versionCheck
- Green versionCheck
- Green versionCheck
- Green versionCheck
- Green versionCheck
For those who have never done this kind of program, the most curious thing may be, after you draw something with the Graphics class, how can you re-select, move, and edit it?
Take drawing a rectangle as an example. If you use the Graphics class to draw a rectangle on a control (Control), and remember the starting point coordinates, size and other data of the rectangle, then when the user clicks on the control, you It can be judged whether the user clicked on the rectangle. If so, it means that the rectangle is selected. If the user also moves the mouse at the same time, then the starting point coordinates of the rectangle can be recalculated based on the distance moved, and then the rectangle can be redrawn. .
This is the basic method used by Aisouya Drawing Board. Internally remember the starting point coordinates, size, color and other information of various shapes (line segments, rectangles, ellipses, etc.). After the user moves or rotates the shape, this information must be updated immediately and the shape must be redrawn.
There are many other difficulties. For example, if the user enlarges the image and draws a new shape on the enlarged view, what is the difference between the processing at this time and the non-enlarged view? Another example is the undo (step back) function. How to give up the last operation and return to the previous state? The two functions of amplification and undo are not yet implemented, but the general idea is already there.
There are two purposes for making this program. First, after writing all the functions, use a control library I wrote before to make its UI, and then this drawing program will be used as an application example of the control library. The second is to make a practical screenshot and drawing program, try to imitate mspaint, but it must be enhanced in every aspect. Of course, the Aisouya drawing board is still very simple at present. It does not have a screenshot function, cannot paste bitmaps, cannot edit text, etc. It will continue to be improved later.
it works
it works
it works