PanelBottom.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. using Resources;
  2. using SmartCoalApplication.Base;
  3. using SmartCoalApplication.SystemLayer;
  4. using System;
  5. using System.Drawing;
  6. using System.Drawing.Drawing2D;
  7. using System.Windows.Forms;
  8. namespace SmartCoalApplication.Core.CustomControl
  9. {
  10. /// <summary>
  11. /// 画板底部的快捷栏
  12. /// 非公共,每个DocumentWorkspace自己保持自己的
  13. /// </summary>
  14. public class PanelBottom : ScrollPanel
  15. {
  16. ///// <summary>
  17. ///// 最佳
  18. ///// </summary>
  19. //public MyFlatButton bestButton;
  20. ///// <summary>
  21. ///// 最大最小
  22. ///// </summary>
  23. //public MyFlatButton maxMinButton;
  24. ///// <summary>
  25. ///// 原始状态
  26. ///// </summary>
  27. //public MyFlatButton originButton;
  28. ///// <summary>
  29. ///// 伽马0.45
  30. ///// </summary>
  31. //public MyFlatButton gamma45Button;
  32. ///// <summary>
  33. ///// 网格
  34. ///// </summary>
  35. //public MyFlatButton gridButton;
  36. ///// <summary>
  37. ///// 辅助线
  38. ///// </summary>
  39. //public MyFlatButton auxiliaryLineButton;
  40. ///// <summary>
  41. ///// 水平镜像
  42. ///// </summary>
  43. //public MyFlatButton horizontalMirroringButton;
  44. ///// <summary>
  45. ///// 垂直镜像
  46. ///// </summary>
  47. //public MyFlatButton verticalMirrorButton;
  48. ///// <summary>
  49. ///// 中心镜像
  50. ///// </summary>
  51. //public MyFlatButton centerMirrorButton;
  52. ///// <summary>
  53. ///// 移动模式
  54. ///// </summary>
  55. //public MyFlatButton mobileModeButton;
  56. ///// <summary>
  57. ///// 指针模式
  58. ///// </summary>
  59. //public MyFlatButton cursorModeButton;
  60. ///// <summary>
  61. ///// 实际大小
  62. ///// </summary>
  63. //public MyFlatButton actualSizeButton;
  64. ///// <summary>
  65. ///// 合适大小
  66. ///// </summary>
  67. //public MyFlatButton zoomToWindowButton;
  68. ///// <summary>
  69. ///// 定倍显示
  70. ///// </summary>
  71. //public MyFlatButton fixedTimesButton;
  72. ///// <summary>
  73. ///// 锁定扩缩
  74. ///// </summary>
  75. //public MyFlatButton lockdownButton;
  76. /// <summary>
  77. /// 缩小按钮
  78. /// </summary>
  79. public MyFlatButton zoomOutButton;
  80. /// <summary>
  81. /// 放大按钮
  82. /// </summary>
  83. public MyFlatButton zoomInButton;
  84. /// <summary>
  85. /// 放大缩小的TrackBar
  86. /// </summary>
  87. public TrackBar trackBar;
  88. /// <summary>
  89. /// 放大缩小的百分比
  90. /// </summary>
  91. public TextBox textBox;
  92. /// <summary>
  93. /// 另一个百分比,可能是比原始图片的倍数
  94. /// </summary>
  95. public TextBox textBox1;
  96. /// <summary>
  97. /// 透明度的TrackBar
  98. /// </summary>
  99. //public TrackBar transparencyTrackBar;
  100. /// <summary>
  101. /// hint 提示信息
  102. /// </summary>
  103. public ToolTip toolTip;
  104. /// <summary>
  105. /// 位置
  106. /// </summary>
  107. public int locationX = 5;
  108. /// <summary>
  109. /// 左侧快捷工具的容器
  110. /// </summary>
  111. private Panel panelLeft;
  112. /// <summary>
  113. /// 目前被改成tab的菜单了
  114. /// </summary>
  115. public PanelBottomRight documentStrip;
  116. public PanelBottom()
  117. {
  118. InitializeComponent();
  119. InitInternalControl();
  120. this.documentStrip = new PanelBottomRight();
  121. //
  122. // documentStrip
  123. //
  124. ////设置多图/多相模式,true为显示多图
  125. //this.documentStrip.ShowPictures = true;
  126. ////设置单选模式
  127. //this.documentStrip.documentStrip.AllowMultiChoise = false;
  128. this.documentStrip.AutoSize = false;
  129. this.documentStrip.Name = "PanelBottomRight";
  130. this.documentStrip.TabIndex = 5;
  131. this.documentStrip.Location = new Point(0, 0);
  132. this.documentStrip.Size = new Size(400, 20);
  133. this.documentStrip.Dock = DockStyle.Right;
  134. this.Controls.Add(this.documentStrip);
  135. }
  136. /// <summary>
  137. /// 缩小按钮
  138. /// </summary>
  139. /// <param name="sender"></param>
  140. /// <param name="e"></param>
  141. private void onMouseMoveZoomOut(object sender, MouseEventArgs e)
  142. {
  143. //this.Focus();
  144. if (!this.zoomOutButton.selected)
  145. {
  146. this.zoomOutButton.BackColor = Color.FromArgb(181, 215, 243);
  147. this.zoomOutButton.FlatAppearance.BorderSize = 1;
  148. this.zoomOutButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
  149. }
  150. }
  151. /// <summary>
  152. /// 缩小按钮
  153. /// </summary>
  154. /// <param name="sender"></param>
  155. /// <param name="e"></param>
  156. private void onMouseLeaveZoomOut(object sender, EventArgs e)
  157. {
  158. //this.Focus();
  159. if (!this.zoomOutButton.selected)
  160. {
  161. this.zoomOutButton.BackColor = Color.FromArgb(0, 0, 0, 0);
  162. this.zoomOutButton.FlatAppearance.BorderSize = 0;
  163. this.zoomOutButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
  164. }
  165. }
  166. /// <summary>
  167. /// 放大按钮
  168. /// </summary>
  169. /// <param name="sender"></param>
  170. /// <param name="e"></param>
  171. private void onMouseMoveZoomIn(object sender, MouseEventArgs e)
  172. {
  173. //this.Focus();
  174. if (!this.zoomInButton.selected)
  175. {
  176. this.zoomInButton.BackColor = Color.FromArgb(181, 215, 243);
  177. this.zoomInButton.FlatAppearance.BorderSize = 1;
  178. this.zoomInButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
  179. }
  180. }
  181. /// <summary>
  182. /// 放大按钮
  183. /// </summary>
  184. /// <param name="sender"></param>
  185. /// <param name="e"></param>
  186. private void onMouseLeaveZoomIn(object sender, EventArgs e)
  187. {
  188. //this.Focus();
  189. if (!this.zoomInButton.selected)
  190. {
  191. this.zoomInButton.BackColor = Color.FromArgb(0, 0, 0, 0);
  192. this.zoomInButton.FlatAppearance.BorderSize = 0;
  193. this.zoomInButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
  194. }
  195. }
  196. /// <summary>
  197. /// 给DocumentView的事件,用于相的选中和取消
  198. /// </summary>
  199. public event EventHandler<EventArgs<int>> ItemICheckChanged;
  200. private void OnItemICheckChanged(int index)
  201. {
  202. if (ItemICheckChanged != null)
  203. {
  204. ItemICheckChanged(this, new EventArgs<int>(index));
  205. }
  206. }
  207. private void ItemCheckChanged(object sender, EventArgs<int> e)
  208. {
  209. OnItemICheckChanged(e.Data);
  210. }
  211. /// <summary>
  212. /// 创建内部组件
  213. /// </summary>
  214. private void InitInternalControl()
  215. {
  216. //
  217. // 设置Panel属性
  218. //
  219. this.Cursor = Cursors.Default;
  220. //
  221. // 左侧panel属性
  222. //
  223. this.panelLeft = new Panel();
  224. this.panelLeft.Dock = DockStyle.Left;
  225. this.panelLeft.AutoSize = true;
  226. //
  227. // 缩小按钮
  228. //
  229. this.locationX += 30;
  230. this.zoomOutButton = new MyFlatButton();
  231. this.zoomOutButton.Location = new Point(locationX, 5);
  232. this.zoomOutButton.Size = new Size(20, 20);
  233. this.zoomOutButton.Image = PdnResources.GetImageResource("Icons.MenuViewZoomOutIcon.png").Reference;
  234. this.zoomOutButton.FlatStyle = FlatStyle.Flat;
  235. this.zoomOutButton.FlatAppearance.BorderSize = 0;
  236. this.zoomOutButton.MouseMove += new MouseEventHandler(onMouseMoveZoomOut);
  237. this.zoomOutButton.MouseLeave += new EventHandler(onMouseLeaveZoomOut);
  238. //
  239. // 放大按钮
  240. //
  241. this.locationX += 30;
  242. this.zoomInButton = new MyFlatButton();
  243. this.zoomInButton.Location = new Point(locationX, 5);
  244. this.zoomInButton.Size = new Size(20, 20);
  245. this.zoomInButton.Image = PdnResources.GetImageResource("Icons.MenuViewZoomInIcon.png").Reference;
  246. this.zoomInButton.FlatStyle = FlatStyle.Flat;
  247. this.zoomInButton.FlatAppearance.BorderSize = 0;
  248. this.zoomInButton.MouseMove += new MouseEventHandler(onMouseMoveZoomIn);
  249. this.zoomInButton.MouseLeave += new EventHandler(onMouseLeaveZoomIn);
  250. //
  251. // 放大缩小的TrackBar
  252. //
  253. this.locationX += 30;
  254. this.trackBar = new TrackBar();
  255. this.trackBar.AutoSize = false;
  256. this.trackBar.Minimum = 1;
  257. this.trackBar.Name = "amountTrackBar";
  258. this.trackBar.Location = new Point(locationX, 5);
  259. this.trackBar.Size = new Size(175, 20);
  260. this.trackBar.SmallChange = 1;
  261. this.trackBar.TickStyle = TickStyle.None;
  262. //this.trackBar.Value = 100;
  263. //
  264. // 放大缩小的百分比
  265. //
  266. this.locationX += 175;
  267. this.textBox = new TextBox();
  268. this.textBox.Size = new Size(40, 20);
  269. this.textBox.Location = new Point(locationX, 5);
  270. //
  271. // 另一个百分比,可能是定倍的倍数?
  272. //
  273. this.locationX += 40 + 5;
  274. this.textBox1 = new TextBox();
  275. this.textBox1.Size = new Size(40, 20);
  276. this.textBox1.Location = new Point(locationX, 5);
  277. this.locationX += 40;
  278. //this.transparencyTrackBar = new TrackBar();
  279. //this.transparencyTrackBar.AutoSize = false;
  280. //this.transparencyTrackBar.Minimum = 0;
  281. //this.transparencyTrackBar.Maximum = 255;
  282. //this.transparencyTrackBar.Name = "transparencyTrackBar";
  283. //this.transparencyTrackBar.Location = new Point(locationX, 5);
  284. //this.transparencyTrackBar.Size = new Size(175, 20);
  285. //this.transparencyTrackBar.SmallChange = 1;
  286. //this.transparencyTrackBar.TickStyle = TickStyle.None;
  287. this.locationX += 40;// + 5 + 5;
  288. //
  289. // 提示信息
  290. //
  291. this.toolTip = new ToolTip();
  292. this.toolTip.SetToolTip(this.zoomOutButton, PdnResources.GetString("CommonAction.ZoomOut"));
  293. this.toolTip.SetToolTip(this.zoomInButton, PdnResources.GetString("CommonAction.ZoomIn"));
  294. this.toolTip.ShowAlways = true;
  295. this.panelLeft.Controls.Add(this.zoomOutButton);
  296. this.panelLeft.Controls.Add(this.zoomInButton);
  297. this.panelLeft.Controls.Add(this.trackBar);
  298. this.panelLeft.Controls.Add(this.textBox);
  299. //this.panelLeft.Controls.Add(this.textBox1);
  300. //this.panelLeft.Controls.Add(this.transparencyTrackBar);
  301. this.Controls.Add(this.panelLeft);
  302. }
  303. #region 设计器
  304. /// <summary>
  305. /// 必需的设计器变量。
  306. /// </summary>
  307. private System.ComponentModel.IContainer components = null;
  308. /// <summary>
  309. /// 清理所有正在使用的资源。
  310. /// </summary>
  311. /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
  312. protected override void Dispose(bool disposing)
  313. {
  314. if (disposing && (components != null))
  315. {
  316. components.Dispose();
  317. }
  318. base.Dispose(disposing);
  319. }
  320. #region 组件设计器生成的代码
  321. /// <summary>
  322. /// 设计器支持所需的方法 - 不要修改
  323. /// 使用代码编辑器修改此方法的内容。
  324. /// </summary>
  325. private void InitializeComponent()
  326. {
  327. components = new System.ComponentModel.Container();
  328. }
  329. #endregion
  330. #endregion
  331. }
  332. }