VectorDraw FAQ finishing: how to initialize bhatch dialog boxes with specific values?

VectorDraw Developer Framework (VDF) is an application for the visualization of graphics engine library. With VDF provides functionality that you can easily create, edit, manage, export, import and print 2D and 3D graphics files.   


ask:

   If you want to initialize bhatch dialog boxes with specific values ​​or keep the previous value of the dialog box, how should we do?

answer:

    Please check the following code shows how to override the default bHatch command implementation and use of a specific value to call the dialog box.

void CommandLine_CommandExecute(string commandname, bool isDefaultImplemented, ref bool success)
{
      if (string.Compare(commandname, "bhatch", true) == 0)
      {
          vdDocument doc = vdFramedControl1.BaseControl.ActiveDocument;

          //Set some initial values for the dialog , This can be global to an application so these values can be changed. 
          //You can call the following dialog with a different constructor (with vdHatchproperties) in order to set these values in a global properties application dialog that you may have.
          vdHatchProperties SetBhatchInitialValues = new vdHatchProperties();
          SetBhatchInitialValues.FillMode = VectorDraw.Professional.Constants.VdConstFill.VdFillModeHatchBlock;
          SetBhatchInitialValues.FillColor.ColorIndex = 0;

          //Keep in a variable the current ActiveHatchProperties
          vdHatchProperties KeepActiveHatch = new vdHatchProperties();
          KeepActiveHatch.CopyFrom(doc.ActiveHatchProperties);

          //Set the ActiveHatchProperties to the above value
          doc.ActiveHatchProperties.CopyFrom(SetBhatchInitialValues);

          //Call the dialog.
          vdFigure ret = VectorDraw.Professional.Dialogs.frmGetHatchDialog.Show(null,doc, doc.ActionControl);

          //Return ActiveHatchProperties values as it was before the dialog.
          doc.ActiveHatchProperties.CopyFrom (KeepActiveHatch);
          success = true;
          return;
      }
}

    For more questions and answers, if you have any doubts can post in the comments section, we will respond promptly. This series of questions and answers tutorials we will continue to update, if you are interested, you can a lot of attention this tutorial


Guess you like

Origin blog.51cto.com/14477114/2446301