This article was previously published in my blog, Just Like a Magic.

A second honeymoon with Microsoft Agent. Do you remember our article Programming Microsoft Agent in WinForms and our sample application PartIt? After you have included your desired agent in your application, are you feeling bad with the default popup menu? If so, then you are in the right place (welcome :).)
Enough talking, let's get to work! First, prepare your code that loads the Microsoft Agent and brings it to the screen.
After that, create your System.Windows.Forms.ContextMenuStrip and add your required items (well, including "Hide" maybe) and finish the item event handlers.
Now, let's complete it. Get to the code that loads the agent character (e.g. calls the Characters.Load() method of the agent control object, AxAgentObjects.AxAgent) and just disable the AutoPopupMenu flag/property of the character object, AgentObjects.IAgentCtlCharacterEx. This flag/property determines whether to allow the default popup menu or not.
For example, the following code disables this property:
|
AxAgentObjects.AxAgent agentCtl; AgentObjects.IAgentCtlCharacterEx agentChar; // initializing 'agentCtl' // . . . agentCtl.Characters.Load("Merlin", "merlin.acs"); agentChar = agentCtl.Characters.Character("Merlin"); agentChar.AutoPopupMenu = false; |

Join the conversation! Your thoughts help the community grow.