Prod.: Engine, ver.: 6, ID: 60001681, HowTo : How can I hide the grips of entities that are inside a vdBlock (vdInsert)

HowTo : How can I hide the grips of entities that are inside a vdBlock (vdInsert)

Article60001681
TypeHowTo
ProductEngine
Version6
Date Added4/25/2012
Submitted bySamir Raorane
Keywords

Subject

How can I hide the grips of entities that are inside a vdBlock (vdInsert)

Summary

I have some blocks and inserts that have lines and MText objects and I don't wnat the grips of these MText objects to be visible. How can I do this ?

Solution

You need to use the OnGetGripPoints event and set the cancel=true for this vdMtext Object. You can use a xProperty in the vdMtext that is inside the block that will control this. See the attached code:
private void MyButton_Click(object sender, EventArgs e)
{
    vdDocument Doc = vdFramedControl1.BaseControl.ActiveDocument;
    Doc.New(); Doc.Open(@"C:\test\grip.vdml");
    // a drawing that contains such a block / insert is opened
    Doc.OnGetGripPoints += new vdDocument.GetGripPointsEventHandler(Doc_OnGetGripPoints);
    Doc.GripBlock = vdDocument.VdConstGripBlock.GripALLENTITIES;
 
}
 
void Doc_OnGetGripPoints(object sender, gPoints gripPoints, ref bool cancel)
{
    vdMText txt = sender as vdMText;
    if (txt != null)
    {
        vdXProperty prop = txt.XProperties.FindName("AvoidGrips");
      // this vdXproperty is added to the vdMtext that is inside the vdBlock
        if (prop.PropValue.ToString() == "True")
        {
            cancel = true;
        }
    }
}