70001818 How can use the PostCommandExecute without showing a command line

Article 70001818
Type HowTo
Product Engine
Version 7
Date Added 9/2/2020
Fixed 8.8006.0.2 (9/2/2020)
Submitted by Lim Wee Beng

Summary

How can use the PostCommandExecute without showing a command line

Solution

You can add in the form a command line control (vdComamndLine1) using the vdCommandLine.dll invisible in this form so the user cannot use it or see it and use the CommandExecute event (see also article 60000192 and vdfCAD samlpe code) and use a code like:

        public Form1()
        {
            InitializeComponent();
        }

        protected override void OnLoad(EventArgs e)
        {
            //   the form contains a VectorDRaw BaseControl named myVDBaseControl1 
            //   and a vdCommendLine control that is not visible named vdCommandLine1
            base.OnLoad(e); 
            doc = myVDBaseControl1.ActiveDocument;
            vdCommandLine1.SelectDocument(doc);
            vdCommandLine1.CommandExecute += VdCommandLine1_CommandExecute;
        }

        private void VdCommandLine1_CommandExecute(string commandname, bool isDefaultImplemented, ref bool success)
        {
            if (string.Compare(commandname , "zoomw", true) == 0)
            {
                success = true;
                doc.CommandAction.Zoom("W", null, null);
                return;
            }
            
        }

        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            vdCommandLine1.PostExecuteCommand("zoomw");
        }

Send comments on this topic.