OTSRibbonFun.cs 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. using OTSIncAReportApp.OTSSampleReportInfo;
  2. namespace OTSIncAReportApp.OTSRibbon
  3. {
  4. /// <summary>
  5. /// 报告菜单相关操作类
  6. /// </summary>
  7. public class OTSRibbonFun
  8. {
  9. #region 变量定义
  10. frmReportApp m_ReportApp = null;
  11. #endregion
  12. #region 构造函数
  13. public OTSRibbonFun(frmReportApp ReportApp)
  14. {
  15. m_ReportApp = ReportApp;
  16. }
  17. #endregion
  18. #region 相关功能方法封装
  19. /// <summary>
  20. /// 设置Ribbon按钮的可用/不可用。
  21. /// </summary>
  22. /// <param name="bRibState">bRibStstu=True: 可用; bRibStstu=False: 不可用 </param>
  23. public void SetAllRibbonButnStatu(bool bRibState)
  24. {
  25. //下拉菜单中
  26. m_ReportApp.dpbOpen.Enabled = true; //打开,下拉菜单中
  27. m_ReportApp.dpbExport.Enabled = bRibState; //输出,下拉菜单中
  28. m_ReportApp.dpbCopy.Enabled = bRibState; //复制,下拉菜单中
  29. m_ReportApp.dpbCopyAll.Enabled = bRibState; //复制全部,下拉菜单中
  30. //Ribbon菜单中
  31. m_ReportApp.rbOpen.Enabled = true; //打开,ribbon中
  32. m_ReportApp.rbAllImage.Enabled = bRibState; //全图匹配,ribbon中
  33. m_ReportApp.rbWidthImage.Enabled = bRibState; //宽度匹配,ribbon中
  34. m_ReportApp.rbReverseSelection.Enabled = bRibState; //反选,ribbon中
  35. m_ReportApp.rbCircular.Enabled = bRibState; //圆形,ribbon中
  36. m_ReportApp.rbRectangle.Enabled = bRibState; //矩形,ribbon中
  37. m_ReportApp.rbCancel.Enabled = bRibState; //取消选择,ribbon中
  38. m_ReportApp.rbFrame.Enabled = bRibState; //帧图边框,ribbon中
  39. m_ReportApp.rbStaff.Enabled = bRibState; //标尺,ribbon中
  40. m_ReportApp.rbRenew.Enabled = bRibState; //恢复,ribbon中
  41. }
  42. /// <summary>
  43. /// 根据当前在不同的功能模块,设置不同的菜单状态
  44. /// </summary>
  45. /// <param name="str_moudle">传入的当前功能模块名</param>
  46. public void SetRibbonButnStatu_ByModule(DisplayPicutureType in_enum_displaypicturetype)
  47. {
  48. if (in_enum_displaypicturetype == DisplayPicutureType.AnalyzeImg)
  49. {
  50. m_ReportApp.rbSelTool.Enabled = true;//显示图匹配
  51. m_ReportApp.rbChoiceTools.Enabled = true;//选择工具
  52. m_ReportApp.ribbonPanel2.Enabled = true;//图形工具
  53. //(主菜单)下拉菜单中的 新建,打开,保存,另存为,输出
  54. m_ReportApp.dpbOpen.Enabled = true;
  55. m_ReportApp.dpbExport.Enabled = true;
  56. //主菜单文件框里(保存、另存为、输出、新建)设置
  57. m_ReportApp.rbSave.Enabled = true;
  58. m_ReportApp.rbSaveAs.Enabled = true;
  59. m_ReportApp.rbOut.Enabled = true;
  60. m_ReportApp.ribbonButton2.Enabled = true;
  61. //设置打开按钮
  62. m_ReportApp.dpbOpen.Enabled = true;
  63. m_ReportApp.rbOpen.Enabled = true;
  64. //设置菜单中复制和复制全部不可用,取消删除和重做删除可用
  65. m_ReportApp.dpbCopy.Enabled = false;//复制
  66. m_ReportApp.dpbCopyAll.Enabled = false;//复制全部
  67. }
  68. else if (in_enum_displaypicturetype == DisplayPicutureType.AnalyzeDataTable)
  69. {
  70. m_ReportApp.rbSelTool.Enabled = false;//显示图匹配
  71. m_ReportApp.rbChoiceTools.Enabled = false;//选择工具
  72. m_ReportApp.ribbonPanel2.Enabled = false;//图形工具
  73. //(主菜单)下拉菜单中的 新建,打开,保存,另存为,输出
  74. m_ReportApp.dpbOpen.Enabled = true;
  75. m_ReportApp.dpbExport.Enabled = true;
  76. //主菜单文件框里(保存、另存为、输出、新建)设置
  77. m_ReportApp.rbSave.Enabled = true;
  78. m_ReportApp.rbSaveAs.Enabled = true;
  79. m_ReportApp.rbOut.Enabled = true;
  80. m_ReportApp.ribbonButton2.Enabled = true;
  81. //设置打开按钮
  82. m_ReportApp.dpbOpen.Enabled = true;
  83. m_ReportApp.rbOpen.Enabled = true;
  84. //设置菜单中复制和复制全部可用,取消删除和重做删除不可用
  85. m_ReportApp.dpbCopy.Enabled = true;//复制
  86. m_ReportApp.dpbCopyAll.Enabled = true;//复制全部
  87. }
  88. else if (in_enum_displaypicturetype == DisplayPicutureType.AnalyzeDataChart)
  89. {
  90. m_ReportApp.rbSelTool.Enabled = false;//显示图匹配
  91. m_ReportApp.rbChoiceTools.Enabled = false;//选择工具
  92. m_ReportApp.ribbonPanel2.Enabled = false;//图形工具
  93. //(主菜单)下拉菜单中的 新建,打开,保存,另存为,输出
  94. m_ReportApp.dpbOpen.Enabled = true;
  95. m_ReportApp.dpbExport.Enabled = true;
  96. //主菜单文件框里(保存、另存为、输出、新建)设置
  97. m_ReportApp.rbSave.Enabled = true;
  98. m_ReportApp.rbSaveAs.Enabled = true;
  99. m_ReportApp.rbOut.Enabled = true;
  100. m_ReportApp.ribbonButton2.Enabled = true;
  101. //设置打开按钮
  102. m_ReportApp.dpbOpen.Enabled = true;
  103. m_ReportApp.rbOpen.Enabled = true;
  104. //设置菜单中复制和复制全部可用,取消删除和重做删除不可用
  105. m_ReportApp.dpbCopy.Enabled = true;//复制
  106. m_ReportApp.dpbCopyAll.Enabled = true;//复制全部
  107. }
  108. }
  109. #endregion
  110. }
  111. }