Product : Engine, Version : 5.1.1.1041, ArticleID : 41024250

HowTo : ToolStrip and/or MenuStrip (VS 2005) problems with VectorDraw cmds

Article41024250
TypeHowTo
ProductEngine
Version5.1.1.1041
Date Added6/22/2006
Submitted byP. Hanios
Keywords

Subject

ToolStrip and/or MenuStrip (VS 2005) problems with VectorDraw cmds

Summary

When I use ToolStrip and/or MenuStrip components in VS 2005 (.NET) and in the button-click event handler try to use VectorDraw CommandActions cmds then I need to manual set the focus to the VectorDraw component with an extra click. The code is like :
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            vd.CommandAction.cmdLine("USER"); //line
        }

Solution

There is a way to bypass this problem using PostCommandId Sub (see our help for more information) and CommandId Event (see our help for more information).

In your application you should change the button-click code to :
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            vd.PostCommandId(999); //line
        }

        private void vd_CommandId(object sender, AxVDProLib5._DVdrawEvents_CommandIdEvent e)
        {
            switch (e.cmdid)
            {
                case 999:
                    vd.CommandAction.CmdLine("USER");
                    break;
                default:
                    Console.WriteLine("Default case");
                    break;
            }
        }