Visio Guy

Visio Discussions => Programming & Code => Topic started by: SidRoy on January 19, 2009, 07:14:57 AM

Title: How to add Clip Art & Task Pane
Post by: SidRoy on January 19, 2009, 07:14:57 AM
Hi,
Im my C# application, i'm trying to integrate Clip Art and Task Pane along with many other menu items. The code i'm using is:

using vis = Microsoft.Office.Interop.Visio;

((DrawingPage)this.ActiveMdiChild).axDrawingControl.Window.Application.DoCmd((short)vis.VisUICmds.visCmdInsertClipArt);

((DrawingPage)this.ActiveMdiChild).axDrawingControl.Window.Application.DoCmd((short)vis.VisioCmd.VisUICmds.visCmdTaskPane);


But some how, its not working. I have successfully included other toolbar functionalities in my application using similar code. But its not working for Clip Art & Task Pane.
What am i doing wrong here? Please help me fix this.

Thanks in advance,
Roy
Title: Re: How to add Clip Art & Task Pane
Post by: Visio Guy on January 19, 2009, 10:08:52 AM
Hi Roy,

I would guess that the Task Pane is disabled for the Visio control.

A test would be to see if you are able to get it to show up manually in any way when using the Visio control.

Clipart - I have no idea, I haven't ever played with that via automation.

- Chris
Title: Re: How to add Clip Art & Task Pane
Post by: SidRoy on January 19, 2009, 11:41:20 AM
Hi Chris,
Yes i get that error saying "Requested operation is presently disabled". What do i do about this? How do i enable these operations that i'm calling?
I have observed a pattern while adding menubar/toolbar functionalities to my application. Functionalities like
Format - Text
Spelling Check
Insert - Picture - From File
etc, which open a dialog work fine using similar calling method:

((DrawingPage)this.ActiveMdiChild).axDrawingControl.Window.Application.DoCmd((short)vis.VisUICmds.visCmdFormatAllTextProps);

((DrawingPage)this.ActiveMdiChild).axDrawingControl.Window.Application.DoCmd((short)vis.VisUICmds.visCmdToolsSpelling);

((DrawingPage)this.ActiveMdiChild).axDrawingControl.Window.Application.DoCmd((short)vis.VisUICmds.visCmdFileImport);

Works perfectly fine.
But as soon as i use similar code to call functionalities like : Task Pane, Research, Insert -  Picture - ClipArt which open in a new window(task pane) at the right corner, it doesn't work giving me the same error "Requested operation is presently disabled". What actually is going wrong here? Please help me figure out a solution.

Thanks,
Roy
Title: Re: How to add Clip Art & Task Pane
Post by: Visio Guy on January 19, 2009, 12:19:28 PM
My guess is that the designers at MS decided that the task pane, etc. "didn't make sense" in the context of the Visio control (or were prohibitively difficult to implement) and therefore disabled them on purpose.

For instance, the ShapeSheet is not available in the Visio control, nor is the VBA editor.

You'll probably have to re-create your own windows or panes or dialogs that mimic what you need.