GeneralAnalysisCommonControlButtons.cs 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. using Resources;
  2. using SmartCoalApplication.SystemLayer;
  3. using System;
  4. using System.Drawing;
  5. using System.Drawing.Drawing2D;
  6. using System.Windows.Forms;
  7. namespace SmartCoalApplication.Core.CustomControl
  8. {
  9. /// <summary>
  10. /// 公共的快捷栏
  11. /// 给各个弹窗用
  12. /// </summary>
  13. public class GeneralAnalysisCommonControlButtons : ScrollPanel
  14. {
  15. /// <summary>
  16. /// 放大按钮
  17. /// </summary>
  18. public Button zoomInButton;
  19. /// <summary>
  20. /// 缩小按钮
  21. /// </summary>
  22. public Button zoomOutButton;
  23. /// <summary>
  24. /// 合适大小
  25. /// </summary>
  26. public Button zoomToWindowButton;
  27. /// <summary>
  28. /// 实际大小
  29. /// </summary>
  30. public Button actualSizeButton;
  31. /// <summary>
  32. /// 指针模式
  33. /// </summary>
  34. public Button pointerButton;
  35. /// <summary>
  36. /// 移动模式
  37. /// </summary>
  38. public Button mobileModeButton;
  39. /// <summary>
  40. /// 透明度的TrackBar
  41. /// </summary>
  42. public TrackBar trackBar;
  43. public Label trackLabel;
  44. /// <summary>
  45. /// 透明度的数值
  46. /// </summary>
  47. public TextBox textBox;
  48. public Label demoLabel;
  49. /// <summary>
  50. /// 位置
  51. /// </summary>
  52. public int locationX = 5;
  53. /// <summary>
  54. /// 左侧快捷工具的容器
  55. /// </summary>
  56. private Panel panelLeft;
  57. /// <summary>
  58. /// hint 提示信息
  59. /// </summary>
  60. public ToolTip toolTip;
  61. public GeneralAnalysisCommonControlButtons()
  62. {
  63. InitializeComponent();
  64. InitInternalControl();
  65. }
  66. /// <summary>
  67. /// 创建内部组件
  68. /// </summary>
  69. private void InitInternalControl()
  70. {
  71. //
  72. // 设置Panel属性
  73. //
  74. this.Cursor = Cursors.Default;
  75. //
  76. // 左侧panel属性
  77. //
  78. this.panelLeft = new Panel();
  79. this.panelLeft.Dock = DockStyle.Left;
  80. this.panelLeft.AutoSize = true;
  81. //
  82. // 放大按钮
  83. //
  84. this.zoomInButton = new Button();
  85. this.zoomInButton.Location = new Point(locationX, 5);
  86. this.zoomInButton.Size = new Size(20, 20);
  87. this.zoomInButton.Image = PdnResources.GetImageResource("Icons.MenuViewZoomInIcon.png").Reference;
  88. this.zoomInButton.FlatStyle = FlatStyle.Flat;
  89. this.zoomInButton.FlatAppearance.BorderSize = 0;
  90. //
  91. // 缩小按钮
  92. //
  93. this.locationX += 20;
  94. this.zoomOutButton = new Button();
  95. this.zoomOutButton.Location = new Point(locationX, 5);
  96. this.zoomOutButton.Size = new Size(20, 20);
  97. this.zoomOutButton.Image = PdnResources.GetImageResource("Icons.MenuViewZoomOutIcon.png").Reference;
  98. this.zoomOutButton.FlatStyle = FlatStyle.Flat;
  99. this.zoomOutButton.FlatAppearance.BorderSize = 0;
  100. //
  101. // 合适大小
  102. //
  103. this.locationX += 20;
  104. this.zoomToWindowButton = new Button();
  105. this.zoomToWindowButton.Location = new Point(locationX, 5);
  106. this.zoomToWindowButton.Size = new Size(20, 20);
  107. this.zoomToWindowButton.Image = PdnResources.GetImageResource("Icons.MenuViewZoomToWindowIcon.png").Reference;
  108. this.zoomToWindowButton.FlatStyle = FlatStyle.Flat;
  109. this.zoomToWindowButton.FlatAppearance.BorderSize = 0;
  110. //
  111. // 实际大小
  112. //
  113. this.locationX += 20;
  114. this.actualSizeButton = new Button();
  115. this.actualSizeButton.Location = new Point(locationX, 5);
  116. this.actualSizeButton.Size = new Size(20, 20);
  117. this.actualSizeButton.Image = PdnResources.GetImageResource("Icons.MenuViewActualSizeIcon.png").Reference;
  118. this.actualSizeButton.FlatStyle = FlatStyle.Flat;
  119. this.actualSizeButton.FlatAppearance.BorderSize = 0;
  120. //
  121. // 指针模式
  122. //
  123. this.locationX += 20;
  124. this.pointerButton = new Button();
  125. this.pointerButton.Location = new Point(locationX, 5);
  126. this.pointerButton.Size = new Size(20, 20);
  127. this.pointerButton.Image = PdnResources.GetImageResource("Icons.MoveSelectionToolIcon.png").Reference;
  128. this.pointerButton.FlatStyle = FlatStyle.Flat;
  129. this.pointerButton.FlatAppearance.BorderSize = 0;
  130. //
  131. // 移动模式
  132. //
  133. this.locationX += 20;
  134. this.mobileModeButton = new Button();
  135. this.mobileModeButton.Location = new Point(locationX, 5);
  136. this.mobileModeButton.Size = new Size(20, 20);
  137. this.mobileModeButton.Image = PdnResources.GetImageResource("Icons.PanToolIcon.png").Reference;
  138. this.mobileModeButton.FlatStyle = FlatStyle.Flat;
  139. this.mobileModeButton.FlatAppearance.BorderSize = 0;
  140. //
  141. // 放大缩小的TrackBar
  142. //
  143. this.locationX += 20;
  144. this.trackLabel = new Label();
  145. this.trackLabel.Location = new Point(locationX, 5);
  146. this.trackLabel.Size = new Size(80, 20);
  147. this.trackLabel.Visible = false;
  148. this.locationX += 80;
  149. this.trackBar = new TrackBar();
  150. this.trackBar.AutoSize = false;
  151. this.trackBar.Minimum = 1;
  152. this.trackBar.Name = "amountTrackBar";
  153. this.trackBar.Location = new Point(locationX, 5);
  154. this.trackBar.Size = new Size(175, 20);
  155. this.trackBar.SmallChange = 1;
  156. this.trackBar.TickStyle = TickStyle.None;
  157. this.trackBar.Visible = false;
  158. //
  159. // 放大缩小的百分比
  160. //
  161. this.locationX += 175;
  162. this.textBox = new TextBox();
  163. this.textBox.Size = new Size(40, 20);
  164. this.textBox.Location = new Point(locationX, 5);
  165. this.textBox.Visible = false;
  166. //
  167. // 提示信息
  168. //
  169. this.toolTip = new ToolTip();
  170. this.toolTip.SetToolTip(this.zoomInButton, PdnResources.GetString("Menu.Edit.ZoomIn.Text"));
  171. this.toolTip.SetToolTip(this.zoomOutButton, PdnResources.GetString("CommonAction.ZoomOut"));
  172. this.toolTip.SetToolTip(this.zoomToWindowButton, PdnResources.GetString("Menu.Edit.ZoomToWindow.Text"));
  173. this.toolTip.SetToolTip(this.actualSizeButton, PdnResources.GetString("Menu.Edit.ActualSize.Text"));
  174. this.toolTip.SetToolTip(this.pointerButton, PdnResources.GetString("Menu.Pointertothemodel.text"));
  175. this.toolTip.SetToolTip(this.mobileModeButton, PdnResources.GetString("Menu.Mobilemodel.text"));
  176. this.panelLeft.Controls.Add(this.zoomInButton);
  177. this.panelLeft.Controls.Add(this.zoomOutButton);
  178. this.panelLeft.Controls.Add(this.zoomToWindowButton);
  179. this.panelLeft.Controls.Add(this.actualSizeButton);
  180. this.panelLeft.Controls.Add(this.pointerButton);
  181. this.panelLeft.Controls.Add(this.mobileModeButton);
  182. this.panelLeft.Controls.Add(this.trackLabel);
  183. this.panelLeft.Controls.Add(this.trackBar);
  184. this.panelLeft.Controls.Add(this.textBox);
  185. this.Controls.Add(this.panelLeft);
  186. }
  187. public void HideZoomToWindowAndActualSize()
  188. {
  189. this.zoomToWindowButton.Visible = false;
  190. this.actualSizeButton.Visible = false;
  191. this.pointerButton.Location = new Point(this.pointerButton.Location.X - 40, this.pointerButton.Location.Y);
  192. this.mobileModeButton.Location = new Point(this.mobileModeButton.Location.X - 40, this.mobileModeButton.Location.Y);
  193. }
  194. public void WithTrackBar()
  195. {
  196. this.zoomToWindowButton.Visible = false;
  197. this.actualSizeButton.Visible = false;
  198. this.trackBar.Visible = true;
  199. this.pointerButton.Location = new Point(this.pointerButton.Location.X - 40, this.pointerButton.Location.Y);
  200. this.mobileModeButton.Location = new Point(this.mobileModeButton.Location.X - 40, this.mobileModeButton.Location.Y);
  201. this.trackLabel.Visible = true;
  202. }
  203. #region 设计器
  204. /// <summary>
  205. /// 必需的设计器变量。
  206. /// </summary>
  207. private System.ComponentModel.IContainer components = null;
  208. /// <summary>
  209. /// 清理所有正在使用的资源。
  210. /// </summary>
  211. /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
  212. protected override void Dispose(bool disposing)
  213. {
  214. if (disposing && (components != null))
  215. {
  216. components.Dispose();
  217. }
  218. base.Dispose(disposing);
  219. }
  220. #region 组件设计器生成的代码
  221. /// <summary>
  222. /// 设计器支持所需的方法 - 不要修改
  223. /// 使用代码编辑器修改此方法的内容。
  224. /// </summary>
  225. private void InitializeComponent()
  226. {
  227. components = new System.ComponentModel.Container();
  228. }
  229. #endregion
  230. #endregion
  231. }
  232. }