Draw Lines and Shapes on a Form Sample
File: ...\Samples\Solution\Forms\Graphics\Fdmain.scx
This sample illustrates how to use form graphics methods (PSet, Line, and Circle) and properties (DrawMode, DrawStyle, DrawWidth) to make it possible for a user to draw figures and shapes on a form in different colors and different pen widths.
The sample includes a toolbar (defined in Fdproc.prg) and a form (based on frmFD in Fd.vcx). The user can select settings in the toolbar that affect the graphics properties of the form. When the form is set to accept user drawing, the MousePointer is set to 2 (cross-hairs).
The drawing functionality is coded in the methods associated with the MouseDown and MouseMove events of the form.
* MouseDown
PARAMETERS nButton, nShift, nXCoord, nYCoord
IF THIS.MousePointer = 2
THIS.PSet(nXCoord, nYCoord)
ENDIF
* MouseMove
PARAMETERS nButton, nShift, nXCoord, nYCoord
IF THIS.MousePointer = 2
THISFORM.LINE(nXCoord, nYCoord)
ENDIF
See Also
Tasks
Display Line Animation on a Form Sample
Reference
Visual FoxPro Foundation Classes A-Z