Article | 60000960 |
Type | HowTo |
Product | Engine |
Version | 6 |
Date Added | 9/16/2009 |
Submitted by | Jong Lee |
Keywords |
private void button2_Click(object sender, EventArgs e)
{
VectorDraw.Professional.vdObjects.vdDocument doc = vdFramedControl1.BaseControl.ActiveDocument;//ask the user to draw the circle
bool cir_success=doc.CommandAction.CmdCircle(null, null);
if (cir_success)
{ // cmdCircle is successful
VectorDraw.Professional.vdFigures.vdCircle circ = (VectorDraw.Professional.vdFigures.vdCircle) doc.ActiveLayOut.Entities[doc.ActiveLayOut.Entities.Count - 1];
if (circ == null) return;
VectorDraw.Geometry.gPoint pt_center = new VectorDraw.Geometry.gPoint(circ.Center);// got the circle and its properties
double radius = circ.Radius;//calculate the points @ 45, 135 and 225 degrees
VectorDraw.Geometry.gPoint pt_45 = pt_center.Polar(VectorDraw.Geometry.Globals.HALF_PI/2.0d, radius);
VectorDraw.Geometry.gPoint pt_225 = pt_center.Polar(5.0d*VectorDraw.Geometry.Globals.HALF_PI/2.0d, radius);
VectorDraw.Geometry.gPoint pt_135 = pt_center.Polar(3.0d * VectorDraw.Geometry.Globals.HALF_PI / 2.0d, radius);
// draw the lines
VectorDraw.Professional.vdFigures.vdLine line = new VectorDraw.Professional.vdFigures.vdLine();//diameter "blue" line
line.SetUnRegisterDocument(doc);
line.setDocumentDefaults();
line.StartPoint = pt_45;
line.EndPoint = pt_225;
line.PenColor.FromSystemColor(Color.Blue);
doc.ActiveLayOut.Entities.AddItem(line);
line.Invalidate();line = new VectorDraw.Professional.vdFigures.vdLine();//radius "red" line
line.SetUnRegisterDocument(doc);
line.setDocumentDefaults();
line.StartPoint = pt_center;
line.EndPoint = pt_135;
line.PenColor.FromSystemColor(Color.Red);
doc.ActiveLayOut.Entities.AddItem(line);
line.Invalidate();
}
}