HowTo : How can I get an entity ans show its properties in a vdPropertyGrid using a vdScrolableControl ?
| Article | 60000151 |
| Type | HowTo |
| Product | Engine |
| Version | 6 |
| Date Added | 5/16/2007 |
| Submitted by | Pedro Godinho |
| Keywords | |
Subject
How can I get an entity ans show its properties in a vdPropertyGrid using a vdScrolableControl ?
Summary
How can I get an entity and show its properties in a vdPropertyGrid using a vdScrolableControl ?
Solution
Yo can try a code like :
private void Form1_Load(object sender, EventArgs e)
{
AddLayoutEntities();
vdSC.BaseControl.vdMouseClick += new VectorDraw.Professional.Control.MouseClickEventHandler(BaseControl_vdMouseClick);
}
void BaseControl_vdMouseClick(MouseEventArgs e, ref bool cancel)
{
VectorDraw.Professional.vdPrimaries.vdFigure fig;
VectorDraw.Geometry.gPoint pt = vdSC.BaseControl.ActiveDocument.CursorPosCCS(e.Location);
VectorDraw.Geometry.gPoint p1 = vdSC.BaseControl.ActiveDocument.World2PixelMatrix.Transform(pt as VectorDraw.Geometry.gPoint);
Point location = new Point((int)p1.x, (int)p1.y);
fig = vdSC.BaseControl.ActiveDocument.ActiveLayOut.GetEntityFromPoint(location, vdSC.BaseControl.ActiveDocument.ActiveLayOut.Render.GlobalProperties.PickSize, false);
if (fig == null)
{
vdPGrid.SelectedObject = vdSC.BaseControl.ActiveDocument;
this.Text = "NO Entity clicked";
}
else
{
vdPGrid.SelectedObject = fig;
this.Text = "Entity clicked";
}
}