hi
i need help about a drawing project...
i want draw polygons and text in a picture box and after drawing select them and move or change their properties . ??
thanx
Printable View
hi
i need help about a drawing project...
i want draw polygons and text in a picture box and after drawing select them and move or change their properties . ??
thanx
VB6 or vb.net?
in Vb6:
use PolylineApi to draw a Polygone
Declaration:
To determine the selection of that polygone you have to do some coding like, determine the click-positionand check if the click is on the polygone (maybe you only use the corner-points).For a movement you would need to redraw everxthing on the picturebox (including the changed polygone).Code:Declare Function PolyPolygon Lib "gdi32" Alias "PolyPolygon" (ByVal hdc As Long, lpPoint As POINTAPI, lpPolyCounts As Long, ByVal nCount As Long) As Long
To draw text onto a picturebox use a label-control, that one will detect a click on it by itself.
specially in VB6 , on picturebox mouse down event how can i realize which polygon is under mouse ?
In the Mousedown event, you get the x and y of the mouse, check this position against the positional data of all polygons you have (in my case, I check only the cornerpoints, since these discribe the polygon). If the click is close enough to one point of the polygon, you have detected the polygon. Now you can mark it as selected (either in code or on the screen).
thanx , i understand the algorithm but i need sample code...
i have X and Y of mouse but in a picture box the polygon doesn't have handle to select them. so what can i do ?
OK,
If you "detect" a ploygon just save it's ID (Name of polygon, number of index or whatever). Having saved the ID you can do whatever you need to that polygon (like draw a selected box around a cornerpoint, draw it in a different color, move every point etc.). But you need to declare a variable to save this info.
If all your polygons are in an array just save its index in a "PolygonSelected" variable (that it's easy to do any changes to the ploygon).