Demo program to illustrate drawing polygons by the click of a mouse, with lots of bells and whistles. Change colors, drag Vertices, move, resize, rotate, save as png or xml files. etc.
Draw polygon by clicking points with the left mouse button. When done, a right click will "finalize" or "complete" the polygon.
Then you can move it by dragging with the left mouse button.
You can resize it with the mouse wheel.
You can rotate it with the mouse wheel while pressing the control key.
You can reshape it by moving the mouse near a vertex until the cursor becomes a "cross". Then drag the vertex while holding down the left mouse button.
You can change the colors of various elements with the ColorComboBoxes.
You can save the polygon as a png image file or an xml file.
You can load a saved polygon from an xml file anf continue editing it.
Information about the polygon is shown in the right hand textblock.
There are also handy vertical and horizontal rulers which display the mouse position.
I don't know if the program has much practical value. But I wanted to explore polygons and this is the result.
Enjoy! Use the code however you like.