Visio Guy

Visio Discussions => Programming & Code => Topic started by: ziko on April 28, 2010, 02:15:48 PM

Title: Need help with annotation position
Post by: ziko on April 28, 2010, 02:15:48 PM
Hello,
using automation, I am displaying an annotation when the user selects a shape. The annotation is an "Oval callout" from the ANNOT_U.VSS stencil. The balloon pops up displays the information to the user, but the problem is:
1- positioning this annotation and bind it, glue to connection point of the shape the user selected.
2- if the shape is on the top or the right of the page the annotation is going outside the scope of the page because it always displays on the top-right of the shape. How can I change it programmatically to display on the underneath the shape if the shape is on the top of the page or on the left of the shape if the shape is on the right of the page?

Any help is very much appreciated,
Ziko
Title: Re: Need help with annotation position
Post by: ziko on April 28, 2010, 08:08:03 PM
I actually solved #1:
Call lAnnotation.CellsU("BeginX").GlueTo(lShape.CellsU("PinX"))

but for #2 if I can get the page width and height I can do the calculations to see if the lShape.PinX is close to the top or to the right so I can drop my lAnnotation in a position less than the Xpos or Ypos.
Thank You,
Ziko
Title: Re: Need help with annotation position
Post by: Jumpy on April 29, 2010, 06:31:57 AM
Hello,
try sth. like this:


Sub Test()
Dim pg As Visio.Page
Dim Width As Double

Set pg = ActivePage

Width = pg.PageSheet.Cells("PageWidth").Result("MM")

End Sub
Browser ID: smf (is_webkit)
Templates: 1: Printpage (default).
Sub templates: 4: init, print_above, main, print_below.
Language files: 1: index+Modifications.english (default).
Style sheets: 0: .
Hooks called: 46 (show)
Files included: 25 - 925KB. (show)
Memory used: 773KB.
Tokens: post-login.
Cache hits: 6: 0.00115s for 22,291 bytes (show)
Cache misses: 1: (show)
Queries used: 8.

[Show Queries]