We know that Visio's Shape objects have 3 special properties, namely Data1, Data2, Data3, which we rarely use because we might be able to pass ShapeSheet's customed if we need attributes. Properties to define the information we need, the value of various attributes can be obtained, then Data1, Data2, Data3 for us, it is not very useful, but in some cases, we use it to do some operation is very convenient.
First we introduce what these attributes are, Data1, DATA2, Data3 are built-in properties of shape, do not need additional definitions, and it is said to be able to place 64K strings (not so large), and generally we are enough to place the content.
The word goes to the chase, we will use these attributes in any case, we think, we are in the drawing, there is always a picture frame to list those devices have a few equipment list, or a scale to explain what, these occasions can use them.
Because these lines, they may have been randomly drawn up, some of the equipment in the description and related information are generally based on the changes in the drawings, so each time you save, you may want to redraw, but when drawing, in order to distinguish from other device entities, we use these attributes to record the relevant information.
If we erase what we've already painted, we can do the following
Erase the original statistics first
if (Visioutility.hasshapeinwindow (Visapp.activewindow))
{
VisApp.ActiveWindow.SelectAll ();
foreach (Visio.Shape shape in visApp.ActiveWindow.Selection)
{
if shape. Data1 = = "Tongji")
{
shape. Delete ();
}
}
VisApp.ActiveWindow.DeselectAll ();
}
If we need to add that information, first draw a shape from the coordinates
Visio.Shape Shape = Visioutility.drawrectangeonpage (Visapp, LEFTTOPX, Lefttopy-j * cellheight,
LeftTopX + LeftCell Width, Lefttopy-(j + 1) * cellheight);