Prod.: Engine, ver.: 6, ID: 60000151, HowTo : How can I get an entity and show its properties in a vdPropertyGrid using a vdScrolableControl

HowTo : How can I get an entity and show its properties in a vdPropertyGrid using a vdScrolableControl

Article60000151
TypeHowTo
ProductEngine
Version6
Date Added5/16/2007
Submitted byPedro Godinho
Keywords

Subject

How can I get an entity and 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";
    }
}