VectorDraw常見問題整理:如何初始化具有特定值的bhatch對話框?

VectorDraw Developer Framework(VDF)是一個用於應用程序可視化的圖形引擎庫。有了VDF提供的功能,您可以輕鬆地創建、編輯、管理、輸出、輸入和打印2D和3D圖形文件。   


問:

   如果想初始化具有特定值的bhatch對話框或保留對話框以前的值,應該怎麼做?

答:

    請檢查下面的代碼,演示如何覆蓋默認的bHatch命令實現並使用特定值調用對話框。

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;
      }
}

    對於以上問答,如果您有任何的疑惑都可以在評論區留言,我們會及時回覆。此係列的問答教程我們會持續更新,如果您感興趣,可以多多關注本教程


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章