P
peter.bittner
Hi!
I am using the Visio Drawing Control from within an application I write
in C#.
I want to invert the current selection (select all unselected, deselect
all selected shapes), but I can't find a way to get to know the state
of "selected" or "not selected" when I iterate through all shapes, e.g.
for (int i = 1; i <= Visio.App.ActivePage.Shapes.Count; i++)
{
Shape shp = Visio.App.ActivePage.Shapes;
if (shp " is selected " )
Visio.App.ActiveWindow.Select(shp,
(short) VisSelectArgs.visDeselect);
else
Visio.App.ActiveWindow.Select(shp,
(short) VisSelectArgs.visSelect);
}
Can I only do this through getting the current selection? I can't get
this to work either:
Selection sel = Visio.App.ActiveWindow.Selection;
Visio.App.ActiveWindow.SelectAll();
for (int i = 1; i <= sel.Count; i++)
for (int j = 1; j <= sel.Shapes.Count; j++)
Visio.App.ActiveWindow.Select(sel.Shapes[j],
(short) VisSelectArgs.visDeselect);
(The code above litterally does nothing since "j <=
sel.Shapes.Count" irritatingly always evaluates to false.)
Or is there a ready-to-use command I can send to Visio (well, to the
drawing control) to invert the selection of the active window or
document?
Peter
I am using the Visio Drawing Control from within an application I write
in C#.
I want to invert the current selection (select all unselected, deselect
all selected shapes), but I can't find a way to get to know the state
of "selected" or "not selected" when I iterate through all shapes, e.g.
for (int i = 1; i <= Visio.App.ActivePage.Shapes.Count; i++)
{
Shape shp = Visio.App.ActivePage.Shapes;
if (shp " is selected " )
Visio.App.ActiveWindow.Select(shp,
(short) VisSelectArgs.visDeselect);
else
Visio.App.ActiveWindow.Select(shp,
(short) VisSelectArgs.visSelect);
}
Can I only do this through getting the current selection? I can't get
this to work either:
Selection sel = Visio.App.ActiveWindow.Selection;
Visio.App.ActiveWindow.SelectAll();
for (int i = 1; i <= sel.Count; i++)
for (int j = 1; j <= sel.Shapes.Count; j++)
Visio.App.ActiveWindow.Select(sel.Shapes[j],
(short) VisSelectArgs.visDeselect);
(The code above litterally does nothing since "j <=
sel.Shapes.Count" irritatingly always evaluates to false.)
Or is there a ready-to-use command I can send to Visio (well, to the
drawing control) to invert the selection of the active window or
document?
Peter