PanelBottom.cs 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009
  1. using PaintDotNet.SystemLayer;
  2. using System;
  3. using System.Drawing;
  4. using System.Drawing.Drawing2D;
  5. using System.Windows.Forms;
  6. namespace PaintDotNet.CustomControl
  7. {
  8. /// <summary>
  9. /// 画板底部的快捷栏
  10. /// 非公共,每个DocumentWorkspace自己保持自己的
  11. /// </summary>
  12. public class PanelBottom : ScrollPanel
  13. {
  14. /// <summary>
  15. /// 最佳
  16. /// </summary>
  17. public MyFlatButton bestButton;
  18. /// <summary>
  19. /// 最大最小
  20. /// </summary>
  21. public MyFlatButton maxMinButton;
  22. /// <summary>
  23. /// 原始状态
  24. /// </summary>
  25. public MyFlatButton originButton;
  26. /// <summary>
  27. /// 伽马0.45
  28. /// </summary>
  29. public MyFlatButton gamma45Button;
  30. /// <summary>
  31. /// 网格
  32. /// </summary>
  33. public MyFlatButton gridButton;
  34. /// <summary>
  35. /// 辅助线
  36. /// </summary>
  37. public MyFlatButton auxiliaryLineButton;
  38. /// <summary>
  39. /// 水平镜像
  40. /// </summary>
  41. public MyFlatButton horizontalMirroringButton;
  42. /// <summary>
  43. /// 垂直镜像
  44. /// </summary>
  45. public MyFlatButton verticalMirrorButton;
  46. /// <summary>
  47. /// 中心镜像
  48. /// </summary>
  49. public MyFlatButton centerMirrorButton;
  50. /// <summary>
  51. /// 移动模式
  52. /// </summary>
  53. public MyFlatButton mobileModeButton;
  54. /// <summary>
  55. /// 指针模式
  56. /// </summary>
  57. public MyFlatButton cursorModeButton;
  58. /// <summary>
  59. /// 实际大小
  60. /// </summary>
  61. public MyFlatButton actualSizeButton;
  62. /// <summary>
  63. /// 合适大小
  64. /// </summary>
  65. public MyFlatButton zoomToWindowButton;
  66. /// <summary>
  67. /// 定倍显示
  68. /// </summary>
  69. public MyFlatButton fixedTimesButton;
  70. /// <summary>
  71. /// 锁定扩缩
  72. /// </summary>
  73. public MyFlatButton lockdownButton;
  74. /// <summary>
  75. /// 缩小按钮
  76. /// </summary>
  77. public MyFlatButton zoomOutButton;
  78. /// <summary>
  79. /// 放大按钮
  80. /// </summary>
  81. public MyFlatButton zoomInButton;
  82. /// <summary>
  83. /// 放大缩小的TrackBar
  84. /// </summary>
  85. public TrackBar trackBar;
  86. /// <summary>
  87. /// 放大缩小的百分比
  88. /// </summary>
  89. public TextBox textBox;
  90. /// <summary>
  91. /// 另一个百分比,可能是比原始图片的倍数
  92. /// </summary>
  93. public TextBox textBox1;
  94. /// <summary>
  95. /// 透明度的TrackBar
  96. /// </summary>
  97. //public TrackBar transparencyTrackBar;
  98. /// <summary>
  99. /// hint 提示信息
  100. /// </summary>
  101. public ToolTip toolTip;
  102. /// <summary>
  103. /// 位置
  104. /// </summary>
  105. public int locationX = 5;
  106. /// <summary>
  107. /// 左侧快捷工具的容器
  108. /// </summary>
  109. private Panel panelLeft;
  110. /// <summary>
  111. /// 目前被改成tab的菜单了
  112. /// </summary>
  113. public PanelBottomRight documentStrip;
  114. public PanelBottom()
  115. {
  116. InitializeComponent();
  117. InitInternalControl();
  118. this.documentStrip = new PanelBottomRight();
  119. //
  120. // documentStrip
  121. //
  122. ////设置多图/多相模式,true为显示多图
  123. //this.documentStrip.ShowPictures = true;
  124. ////设置单选模式
  125. //this.documentStrip.documentStrip.AllowMultiChoise = false;
  126. this.documentStrip.AutoSize = false;
  127. this.documentStrip.Name = "PanelBottomRight";
  128. this.documentStrip.TabIndex = 5;
  129. this.documentStrip.Location = new Point(0, 0);
  130. this.documentStrip.Size = new Size(400, 20);
  131. this.documentStrip.Dock = DockStyle.Right;
  132. this.documentStrip.ItemCheckChanged += new EventHandler<EventArgs<int>>(this.ItemCheckChanged);
  133. this.Controls.Add(this.documentStrip);
  134. }
  135. /// <summary>
  136. /// 最佳
  137. /// </summary>
  138. /// <param name="sender"></param>
  139. /// <param name="e"></param>
  140. private void onMouseMoveBest(object sender, MouseEventArgs e)
  141. {
  142. //this.Focus();
  143. if (!this.bestButton.selected)
  144. {
  145. this.bestButton.BackColor = Color.FromArgb(181, 215, 243);
  146. this.bestButton.FlatAppearance.BorderSize = 1;
  147. this.bestButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
  148. }
  149. }
  150. /// <summary>
  151. /// 最佳
  152. /// </summary>
  153. /// <param name="sender"></param>
  154. /// <param name="e"></param>
  155. private void onMouseLeaveBest(object sender, EventArgs e)
  156. {
  157. //this.Focus();
  158. if (!this.bestButton.selected)
  159. {
  160. this.bestButton.BackColor = Color.FromArgb(0, 0, 0, 0);
  161. this.bestButton.FlatAppearance.BorderSize = 0;
  162. this.bestButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
  163. }
  164. }
  165. /// <summary>
  166. /// 最大最小
  167. /// </summary>
  168. /// <param name="sender"></param>
  169. /// <param name="e"></param>
  170. private void onMouseMoveMaxMin(object sender, MouseEventArgs e)
  171. {
  172. //this.Focus();
  173. if (!this.maxMinButton.selected)
  174. {
  175. this.maxMinButton.BackColor = Color.FromArgb(181, 215, 243);
  176. this.maxMinButton.FlatAppearance.BorderSize = 1;
  177. this.maxMinButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
  178. }
  179. }
  180. /// <summary>
  181. /// 最大最小
  182. /// </summary>
  183. /// <param name="sender"></param>
  184. /// <param name="e"></param>
  185. private void onMouseLeaveMaxMin(object sender, EventArgs e)
  186. {
  187. //this.Focus();
  188. if (!this.maxMinButton.selected)
  189. {
  190. this.maxMinButton.BackColor = Color.FromArgb(0, 0, 0, 0);
  191. this.maxMinButton.FlatAppearance.BorderSize = 0;
  192. this.maxMinButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
  193. }
  194. }
  195. /// <summary>
  196. /// 原始状态
  197. /// </summary>
  198. /// <param name="sender"></param>
  199. /// <param name="e"></param>
  200. private void onMouseMoveOrigin(object sender, MouseEventArgs e)
  201. {
  202. //this.Focus();
  203. if (!this.originButton.selected)
  204. {
  205. this.originButton.BackColor = Color.FromArgb(181, 215, 243);
  206. this.originButton.FlatAppearance.BorderSize = 1;
  207. this.originButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
  208. }
  209. }
  210. /// <summary>
  211. /// 原始状态
  212. /// </summary>
  213. /// <param name="sender"></param>
  214. /// <param name="e"></param>
  215. private void onMouseLeaveOrigin(object sender, EventArgs e)
  216. {
  217. //this.Focus();
  218. if (!this.originButton.selected)
  219. {
  220. this.originButton.BackColor = Color.FromArgb(0, 0, 0, 0);
  221. this.originButton.FlatAppearance.BorderSize = 0;
  222. this.originButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
  223. }
  224. }
  225. /// <summary>
  226. /// 伽马0.45
  227. /// </summary>
  228. /// <param name="sender"></param>
  229. /// <param name="e"></param>
  230. private void onMouseMoveGamma45(object sender, MouseEventArgs e)
  231. {
  232. //this.Focus();
  233. if (!this.gamma45Button.selected)
  234. {
  235. this.gamma45Button.BackColor = Color.FromArgb(181, 215, 243);
  236. this.gamma45Button.FlatAppearance.BorderSize = 1;
  237. this.gamma45Button.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
  238. }
  239. }
  240. /// <summary>
  241. /// 伽马0.45
  242. /// </summary>
  243. /// <param name="sender"></param>
  244. /// <param name="e"></param>
  245. private void onMouseLeaveGamma45(object sender, EventArgs e)
  246. {
  247. //this.Focus();
  248. if (!this.gamma45Button.selected)
  249. {
  250. this.gamma45Button.BackColor = Color.FromArgb(0, 0, 0, 0);
  251. this.gamma45Button.FlatAppearance.BorderSize = 0;
  252. this.gamma45Button.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
  253. }
  254. }
  255. /// <summary>
  256. /// 网格
  257. /// </summary>
  258. /// <param name="sender"></param>
  259. /// <param name="e"></param>
  260. private void onMouseMoveGrid(object sender, MouseEventArgs e)
  261. {
  262. //this.Focus();
  263. if (!this.gridButton.selected)
  264. {
  265. this.gridButton.BackColor = Color.FromArgb(181, 215, 243);
  266. this.gridButton.FlatAppearance.BorderSize = 1;
  267. this.gridButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
  268. }
  269. if (this.gridButton.Focused)
  270. this.gridButton.FlatAppearance.BorderSize = 1;
  271. }
  272. /// <summary>
  273. /// 网格
  274. /// </summary>
  275. /// <param name="sender"></param>
  276. /// <param name="e"></param>
  277. private void onMouseLeaveGrid(object sender, EventArgs e)
  278. {
  279. //this.Focus();
  280. if (!this.gridButton.selected)
  281. {
  282. this.gridButton.BackColor = Color.FromArgb(0, 0, 0, 0);
  283. this.gridButton.FlatAppearance.BorderSize = 0;
  284. this.gridButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
  285. }
  286. }
  287. /// <summary>
  288. /// 辅助线
  289. /// </summary>
  290. /// <param name="sender"></param>
  291. /// <param name="e"></param>
  292. private void onMouseMoveAuxiliaryLine(object sender, MouseEventArgs e)
  293. {
  294. //this.Focus();
  295. if (!this.auxiliaryLineButton.selected)
  296. {
  297. this.auxiliaryLineButton.BackColor = Color.FromArgb(181, 215, 243);
  298. this.auxiliaryLineButton.FlatAppearance.BorderSize = 1;
  299. this.auxiliaryLineButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
  300. }
  301. }
  302. /// <summary>
  303. /// 辅助线
  304. /// </summary>
  305. /// <param name="sender"></param>
  306. /// <param name="e"></param>
  307. private void onMouseLeaveAuxiliaryLine(object sender, EventArgs e)
  308. {
  309. //this.Focus();
  310. if (!this.auxiliaryLineButton.selected)
  311. {
  312. this.auxiliaryLineButton.BackColor = Color.FromArgb(0, 0, 0, 0);
  313. this.auxiliaryLineButton.FlatAppearance.BorderSize = 0;
  314. this.auxiliaryLineButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
  315. }
  316. }
  317. /// <summary>
  318. /// 水平镜像
  319. /// </summary>
  320. /// <param name="sender"></param>
  321. /// <param name="e"></param>
  322. private void onMouseMoveHorizontalMirroring(object sender, MouseEventArgs e)
  323. {
  324. //this.Focus();
  325. if (!this.horizontalMirroringButton.selected)
  326. {
  327. this.horizontalMirroringButton.BackColor = Color.FromArgb(181, 215, 243);
  328. this.horizontalMirroringButton.FlatAppearance.BorderSize = 1;
  329. this.horizontalMirroringButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
  330. }
  331. }
  332. /// <summary>
  333. /// 水平镜像
  334. /// </summary>
  335. /// <param name="sender"></param>
  336. /// <param name="e"></param>
  337. private void onMouseLeaveHorizontalMirroring(object sender, EventArgs e)
  338. {
  339. //this.Focus();
  340. if (!this.horizontalMirroringButton.selected)
  341. {
  342. this.horizontalMirroringButton.BackColor = Color.FromArgb(0, 0, 0, 0);
  343. this.horizontalMirroringButton.FlatAppearance.BorderSize = 0;
  344. this.horizontalMirroringButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
  345. }
  346. }
  347. /// <summary>
  348. /// 垂直镜像
  349. /// </summary>
  350. /// <param name="sender"></param>
  351. /// <param name="e"></param>
  352. private void onMouseMoveVerticalMirror(object sender, MouseEventArgs e)
  353. {
  354. //this.Focus();
  355. if (!this.verticalMirrorButton.selected)
  356. {
  357. this.verticalMirrorButton.BackColor = Color.FromArgb(181, 215, 243);
  358. this.verticalMirrorButton.FlatAppearance.BorderSize = 1;
  359. this.verticalMirrorButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
  360. }
  361. }
  362. /// <summary>
  363. /// 垂直镜像
  364. /// </summary>
  365. /// <param name="sender"></param>
  366. /// <param name="e"></param>
  367. private void onMouseLeaveVerticalMirror(object sender, EventArgs e)
  368. {
  369. //this.Focus();
  370. if (!this.verticalMirrorButton.selected)
  371. {
  372. this.verticalMirrorButton.BackColor = Color.FromArgb(0, 0, 0, 0);
  373. this.verticalMirrorButton.FlatAppearance.BorderSize = 0;
  374. this.verticalMirrorButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
  375. }
  376. }
  377. /// <summary>
  378. /// 中心镜像
  379. /// </summary>
  380. /// <param name="sender"></param>
  381. /// <param name="e"></param>
  382. private void onMouseMoveCenterMirror(object sender, MouseEventArgs e)
  383. {
  384. //this.Focus();
  385. if (!this.centerMirrorButton.selected)
  386. {
  387. this.centerMirrorButton.BackColor = Color.FromArgb(181, 215, 243);
  388. this.centerMirrorButton.FlatAppearance.BorderSize = 1;
  389. this.centerMirrorButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
  390. }
  391. }
  392. /// <summary>
  393. /// 中心镜像
  394. /// </summary>
  395. /// <param name="sender"></param>
  396. /// <param name="e"></param>
  397. private void onMouseLeaveCenterMirror(object sender, EventArgs e)
  398. {
  399. //this.Focus();
  400. if (!this.centerMirrorButton.selected)
  401. {
  402. this.centerMirrorButton.BackColor = Color.FromArgb(0, 0, 0, 0);
  403. this.centerMirrorButton.FlatAppearance.BorderSize = 0;
  404. this.centerMirrorButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
  405. }
  406. }
  407. /// <summary>
  408. /// 移动模式
  409. /// </summary>
  410. /// <param name="sender"></param>
  411. /// <param name="e"></param>
  412. private void onMouseMoveMobileMode(object sender, MouseEventArgs e)
  413. {
  414. //this.Focus();
  415. if (!this.mobileModeButton.selected)
  416. {
  417. this.mobileModeButton.BackColor = Color.FromArgb(181, 215, 243);
  418. this.mobileModeButton.FlatAppearance.BorderSize = 1;
  419. this.mobileModeButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
  420. }
  421. }
  422. /// <summary>
  423. /// 移动模式
  424. /// </summary>
  425. /// <param name="sender"></param>
  426. /// <param name="e"></param>
  427. private void onMouseLeaveMobileMode(object sender, EventArgs e)
  428. {
  429. //this.Focus();
  430. if (!this.mobileModeButton.selected)
  431. {
  432. this.mobileModeButton.BackColor = Color.FromArgb(0, 0, 0, 0);
  433. this.mobileModeButton.FlatAppearance.BorderSize = 0;
  434. this.mobileModeButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
  435. }
  436. }
  437. /// <summary>
  438. /// 指针模式
  439. /// </summary>
  440. /// <param name="sender"></param>
  441. /// <param name="e"></param>
  442. private void onMouseMoveCursorMode(object sender, MouseEventArgs e)
  443. {
  444. //this.Focus();
  445. if (!this.cursorModeButton.selected)
  446. {
  447. this.cursorModeButton.BackColor = Color.FromArgb(181, 215, 243);
  448. this.cursorModeButton.FlatAppearance.BorderSize = 1;
  449. this.cursorModeButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
  450. }
  451. }
  452. /// <summary>
  453. /// 指针模式
  454. /// </summary>
  455. /// <param name="sender"></param>
  456. /// <param name="e"></param>
  457. private void onMouseLeaveCursorMode(object sender, EventArgs e)
  458. {
  459. //this.Focus();
  460. if (!this.cursorModeButton.selected)
  461. {
  462. this.cursorModeButton.BackColor = Color.FromArgb(0, 0, 0, 0);
  463. this.cursorModeButton.FlatAppearance.BorderSize = 0;
  464. this.cursorModeButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
  465. }
  466. }
  467. /// <summary>
  468. /// 实际大小
  469. /// </summary>
  470. /// <param name="sender"></param>
  471. /// <param name="e"></param>
  472. private void onMouseMoveActualSize(object sender, MouseEventArgs e)
  473. {
  474. //this.Focus();
  475. if (!this.actualSizeButton.selected)
  476. {
  477. this.actualSizeButton.BackColor = Color.FromArgb(181, 215, 243);
  478. this.actualSizeButton.FlatAppearance.BorderSize = 1;
  479. this.actualSizeButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
  480. }
  481. }
  482. /// <summary>
  483. /// 实际大小
  484. /// </summary>
  485. /// <param name="sender"></param>
  486. /// <param name="e"></param>
  487. private void onMouseLeaveActualSize(object sender, EventArgs e)
  488. {
  489. //this.Focus();
  490. if (!this.actualSizeButton.selected)
  491. {
  492. this.actualSizeButton.BackColor = Color.FromArgb(0, 0, 0, 0);
  493. this.actualSizeButton.FlatAppearance.BorderSize = 0;
  494. this.actualSizeButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
  495. }
  496. }
  497. /// <summary>
  498. /// 合适大小
  499. /// </summary>
  500. /// <param name="sender"></param>
  501. /// <param name="e"></param>
  502. private void onMouseMoveZoomToWindow(object sender, MouseEventArgs e)
  503. {
  504. //this.Focus();
  505. if (!this.zoomToWindowButton.selected)
  506. {
  507. this.zoomToWindowButton.BackColor = Color.FromArgb(181, 215, 243);
  508. this.zoomToWindowButton.FlatAppearance.BorderSize = 1;
  509. this.zoomToWindowButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
  510. }
  511. }
  512. /// <summary>
  513. /// 合适大小
  514. /// </summary>
  515. /// <param name="sender"></param>
  516. /// <param name="e"></param>
  517. private void onMouseLeaveZoomToWindow(object sender, EventArgs e)
  518. {
  519. //this.Focus();
  520. if (!this.zoomToWindowButton.selected)
  521. {
  522. this.zoomToWindowButton.BackColor = Color.FromArgb(0, 0, 0, 0);
  523. this.zoomToWindowButton.FlatAppearance.BorderSize = 0;
  524. this.zoomToWindowButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
  525. }
  526. }
  527. /// <summary>
  528. /// 定倍显示
  529. /// </summary>
  530. /// <param name="sender"></param>
  531. /// <param name="e"></param>
  532. private void onMouseMoveFixedTimes(object sender, MouseEventArgs e)
  533. {
  534. //this.Focus();
  535. if (!this.fixedTimesButton.selected)
  536. {
  537. this.fixedTimesButton.BackColor = Color.FromArgb(181, 215, 243);
  538. this.fixedTimesButton.FlatAppearance.BorderSize = 1;
  539. this.fixedTimesButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
  540. }
  541. }
  542. /// <summary>
  543. /// 定倍显示
  544. /// </summary>
  545. /// <param name="sender"></param>
  546. /// <param name="e"></param>
  547. private void onMouseLeaveFixedTimes(object sender, EventArgs e)
  548. {
  549. //this.Focus();
  550. if (!this.fixedTimesButton.selected)
  551. {
  552. this.fixedTimesButton.BackColor = Color.FromArgb(0, 0, 0, 0);
  553. this.fixedTimesButton.FlatAppearance.BorderSize = 0;
  554. this.fixedTimesButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
  555. }
  556. }
  557. /// <summary>
  558. /// 锁定扩缩
  559. /// </summary>
  560. /// <param name="sender"></param>
  561. /// <param name="e"></param>
  562. private void onMouseMoveLockdown(object sender, MouseEventArgs e)
  563. {
  564. //this.Focus();
  565. if (!this.lockdownButton.selected)
  566. {
  567. this.lockdownButton.BackColor = Color.FromArgb(181, 215, 243);
  568. this.lockdownButton.FlatAppearance.BorderSize = 1;
  569. this.lockdownButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
  570. }
  571. }
  572. /// <summary>
  573. /// 锁定扩缩
  574. /// </summary>
  575. /// <param name="sender"></param>
  576. /// <param name="e"></param>
  577. private void onMouseLeaveLockdown(object sender, EventArgs e)
  578. {
  579. //this.Focus();
  580. if (!this.lockdownButton.selected)
  581. {
  582. this.lockdownButton.BackColor = Color.FromArgb(0, 0, 0, 0);
  583. this.lockdownButton.FlatAppearance.BorderSize = 0;
  584. this.lockdownButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
  585. }
  586. }
  587. /// <summary>
  588. /// 缩小按钮
  589. /// </summary>
  590. /// <param name="sender"></param>
  591. /// <param name="e"></param>
  592. private void onMouseMoveZoomOut(object sender, MouseEventArgs e)
  593. {
  594. //this.Focus();
  595. if (!this.zoomOutButton.selected)
  596. {
  597. this.zoomOutButton.BackColor = Color.FromArgb(181, 215, 243);
  598. this.zoomOutButton.FlatAppearance.BorderSize = 1;
  599. this.zoomOutButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
  600. }
  601. }
  602. /// <summary>
  603. /// 缩小按钮
  604. /// </summary>
  605. /// <param name="sender"></param>
  606. /// <param name="e"></param>
  607. private void onMouseLeaveZoomOut(object sender, EventArgs e)
  608. {
  609. //this.Focus();
  610. if (!this.zoomOutButton.selected)
  611. {
  612. this.zoomOutButton.BackColor = Color.FromArgb(0, 0, 0, 0);
  613. this.zoomOutButton.FlatAppearance.BorderSize = 0;
  614. this.zoomOutButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
  615. }
  616. }
  617. /// <summary>
  618. /// 放大按钮
  619. /// </summary>
  620. /// <param name="sender"></param>
  621. /// <param name="e"></param>
  622. private void onMouseMoveZoomIn(object sender, MouseEventArgs e)
  623. {
  624. //this.Focus();
  625. if (!this.zoomInButton.selected)
  626. {
  627. this.zoomInButton.BackColor = Color.FromArgb(181, 215, 243);
  628. this.zoomInButton.FlatAppearance.BorderSize = 1;
  629. this.zoomInButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
  630. }
  631. }
  632. /// <summary>
  633. /// 放大按钮
  634. /// </summary>
  635. /// <param name="sender"></param>
  636. /// <param name="e"></param>
  637. private void onMouseLeaveZoomIn(object sender, EventArgs e)
  638. {
  639. //this.Focus();
  640. if (!this.zoomInButton.selected)
  641. {
  642. this.zoomInButton.BackColor = Color.FromArgb(0, 0, 0, 0);
  643. this.zoomInButton.FlatAppearance.BorderSize = 0;
  644. this.zoomInButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
  645. }
  646. }
  647. /// <summary>
  648. /// 给DocumentView的事件,用于相的选中和取消
  649. /// </summary>
  650. public event EventHandler<EventArgs<int>> ItemICheckChanged;
  651. private void OnItemICheckChanged(int index)
  652. {
  653. if (ItemICheckChanged != null)
  654. {
  655. ItemICheckChanged(this, new EventArgs<int>(index));
  656. }
  657. }
  658. private void ItemCheckChanged(object sender, EventArgs<int> e)
  659. {
  660. OnItemICheckChanged(e.Data);
  661. }
  662. /// <summary>
  663. /// 创建内部组件
  664. /// </summary>
  665. private void InitInternalControl()
  666. {
  667. //
  668. // 设置Panel属性
  669. //
  670. this.Cursor = Cursors.Default;
  671. //
  672. // 左侧panel属性
  673. //
  674. this.panelLeft = new Panel();
  675. this.panelLeft.Dock = DockStyle.Left;
  676. this.panelLeft.AutoSize = true;
  677. //
  678. // 最佳
  679. //
  680. this.bestButton = new MyFlatButton();
  681. this.bestButton.Location = new Point(locationX, 5);
  682. this.bestButton.Size = new Size(20, 20);
  683. this.bestButton.Image = PdnResources.GetImageResource("Icons.MenuViewBestIcon.png").Reference;
  684. this.bestButton.FlatStyle = FlatStyle.Flat;
  685. this.bestButton.FlatAppearance.BorderSize = 0;
  686. this.bestButton.MouseMove += new MouseEventHandler(onMouseMoveBest);
  687. this.bestButton.MouseLeave += new EventHandler(onMouseLeaveBest);
  688. //
  689. // 最大最小
  690. //
  691. this.locationX += 30;
  692. this.maxMinButton = new MyFlatButton();
  693. this.maxMinButton.Location = new Point(locationX, 5);
  694. this.maxMinButton.Size = new Size(20, 20);
  695. this.maxMinButton.Image = PdnResources.GetImageResource("Icons.MenuViewMaxMinIcon.png").Reference;
  696. this.maxMinButton.FlatStyle = FlatStyle.Flat;
  697. this.maxMinButton.FlatAppearance.BorderSize = 0;
  698. this.maxMinButton.MouseMove += new MouseEventHandler(onMouseMoveMaxMin);
  699. this.maxMinButton.MouseLeave += new EventHandler(onMouseLeaveMaxMin);
  700. //
  701. // 原始状态
  702. //
  703. this.locationX += 30;
  704. this.originButton = new MyFlatButton();
  705. this.originButton.Location = new Point(locationX, 5);
  706. this.originButton.Size = new Size(20, 20);
  707. this.originButton.Image = PdnResources.GetImageResource("Icons.MenuViewOriginIcon.png").Reference;
  708. this.originButton.FlatStyle = FlatStyle.Flat;
  709. this.originButton.FlatAppearance.BorderSize = 0;
  710. this.originButton.MouseMove += new MouseEventHandler(onMouseMoveOrigin);
  711. this.originButton.MouseLeave += new EventHandler(onMouseLeaveOrigin);
  712. //
  713. // gamma0.45
  714. //
  715. this.locationX += 30;
  716. this.gamma45Button = new MyFlatButton();
  717. this.gamma45Button.Location = new Point(locationX, 5);
  718. this.gamma45Button.Size = new Size(20, 20);
  719. this.gamma45Button.Image = PdnResources.GetImageResource("Icons.MenuViewGamma45Icon.png").Reference;
  720. this.gamma45Button.FlatStyle = FlatStyle.Flat;
  721. this.gamma45Button.FlatAppearance.BorderSize = 0;
  722. this.gamma45Button.MouseMove += new MouseEventHandler(onMouseMoveGamma45);
  723. this.gamma45Button.MouseLeave += new EventHandler(onMouseLeaveGamma45);
  724. //
  725. // 网格
  726. //
  727. this.locationX += 30;
  728. this.gridButton = new MyFlatButton();
  729. this.gridButton.Location = new Point(locationX, 5);
  730. this.gridButton.Size = new Size(20, 20);
  731. this.gridButton.Image = PdnResources.GetImageResource("Icons.MenuToolsGridLineIcon.png").Reference;
  732. this.gridButton.FlatStyle = FlatStyle.Flat;
  733. this.gridButton.FlatAppearance.BorderSize = 0;
  734. this.gridButton.MouseMove += new MouseEventHandler(onMouseMoveGrid);
  735. this.gridButton.MouseLeave += new EventHandler(onMouseLeaveGrid);
  736. //
  737. // 辅助线
  738. //
  739. this.locationX += 30;
  740. this.auxiliaryLineButton = new MyFlatButton();
  741. this.auxiliaryLineButton.Location = new Point(locationX, 5);
  742. this.auxiliaryLineButton.Size = new Size(20, 20);
  743. this.auxiliaryLineButton.Image = PdnResources.GetImageResource("Icons.MenuToolsAuxiliaryLineIcon.png").Reference;
  744. this.auxiliaryLineButton.FlatStyle = FlatStyle.Flat;
  745. this.auxiliaryLineButton.FlatAppearance.BorderSize = 0;
  746. this.auxiliaryLineButton.MouseMove += new MouseEventHandler(onMouseMoveAuxiliaryLine);
  747. this.auxiliaryLineButton.MouseLeave += new EventHandler(onMouseLeaveAuxiliaryLine);
  748. //
  749. // 水平镜像
  750. //
  751. this.locationX += 30;
  752. this.horizontalMirroringButton = new MyFlatButton();
  753. this.horizontalMirroringButton.Location = new Point(locationX, 5);
  754. this.horizontalMirroringButton.Size = new Size(20, 20);
  755. this.horizontalMirroringButton.Image = PdnResources.GetImageResource("Icons.MenuImageFlipHorizontalIcon.png").Reference;
  756. this.horizontalMirroringButton.FlatStyle = FlatStyle.Flat;
  757. this.horizontalMirroringButton.FlatAppearance.BorderSize = 0;
  758. this.horizontalMirroringButton.MouseMove += new MouseEventHandler(onMouseMoveHorizontalMirroring);
  759. this.horizontalMirroringButton.MouseLeave += new EventHandler(onMouseLeaveHorizontalMirroring);
  760. //
  761. // 垂直镜像
  762. //
  763. this.locationX += 30;
  764. this.verticalMirrorButton = new MyFlatButton();
  765. this.verticalMirrorButton.Location = new Point(locationX, 5);
  766. this.verticalMirrorButton.Size = new Size(20, 20);
  767. this.verticalMirrorButton.Image = PdnResources.GetImageResource("Icons.MenuImageFlipVerticalIcon.png").Reference;
  768. this.verticalMirrorButton.FlatStyle = FlatStyle.Flat;
  769. this.verticalMirrorButton.FlatAppearance.BorderSize = 0;
  770. this.verticalMirrorButton.MouseMove += new MouseEventHandler(onMouseMoveVerticalMirror);
  771. this.verticalMirrorButton.MouseLeave += new EventHandler(onMouseLeaveVerticalMirror);
  772. //
  773. // 中心镜像
  774. //
  775. this.locationX += 30;
  776. this.centerMirrorButton = new MyFlatButton();
  777. this.centerMirrorButton.Location = new Point(locationX, 5);
  778. this.centerMirrorButton.Size = new Size(20, 20);
  779. this.centerMirrorButton.Image = PdnResources.GetImageResource("Icons.MenuImageFlipCenterIcon.png").Reference;
  780. this.centerMirrorButton.FlatStyle = FlatStyle.Flat;
  781. this.centerMirrorButton.FlatAppearance.BorderSize = 0;
  782. this.centerMirrorButton.MouseMove += new MouseEventHandler(onMouseMoveCenterMirror);
  783. this.centerMirrorButton.MouseLeave += new EventHandler(onMouseLeaveCenterMirror);
  784. //
  785. // 移动模式
  786. //
  787. this.locationX += 30;
  788. this.mobileModeButton = new MyFlatButton();
  789. this.mobileModeButton.Location = new Point(locationX, 5);
  790. this.mobileModeButton.Size = new Size(20, 20);
  791. this.mobileModeButton.Image = PdnResources.GetImageResource("Icons.PanToolIcon.png").Reference;
  792. this.mobileModeButton.FlatStyle = FlatStyle.Flat;
  793. this.mobileModeButton.FlatAppearance.BorderSize = 0;
  794. this.mobileModeButton.MouseMove += new MouseEventHandler(onMouseMoveMobileMode);
  795. this.mobileModeButton.MouseLeave += new EventHandler(onMouseLeaveMobileMode);
  796. //
  797. // 移动模式
  798. //
  799. this.locationX += 30;
  800. this.cursorModeButton = new MyFlatButton();
  801. this.cursorModeButton.Location = new Point(locationX, 5);
  802. this.cursorModeButton.Size = new Size(20, 20);
  803. this.cursorModeButton.Image = PdnResources.GetImageResource("Icons.MenuChoiseActionIcon.png").Reference;
  804. this.cursorModeButton.FlatStyle = FlatStyle.Flat;
  805. this.cursorModeButton.BackColor = Color.FromArgb(181, 215, 243);
  806. this.cursorModeButton.FlatAppearance.BorderSize = 1;
  807. this.cursorModeButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
  808. this.cursorModeButton.selected = true;
  809. this.cursorModeButton.MouseMove += new MouseEventHandler(onMouseMoveCursorMode);
  810. this.cursorModeButton.MouseLeave += new EventHandler(onMouseLeaveCursorMode);
  811. //
  812. // 实际大小
  813. //
  814. this.locationX += 30;
  815. this.actualSizeButton = new MyFlatButton();
  816. this.actualSizeButton.Location = new Point(locationX, 5);
  817. this.actualSizeButton.Size = new Size(20, 20);
  818. this.actualSizeButton.Image = PdnResources.GetImageResource("Icons.MenuViewActualSizeIcon.png").Reference;
  819. this.actualSizeButton.FlatStyle = FlatStyle.Flat;
  820. this.actualSizeButton.FlatAppearance.BorderSize = 0;
  821. this.actualSizeButton.MouseMove += new MouseEventHandler(onMouseMoveActualSize);
  822. this.actualSizeButton.MouseLeave += new EventHandler(onMouseLeaveActualSize);
  823. //
  824. // 合适大小
  825. //
  826. this.locationX += 30;
  827. this.zoomToWindowButton = new MyFlatButton();
  828. this.zoomToWindowButton.Location = new Point(locationX, 5);
  829. this.zoomToWindowButton.Size = new Size(20, 20);
  830. this.zoomToWindowButton.Image = PdnResources.GetImageResource("Icons.MenuViewZoomToWindowIcon.png").Reference;
  831. this.zoomToWindowButton.FlatStyle = FlatStyle.Flat;
  832. this.zoomToWindowButton.FlatAppearance.BorderSize = 0;
  833. this.zoomToWindowButton.MouseMove += new MouseEventHandler(onMouseMoveZoomToWindow);
  834. this.zoomToWindowButton.MouseLeave += new EventHandler(onMouseLeaveZoomToWindow);
  835. //
  836. // 定倍显示
  837. //
  838. /*this.locationX += 20;
  839. this.fixedTimesButton = new MyFlatButton();
  840. this.fixedTimesButton.Location = new Point(locationX, 5);
  841. this.fixedTimesButton.Size = new Size(20, 20);
  842. this.fixedTimesButton.Image = PdnResources.GetImageResource("Icons.MenuFixedMultipleIcon.png").Reference;
  843. this.fixedTimesButton.FlatStyle = FlatStyle.Flat;
  844. this.fixedTimesButton.FlatAppearance.BorderSize = 0;*/
  845. //
  846. // 锁定扩缩
  847. //
  848. this.locationX += 30;
  849. this.lockdownButton = new MyFlatButton();
  850. this.lockdownButton.Location = new Point(locationX, 5);
  851. this.lockdownButton.Size = new Size(20, 20);
  852. this.lockdownButton.Image = PdnResources.GetImageResource("Icons.MenuLockZoomIcon.png").Reference;
  853. this.lockdownButton.FlatStyle = FlatStyle.Flat;
  854. this.lockdownButton.FlatAppearance.BorderSize = 0;
  855. this.lockdownButton.MouseMove += new MouseEventHandler(onMouseMoveLockdown);
  856. this.lockdownButton.MouseLeave += new EventHandler(onMouseLeaveLockdown);
  857. //
  858. // 缩小按钮
  859. //
  860. this.locationX += 30;
  861. this.zoomOutButton = new MyFlatButton();
  862. this.zoomOutButton.Location = new Point(locationX, 5);
  863. this.zoomOutButton.Size = new Size(20, 20);
  864. this.zoomOutButton.Image = PdnResources.GetImageResource("Icons.MenuViewZoomOutIcon.png").Reference;
  865. this.zoomOutButton.FlatStyle = FlatStyle.Flat;
  866. this.zoomOutButton.FlatAppearance.BorderSize = 0;
  867. this.zoomOutButton.MouseMove += new MouseEventHandler(onMouseMoveZoomOut);
  868. this.zoomOutButton.MouseLeave += new EventHandler(onMouseLeaveZoomOut);
  869. //
  870. // 放大按钮
  871. //
  872. this.locationX += 30;
  873. this.zoomInButton = new MyFlatButton();
  874. this.zoomInButton.Location = new Point(locationX, 5);
  875. this.zoomInButton.Size = new Size(20, 20);
  876. this.zoomInButton.Image = PdnResources.GetImageResource("Icons.MenuViewZoomInIcon.png").Reference;
  877. this.zoomInButton.FlatStyle = FlatStyle.Flat;
  878. this.zoomInButton.FlatAppearance.BorderSize = 0;
  879. this.zoomInButton.MouseMove += new MouseEventHandler(onMouseMoveZoomIn);
  880. this.zoomInButton.MouseLeave += new EventHandler(onMouseLeaveZoomIn);
  881. //
  882. // 放大缩小的TrackBar
  883. //
  884. this.locationX += 30;
  885. this.trackBar = new TrackBar();
  886. this.trackBar.AutoSize = false;
  887. this.trackBar.Minimum = 1;
  888. this.trackBar.Name = "amountTrackBar";
  889. this.trackBar.Location = new Point(locationX, 5);
  890. this.trackBar.Size = new Size(175, 20);
  891. this.trackBar.SmallChange = 1;
  892. this.trackBar.TickStyle = TickStyle.None;
  893. //this.trackBar.Value = 100;
  894. //
  895. // 放大缩小的百分比
  896. //
  897. this.locationX += 175;
  898. this.textBox = new TextBox();
  899. this.textBox.Size = new Size(40, 20);
  900. this.textBox.Location = new Point(locationX, 5);
  901. //
  902. // 另一个百分比,可能是定倍的倍数?
  903. //
  904. this.locationX += 40 + 5;
  905. this.textBox1 = new TextBox();
  906. this.textBox1.Size = new Size(40, 20);
  907. this.textBox1.Location = new Point(locationX, 5);
  908. this.locationX += 40;
  909. //this.transparencyTrackBar = new TrackBar();
  910. //this.transparencyTrackBar.AutoSize = false;
  911. //this.transparencyTrackBar.Minimum = 0;
  912. //this.transparencyTrackBar.Maximum = 255;
  913. //this.transparencyTrackBar.Name = "transparencyTrackBar";
  914. //this.transparencyTrackBar.Location = new Point(locationX, 5);
  915. //this.transparencyTrackBar.Size = new Size(175, 20);
  916. //this.transparencyTrackBar.SmallChange = 1;
  917. //this.transparencyTrackBar.TickStyle = TickStyle.None;
  918. this.locationX += 40;// + 5 + 5;
  919. //
  920. // 提示信息
  921. //
  922. this.toolTip = new ToolTip();
  923. this.toolTip.SetToolTip(this.bestButton, PdnResources.GetString("Menu.optimal.text"));
  924. this.toolTip.SetToolTip(this.maxMinButton, PdnResources.GetString("Menu.max.text")+"/"+ PdnResources.GetString("Menu.minimum.text"));
  925. this.toolTip.SetToolTip(this.originButton, PdnResources.GetString("Menu.Originalstate.text"));
  926. this.toolTip.SetToolTip(this.gamma45Button, PdnResources.GetString("Menu.imagecapture.Previewwindow.Gamma.text")+"0.45");
  927. this.toolTip.SetToolTip(this.gridButton, PdnResources.GetString("Menu.Tools.GridLine.Text"));
  928. this.toolTip.SetToolTip(this.auxiliaryLineButton, PdnResources.GetString("Menu.Tools.AuxiliaryLine.Text"));
  929. this.toolTip.SetToolTip(this.horizontalMirroringButton, PdnResources.GetString("Menu.Thelevelofthemirror.text"));
  930. this.toolTip.SetToolTip(this.verticalMirrorButton, PdnResources.GetString("Menu.Verticalmirror.text"));
  931. this.toolTip.SetToolTip(this.centerMirrorButton, PdnResources.GetString("Menu.Centerfthemirror.text"));
  932. this.toolTip.SetToolTip(this.actualSizeButton, PdnResources.GetString("Menu.Edit.ActualSize.Text"));
  933. this.toolTip.SetToolTip(this.zoomToWindowButton, PdnResources.GetString("Menu.Edit.ZoomToWindow.Text"));
  934. //this.toolTip.SetToolTip(this.fixedTimesButton, PdnResources.GetString("Menu.Edit.FixedMultiple.Text"));
  935. this.toolTip.SetToolTip(this.lockdownButton, PdnResources.GetString("Menu.Edit.LockZoom.Text"));
  936. this.toolTip.SetToolTip(this.mobileModeButton, PdnResources.GetString("Menu.Mobilemodel.text"));
  937. this.toolTip.SetToolTip(this.cursorModeButton, PdnResources.GetString("Menu.Pointertothemodel.text"));
  938. this.toolTip.SetToolTip(this.zoomOutButton, PdnResources.GetString("CommonAction.ZoomOut"));
  939. this.toolTip.SetToolTip(this.zoomInButton, PdnResources.GetString("CommonAction.ZoomIn"));
  940. this.toolTip.ShowAlways = true;
  941. this.panelLeft.Controls.Add(this.bestButton);
  942. this.panelLeft.Controls.Add(this.maxMinButton);
  943. this.panelLeft.Controls.Add(this.originButton);
  944. this.panelLeft.Controls.Add(this.gamma45Button);
  945. this.panelLeft.Controls.Add(this.gridButton);
  946. this.panelLeft.Controls.Add(this.auxiliaryLineButton);
  947. this.panelLeft.Controls.Add(this.horizontalMirroringButton);
  948. this.panelLeft.Controls.Add(this.verticalMirrorButton);
  949. this.panelLeft.Controls.Add(this.centerMirrorButton);
  950. this.panelLeft.Controls.Add(this.actualSizeButton);
  951. this.panelLeft.Controls.Add(this.zoomToWindowButton);
  952. this.panelLeft.Controls.Add(this.fixedTimesButton);
  953. this.panelLeft.Controls.Add(this.lockdownButton);
  954. this.panelLeft.Controls.Add(this.mobileModeButton);
  955. this.panelLeft.Controls.Add(this.cursorModeButton);
  956. this.panelLeft.Controls.Add(this.zoomOutButton);
  957. this.panelLeft.Controls.Add(this.zoomInButton);
  958. this.panelLeft.Controls.Add(this.trackBar);
  959. this.panelLeft.Controls.Add(this.textBox);
  960. //this.panelLeft.Controls.Add(this.textBox1);
  961. //this.panelLeft.Controls.Add(this.transparencyTrackBar);
  962. this.Controls.Add(this.panelLeft);
  963. }
  964. #region 设计器
  965. /// <summary>
  966. /// 必需的设计器变量。
  967. /// </summary>
  968. private System.ComponentModel.IContainer components = null;
  969. /// <summary>
  970. /// 清理所有正在使用的资源。
  971. /// </summary>
  972. /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
  973. protected override void Dispose(bool disposing)
  974. {
  975. if (disposing && (components != null))
  976. {
  977. components.Dispose();
  978. }
  979. base.Dispose(disposing);
  980. }
  981. #region 组件设计器生成的代码
  982. /// <summary>
  983. /// 设计器支持所需的方法 - 不要修改
  984. /// 使用代码编辑器修改此方法的内容。
  985. /// </summary>
  986. private void InitializeComponent()
  987. {
  988. components = new System.ComponentModel.Container();
  989. }
  990. #endregion
  991. #endregion
  992. }
  993. }