0

How can I add screen tip to shape in visio using c# and Microsoft.Office.Interop.Visio Actually I tried to use Controls Section and I followed microsoft documentation but it does not work and showing me this error: "\n\nUnexpected end of file."

here is microsoft documentation: https://learn.microsoft.com/en-us/office/client-developer/visio/tip-cell-controls-section

And here is my code in c# to change the screentip(last line for screen tip)

visioRectShape.get_Cells("FillForegnd").Formula = "RGB(0,102,255)";
                            visioRectShape.get_Cells("Char.Size").Formula = "10 pt";
                            visioRectShape.get_CellsU("Controls.TestName.Tip").Formula = "10 pt";
JohnGoldsmith
  • 2,638
  • 14
  • 26
samer nassar
  • 3
  • 1
  • 4

2 Answers2

1

I don’t think adding a tip to controls is what you want to do. If you want a tool tip on the whole shape then add it to the Comment cell in the Miscellaneous section. You can do this like this:

visioRectShape.get_Cells("Comment").Formula = "\"My Text Tip\"";

Note the tip has double quotes inside the string of the Formula, i.e. double double quotes. Controls are the little yellow handles which allow you to move part of a shape. Not all shapes have them. They are different from the handles which allow you resize and rotate whole shapes. Adding a tip to a control will show for just the yellow handle. If this is what you want to do you can do it like this:

visioRectShape.get_Cells("Controls.Row_1.Prompt").Formula = "\"Control Tip\"";

"Row_1" in the cell name above must be the name of a Control row in the shape.

1

Ah @HappyMoose got there first so points to her/him....but since I'd virtually finished writing - the Tip cell's name is Prompt rather than 'Tip', which is displayed in the ShapeSheet.

visioRectShape.CellsU["Controls.Row_1.Prompt"].FormulaU = $"=\"MyControlHandle\"";
visioRectShape.CellsU["Comment"].FormulaU = $"=\"MyShapeComment\"";

enter image description here

JohnGoldsmith
  • 2,638
  • 14
  • 26