User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » C# Visio Layer Control Page [1]  
taylor
All American
2210 Posts
user info
edit post

Anyone have an idea how to turn layers on or off with C# using the Microsoft.Office.Interop.Visio package?

6/9/2006 12:41:01 PM

moe
All American
683 Posts
user info
edit post

here's pieces of some code im working on that would help (though its in vb, you still should get the idea)

Dim pageToDrop As Microsoft.Office.Interop.Visio.Page = AxDrawingControl1.Window.Page()
Dim layer As Microsoft.Office.Interop.Visio.Layer
layer = pageToDrop.Layers.Item(1)
layer.CellsC(Microsoft.Office.Interop.Visio.VisCellIndices.visLayerVisible).FormulaU = "0"

alot of times i find it easiest to open up Visio and run a macro to see what code it generates

6/9/2006 1:58:54 PM

taylor
All American
2210 Posts
user info
edit post

Yeah I've got it working in VB... The issue is the Interop, here's what I've got in VB (which it can't be in, I'm using the ActiveX Visio Control, no VBA runtime):
''Turn off the layer "Bdr" to remove the border
For Each layer In Visio.ActivePage.Layers
Set layerObjVisCell = layer.CellsC(visLayerVisible)
Set layerObjPrintCell = layer.CellsC(visLayerPrint)
If (layer.Name = "Bdr") Then
layerObjVisCell.Formula = 0
layerObjPrintCell.Formula = 0
Border = True
End If
Next
If Border = False Then
MsgBox "Border layer does not exist!"
End If

6/14/2006 9:26:12 AM

taylor
All American
2210 Posts
user info
edit post

Anyone know how to run VB macros from C#? I've found an example for everything but Visio in M$Office: here http://support.microsoft.com/?scid=kb;en-us;306683&spid=2530&sid=47

But Visio has a different interop than all the other Office applications. I can get Visio to launch from C# and even open the drawing I want, but I am unable to run macros still. Any Suggestions?

6/15/2006 2:36:51 PM

 Message Boards » Tech Talk » C# Visio Layer Control Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.39 - our disclaimer.