Modifying masters in a stencil


    Sponsored Links


  • 1. Selected shape & Properties
    How can know wich shape is selected and add there properties (according stencil) ? TNX
  • 2. Strange Collection of Shapes
    I have Shapes collection at VisPage.Shapes. The count of it return 3, but I see 3 shapes and 2 connectors between them. What is the problem? PLZ, Advice
  • 3. How to hide the drawing page frame in the drawing window
    Hi, My application draws using Visio 2003 ActiveX drawing control. The drawing is stored in database and is printed very occasionally so I do not need the drawing page frame with shadow in the drawing window. What is a way to hide the drawing page frame in the drawing window and draw just on the window? By the way I can not hide page shadow in Visio using Shadows dialog in File-Page Setup menu: the page shadow appears in any case. Thank you in advance, Sergey
  • 4. Sizing diagrams to fit a 450x600 pixel JPEG image
    Hi, I have been trying to get an image from a Visio diagram as a .JPG file which is exactly 450x600 pixels in size. Now I used the .NET System.Drawing classes to covert an image saved using the Export facility to 450x600. However the converted image is not clear specially regarding the text because it is distorted by the resizing. Can I specify Visio Shape lengths and widths in pixel units so that resizing is not required? What other alternatives are there? I also tried SaveAsWebPage functionality but there is no way to specify the size of the image. I can just specify the screen resolution. Also a line of 1 inch length in Visio at 1024x768 pixels screen resolution is *smaller* physically than at 800x600? So it would seem that Visio uses a fixed ppi(pixels per inch) value for converting from inches to pixel units for drawing on screen. What is this value? Regards, Anupam

Modifying masters in a stencil

Postby Markus Breugst » Sat, 08 Jan 2005 23:06:47 GMT

Dear All,

I would like to programatically modify a stencil by changing the name and
some properties of the contained master shapes. (The name I want to change
is the name that is displayed below each master in the stencil.)
This is to be implemented in a C# application. However, for testing I wrote
the VBA macro below.

The macro works fine if the stencil is open for editing (mouse click onto
the top left corner of the stencil, then click "Edit").

Question: How can I enter a stencil's edit mode programatically? I tried
this via the AllowEditing flag or by closing and re-opening the stencil with
the 'visOpenRW' flag. Unfortunately, both did not work. I found several
newsgroup threads concerning this issue, but none of them really helped me.

Thanks a lot in advance for any hint!

Best regards,

Public Sub UpdateStencil()
    Dim myStencil As Document
    Dim myMasters As Masters
    Dim myMaster As Master
    Dim myMasterCopy As Master
    Dim myShape As Shape
    Dim index As Integer
    Dim win As Window

    On Error Resume Next

    Set myStencil = Documents("My Stencil.vss")
    myStencil.Title = "New Title"
    Set myMasters = myStencil.Masters
    For index = 1 To myMasters.Count
        Set myMaster = myMasters(index)
        Set myMasterCopy = myMasters(index).Open
        Set myShape = myMasterCopy.Shapes(1)
        myMaster.Name = "New Name"
        myShape.Cells("User.ELEMENT_ID").Formula = 12345
    Next index
End Sub

Similar Threads:

1.Visio 2003 - Org Chart from Excel Ignores Modified Masters in Document Stencil

2.Modify selection of masters in stencil?

I have a C# application hosting a Visio ActiveX control. The
application enables the user to create new masters (programatically).
However, when a new master is created (using Stencil.Drop()), it gets
selected, in addition to the already selected masters.
I know I can get the currently selected masters list from the windows
of the stencil, but is there a way to modify this selection?


3.Modify a shape master and update all the shapes on the visio p

4.Modify a shape master and update all the shapes on the visio pages

my problem is the following:
1) I create a new shape master
2) I use it many times in a one or more visio pages
3) then when I make a modification on the shape master I would automatically 
update all the shapes on the visio pages I used before; is that possibile? 
Please, help me!

5.DoDragDrop on modified master shapes has strange side-effect

The scenario is the following:

I have a tree which I drag shapes from. When dragging the item, i find its 
corresponding master in the document stencil (via doc.Masters.get_ItemU) and 
DoDragDrop(foundMaster, DragDropEffects.Copy) on the master shape I get.

After doing this a couple of times (and it works as it should) i edit (in 
visio) the master shape in the document stencil. After updating all 
references i try dragging another one in from my tree. The dragged object 
looks fine, but when releasing/dropping the shape on the drawing surface, the 
text is renamed to what it was before, and another master is created in the 
document stencil.

Why is this happening? My code find the correct master since the text is 
correct when dragging the item without releasing it... But Visio does 
something when i release it. I know that the UniqueID changes when editing 
the text, but should this really be a problem?

If i edit the master in the document stencil before doing any drag-and-drop 
operation, then drag-and-drop works (no change of text and no new master 
shape), but immediately after editing the master, it starts acting weird!

Dragging the master from the document stencil works fine in every case.

Another thing:
I have also noticed that the icon when my drag-and-drop operation is going 
on, is more like in windows explorer, but when using the document stencil 
it's only a small 'plus' sign. What is the difference?.. How can I access 
Visios internal drag-and-drop functionality?

6. Modified Shape Masters have funny effect on Text Placement

7. master shape in stencil versus document stencil

8. How to update document stencil master from stencil

Return to VISIO


Who is online

Users browsing this forum: No registered users and 73 guest