1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009 |
- using PaintDotNet.SystemLayer;
- using System;
- using System.Drawing;
- using System.Drawing.Drawing2D;
- using System.Windows.Forms;
- namespace PaintDotNet.CustomControl
- {
- /// <summary>
- /// 画板底部的快捷栏
- /// 非公共,每个DocumentWorkspace自己保持自己的
- /// </summary>
- public class PanelBottom : ScrollPanel
- {
- /// <summary>
- /// 最佳
- /// </summary>
- public MyFlatButton bestButton;
- /// <summary>
- /// 最大最小
- /// </summary>
- public MyFlatButton maxMinButton;
- /// <summary>
- /// 原始状态
- /// </summary>
- public MyFlatButton originButton;
- /// <summary>
- /// 伽马0.45
- /// </summary>
- public MyFlatButton gamma45Button;
- /// <summary>
- /// 网格
- /// </summary>
- public MyFlatButton gridButton;
- /// <summary>
- /// 辅助线
- /// </summary>
- public MyFlatButton auxiliaryLineButton;
- /// <summary>
- /// 水平镜像
- /// </summary>
- public MyFlatButton horizontalMirroringButton;
- /// <summary>
- /// 垂直镜像
- /// </summary>
- public MyFlatButton verticalMirrorButton;
- /// <summary>
- /// 中心镜像
- /// </summary>
- public MyFlatButton centerMirrorButton;
- /// <summary>
- /// 移动模式
- /// </summary>
- public MyFlatButton mobileModeButton;
- /// <summary>
- /// 指针模式
- /// </summary>
- public MyFlatButton cursorModeButton;
- /// <summary>
- /// 实际大小
- /// </summary>
- public MyFlatButton actualSizeButton;
- /// <summary>
- /// 合适大小
- /// </summary>
- public MyFlatButton zoomToWindowButton;
- /// <summary>
- /// 定倍显示
- /// </summary>
- public MyFlatButton fixedTimesButton;
- /// <summary>
- /// 锁定扩缩
- /// </summary>
- public MyFlatButton lockdownButton;
- /// <summary>
- /// 缩小按钮
- /// </summary>
- public MyFlatButton zoomOutButton;
- /// <summary>
- /// 放大按钮
- /// </summary>
- public MyFlatButton zoomInButton;
- /// <summary>
- /// 放大缩小的TrackBar
- /// </summary>
- public TrackBar trackBar;
- /// <summary>
- /// 放大缩小的百分比
- /// </summary>
- public TextBox textBox;
- /// <summary>
- /// 另一个百分比,可能是比原始图片的倍数
- /// </summary>
- public TextBox textBox1;
- /// <summary>
- /// 透明度的TrackBar
- /// </summary>
- //public TrackBar transparencyTrackBar;
- /// <summary>
- /// hint 提示信息
- /// </summary>
- public ToolTip toolTip;
- /// <summary>
- /// 位置
- /// </summary>
- public int locationX = 5;
- /// <summary>
- /// 左侧快捷工具的容器
- /// </summary>
- private Panel panelLeft;
- /// <summary>
- /// 目前被改成tab的菜单了
- /// </summary>
- public PanelBottomRight documentStrip;
- public PanelBottom()
- {
- InitializeComponent();
- InitInternalControl();
- this.documentStrip = new PanelBottomRight();
- //
- // documentStrip
- //
- ////设置多图/多相模式,true为显示多图
- //this.documentStrip.ShowPictures = true;
- ////设置单选模式
- //this.documentStrip.documentStrip.AllowMultiChoise = false;
- this.documentStrip.AutoSize = false;
- this.documentStrip.Name = "PanelBottomRight";
- this.documentStrip.TabIndex = 5;
- this.documentStrip.Location = new Point(0, 0);
- this.documentStrip.Size = new Size(400, 20);
- this.documentStrip.Dock = DockStyle.Right;
- this.documentStrip.ItemCheckChanged += new EventHandler<EventArgs<int>>(this.ItemCheckChanged);
- this.Controls.Add(this.documentStrip);
- }
- /// <summary>
- /// 最佳
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseMoveBest(object sender, MouseEventArgs e)
- {
- //this.Focus();
- if (!this.bestButton.selected)
- {
- this.bestButton.BackColor = Color.FromArgb(181, 215, 243);
- this.bestButton.FlatAppearance.BorderSize = 1;
- this.bestButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
- }
- }
- /// <summary>
- /// 最佳
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseLeaveBest(object sender, EventArgs e)
- {
- //this.Focus();
- if (!this.bestButton.selected)
- {
- this.bestButton.BackColor = Color.FromArgb(0, 0, 0, 0);
- this.bestButton.FlatAppearance.BorderSize = 0;
- this.bestButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
- }
- }
- /// <summary>
- /// 最大最小
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseMoveMaxMin(object sender, MouseEventArgs e)
- {
- //this.Focus();
- if (!this.maxMinButton.selected)
- {
- this.maxMinButton.BackColor = Color.FromArgb(181, 215, 243);
- this.maxMinButton.FlatAppearance.BorderSize = 1;
- this.maxMinButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
- }
- }
- /// <summary>
- /// 最大最小
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseLeaveMaxMin(object sender, EventArgs e)
- {
- //this.Focus();
- if (!this.maxMinButton.selected)
- {
- this.maxMinButton.BackColor = Color.FromArgb(0, 0, 0, 0);
- this.maxMinButton.FlatAppearance.BorderSize = 0;
- this.maxMinButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
- }
- }
- /// <summary>
- /// 原始状态
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseMoveOrigin(object sender, MouseEventArgs e)
- {
- //this.Focus();
- if (!this.originButton.selected)
- {
- this.originButton.BackColor = Color.FromArgb(181, 215, 243);
- this.originButton.FlatAppearance.BorderSize = 1;
- this.originButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
- }
- }
- /// <summary>
- /// 原始状态
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseLeaveOrigin(object sender, EventArgs e)
- {
- //this.Focus();
- if (!this.originButton.selected)
- {
- this.originButton.BackColor = Color.FromArgb(0, 0, 0, 0);
- this.originButton.FlatAppearance.BorderSize = 0;
- this.originButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
- }
- }
- /// <summary>
- /// 伽马0.45
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseMoveGamma45(object sender, MouseEventArgs e)
- {
- //this.Focus();
- if (!this.gamma45Button.selected)
- {
- this.gamma45Button.BackColor = Color.FromArgb(181, 215, 243);
- this.gamma45Button.FlatAppearance.BorderSize = 1;
- this.gamma45Button.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
- }
- }
- /// <summary>
- /// 伽马0.45
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseLeaveGamma45(object sender, EventArgs e)
- {
- //this.Focus();
- if (!this.gamma45Button.selected)
- {
- this.gamma45Button.BackColor = Color.FromArgb(0, 0, 0, 0);
- this.gamma45Button.FlatAppearance.BorderSize = 0;
- this.gamma45Button.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
- }
- }
- /// <summary>
- /// 网格
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseMoveGrid(object sender, MouseEventArgs e)
- {
- //this.Focus();
- if (!this.gridButton.selected)
- {
- this.gridButton.BackColor = Color.FromArgb(181, 215, 243);
- this.gridButton.FlatAppearance.BorderSize = 1;
- this.gridButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
- }
- if (this.gridButton.Focused)
- this.gridButton.FlatAppearance.BorderSize = 1;
- }
- /// <summary>
- /// 网格
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseLeaveGrid(object sender, EventArgs e)
- {
- //this.Focus();
- if (!this.gridButton.selected)
- {
- this.gridButton.BackColor = Color.FromArgb(0, 0, 0, 0);
- this.gridButton.FlatAppearance.BorderSize = 0;
- this.gridButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
- }
- }
- /// <summary>
- /// 辅助线
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseMoveAuxiliaryLine(object sender, MouseEventArgs e)
- {
- //this.Focus();
- if (!this.auxiliaryLineButton.selected)
- {
- this.auxiliaryLineButton.BackColor = Color.FromArgb(181, 215, 243);
- this.auxiliaryLineButton.FlatAppearance.BorderSize = 1;
- this.auxiliaryLineButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
- }
- }
- /// <summary>
- /// 辅助线
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseLeaveAuxiliaryLine(object sender, EventArgs e)
- {
- //this.Focus();
- if (!this.auxiliaryLineButton.selected)
- {
- this.auxiliaryLineButton.BackColor = Color.FromArgb(0, 0, 0, 0);
- this.auxiliaryLineButton.FlatAppearance.BorderSize = 0;
- this.auxiliaryLineButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
- }
- }
- /// <summary>
- /// 水平镜像
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseMoveHorizontalMirroring(object sender, MouseEventArgs e)
- {
- //this.Focus();
- if (!this.horizontalMirroringButton.selected)
- {
- this.horizontalMirroringButton.BackColor = Color.FromArgb(181, 215, 243);
- this.horizontalMirroringButton.FlatAppearance.BorderSize = 1;
- this.horizontalMirroringButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
- }
- }
- /// <summary>
- /// 水平镜像
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseLeaveHorizontalMirroring(object sender, EventArgs e)
- {
- //this.Focus();
- if (!this.horizontalMirroringButton.selected)
- {
- this.horizontalMirroringButton.BackColor = Color.FromArgb(0, 0, 0, 0);
- this.horizontalMirroringButton.FlatAppearance.BorderSize = 0;
- this.horizontalMirroringButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
- }
- }
- /// <summary>
- /// 垂直镜像
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseMoveVerticalMirror(object sender, MouseEventArgs e)
- {
- //this.Focus();
- if (!this.verticalMirrorButton.selected)
- {
- this.verticalMirrorButton.BackColor = Color.FromArgb(181, 215, 243);
- this.verticalMirrorButton.FlatAppearance.BorderSize = 1;
- this.verticalMirrorButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
- }
- }
- /// <summary>
- /// 垂直镜像
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseLeaveVerticalMirror(object sender, EventArgs e)
- {
- //this.Focus();
- if (!this.verticalMirrorButton.selected)
- {
- this.verticalMirrorButton.BackColor = Color.FromArgb(0, 0, 0, 0);
- this.verticalMirrorButton.FlatAppearance.BorderSize = 0;
- this.verticalMirrorButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
- }
- }
- /// <summary>
- /// 中心镜像
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseMoveCenterMirror(object sender, MouseEventArgs e)
- {
- //this.Focus();
- if (!this.centerMirrorButton.selected)
- {
- this.centerMirrorButton.BackColor = Color.FromArgb(181, 215, 243);
- this.centerMirrorButton.FlatAppearance.BorderSize = 1;
- this.centerMirrorButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
- }
- }
- /// <summary>
- /// 中心镜像
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseLeaveCenterMirror(object sender, EventArgs e)
- {
- //this.Focus();
- if (!this.centerMirrorButton.selected)
- {
- this.centerMirrorButton.BackColor = Color.FromArgb(0, 0, 0, 0);
- this.centerMirrorButton.FlatAppearance.BorderSize = 0;
- this.centerMirrorButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
- }
- }
- /// <summary>
- /// 移动模式
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseMoveMobileMode(object sender, MouseEventArgs e)
- {
- //this.Focus();
- if (!this.mobileModeButton.selected)
- {
- this.mobileModeButton.BackColor = Color.FromArgb(181, 215, 243);
- this.mobileModeButton.FlatAppearance.BorderSize = 1;
- this.mobileModeButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
- }
- }
- /// <summary>
- /// 移动模式
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseLeaveMobileMode(object sender, EventArgs e)
- {
- //this.Focus();
- if (!this.mobileModeButton.selected)
- {
- this.mobileModeButton.BackColor = Color.FromArgb(0, 0, 0, 0);
- this.mobileModeButton.FlatAppearance.BorderSize = 0;
- this.mobileModeButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
- }
- }
- /// <summary>
- /// 指针模式
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseMoveCursorMode(object sender, MouseEventArgs e)
- {
- //this.Focus();
- if (!this.cursorModeButton.selected)
- {
- this.cursorModeButton.BackColor = Color.FromArgb(181, 215, 243);
- this.cursorModeButton.FlatAppearance.BorderSize = 1;
- this.cursorModeButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
- }
- }
- /// <summary>
- /// 指针模式
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseLeaveCursorMode(object sender, EventArgs e)
- {
- //this.Focus();
- if (!this.cursorModeButton.selected)
- {
- this.cursorModeButton.BackColor = Color.FromArgb(0, 0, 0, 0);
- this.cursorModeButton.FlatAppearance.BorderSize = 0;
- this.cursorModeButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
- }
- }
- /// <summary>
- /// 实际大小
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseMoveActualSize(object sender, MouseEventArgs e)
- {
- //this.Focus();
- if (!this.actualSizeButton.selected)
- {
- this.actualSizeButton.BackColor = Color.FromArgb(181, 215, 243);
- this.actualSizeButton.FlatAppearance.BorderSize = 1;
- this.actualSizeButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
- }
- }
- /// <summary>
- /// 实际大小
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseLeaveActualSize(object sender, EventArgs e)
- {
- //this.Focus();
- if (!this.actualSizeButton.selected)
- {
- this.actualSizeButton.BackColor = Color.FromArgb(0, 0, 0, 0);
- this.actualSizeButton.FlatAppearance.BorderSize = 0;
- this.actualSizeButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
- }
- }
- /// <summary>
- /// 合适大小
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseMoveZoomToWindow(object sender, MouseEventArgs e)
- {
- //this.Focus();
- if (!this.zoomToWindowButton.selected)
- {
- this.zoomToWindowButton.BackColor = Color.FromArgb(181, 215, 243);
- this.zoomToWindowButton.FlatAppearance.BorderSize = 1;
- this.zoomToWindowButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
- }
- }
- /// <summary>
- /// 合适大小
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseLeaveZoomToWindow(object sender, EventArgs e)
- {
- //this.Focus();
- if (!this.zoomToWindowButton.selected)
- {
- this.zoomToWindowButton.BackColor = Color.FromArgb(0, 0, 0, 0);
- this.zoomToWindowButton.FlatAppearance.BorderSize = 0;
- this.zoomToWindowButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
- }
- }
- /// <summary>
- /// 定倍显示
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseMoveFixedTimes(object sender, MouseEventArgs e)
- {
- //this.Focus();
- if (!this.fixedTimesButton.selected)
- {
- this.fixedTimesButton.BackColor = Color.FromArgb(181, 215, 243);
- this.fixedTimesButton.FlatAppearance.BorderSize = 1;
- this.fixedTimesButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
- }
- }
- /// <summary>
- /// 定倍显示
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseLeaveFixedTimes(object sender, EventArgs e)
- {
- //this.Focus();
- if (!this.fixedTimesButton.selected)
- {
- this.fixedTimesButton.BackColor = Color.FromArgb(0, 0, 0, 0);
- this.fixedTimesButton.FlatAppearance.BorderSize = 0;
- this.fixedTimesButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
- }
- }
- /// <summary>
- /// 锁定扩缩
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseMoveLockdown(object sender, MouseEventArgs e)
- {
- //this.Focus();
- if (!this.lockdownButton.selected)
- {
- this.lockdownButton.BackColor = Color.FromArgb(181, 215, 243);
- this.lockdownButton.FlatAppearance.BorderSize = 1;
- this.lockdownButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
- }
- }
- /// <summary>
- /// 锁定扩缩
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseLeaveLockdown(object sender, EventArgs e)
- {
- //this.Focus();
- if (!this.lockdownButton.selected)
- {
- this.lockdownButton.BackColor = Color.FromArgb(0, 0, 0, 0);
- this.lockdownButton.FlatAppearance.BorderSize = 0;
- this.lockdownButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
- }
- }
- /// <summary>
- /// 缩小按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseMoveZoomOut(object sender, MouseEventArgs e)
- {
- //this.Focus();
- if (!this.zoomOutButton.selected)
- {
- this.zoomOutButton.BackColor = Color.FromArgb(181, 215, 243);
- this.zoomOutButton.FlatAppearance.BorderSize = 1;
- this.zoomOutButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
- }
- }
- /// <summary>
- /// 缩小按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseLeaveZoomOut(object sender, EventArgs e)
- {
- //this.Focus();
- if (!this.zoomOutButton.selected)
- {
- this.zoomOutButton.BackColor = Color.FromArgb(0, 0, 0, 0);
- this.zoomOutButton.FlatAppearance.BorderSize = 0;
- this.zoomOutButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
- }
- }
- /// <summary>
- /// 放大按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseMoveZoomIn(object sender, MouseEventArgs e)
- {
- //this.Focus();
- if (!this.zoomInButton.selected)
- {
- this.zoomInButton.BackColor = Color.FromArgb(181, 215, 243);
- this.zoomInButton.FlatAppearance.BorderSize = 1;
- this.zoomInButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
- }
- }
- /// <summary>
- /// 放大按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseLeaveZoomIn(object sender, EventArgs e)
- {
- //this.Focus();
- if (!this.zoomInButton.selected)
- {
- this.zoomInButton.BackColor = Color.FromArgb(0, 0, 0, 0);
- this.zoomInButton.FlatAppearance.BorderSize = 0;
- this.zoomInButton.FlatAppearance.BorderColor = Color.FromArgb(0, 0, 0, 0);
- }
- }
- /// <summary>
- /// 给DocumentView的事件,用于相的选中和取消
- /// </summary>
- public event EventHandler<EventArgs<int>> ItemICheckChanged;
- private void OnItemICheckChanged(int index)
- {
- if (ItemICheckChanged != null)
- {
- ItemICheckChanged(this, new EventArgs<int>(index));
- }
- }
- private void ItemCheckChanged(object sender, EventArgs<int> e)
- {
- OnItemICheckChanged(e.Data);
- }
- /// <summary>
- /// 创建内部组件
- /// </summary>
- private void InitInternalControl()
- {
- //
- // 设置Panel属性
- //
- this.Cursor = Cursors.Default;
- //
- // 左侧panel属性
- //
- this.panelLeft = new Panel();
- this.panelLeft.Dock = DockStyle.Left;
- this.panelLeft.AutoSize = true;
- //
- // 最佳
- //
- this.bestButton = new MyFlatButton();
- this.bestButton.Location = new Point(locationX, 5);
- this.bestButton.Size = new Size(20, 20);
- this.bestButton.Image = PdnResources.GetImageResource("Icons.MenuViewBestIcon.png").Reference;
- this.bestButton.FlatStyle = FlatStyle.Flat;
- this.bestButton.FlatAppearance.BorderSize = 0;
- this.bestButton.MouseMove += new MouseEventHandler(onMouseMoveBest);
- this.bestButton.MouseLeave += new EventHandler(onMouseLeaveBest);
- //
- // 最大最小
- //
- this.locationX += 30;
- this.maxMinButton = new MyFlatButton();
- this.maxMinButton.Location = new Point(locationX, 5);
- this.maxMinButton.Size = new Size(20, 20);
- this.maxMinButton.Image = PdnResources.GetImageResource("Icons.MenuViewMaxMinIcon.png").Reference;
- this.maxMinButton.FlatStyle = FlatStyle.Flat;
- this.maxMinButton.FlatAppearance.BorderSize = 0;
- this.maxMinButton.MouseMove += new MouseEventHandler(onMouseMoveMaxMin);
- this.maxMinButton.MouseLeave += new EventHandler(onMouseLeaveMaxMin);
- //
- // 原始状态
- //
- this.locationX += 30;
- this.originButton = new MyFlatButton();
- this.originButton.Location = new Point(locationX, 5);
- this.originButton.Size = new Size(20, 20);
- this.originButton.Image = PdnResources.GetImageResource("Icons.MenuViewOriginIcon.png").Reference;
- this.originButton.FlatStyle = FlatStyle.Flat;
- this.originButton.FlatAppearance.BorderSize = 0;
- this.originButton.MouseMove += new MouseEventHandler(onMouseMoveOrigin);
- this.originButton.MouseLeave += new EventHandler(onMouseLeaveOrigin);
- //
- // gamma0.45
- //
- this.locationX += 30;
- this.gamma45Button = new MyFlatButton();
- this.gamma45Button.Location = new Point(locationX, 5);
- this.gamma45Button.Size = new Size(20, 20);
- this.gamma45Button.Image = PdnResources.GetImageResource("Icons.MenuViewGamma45Icon.png").Reference;
- this.gamma45Button.FlatStyle = FlatStyle.Flat;
- this.gamma45Button.FlatAppearance.BorderSize = 0;
- this.gamma45Button.MouseMove += new MouseEventHandler(onMouseMoveGamma45);
- this.gamma45Button.MouseLeave += new EventHandler(onMouseLeaveGamma45);
- //
- // 网格
- //
- this.locationX += 30;
- this.gridButton = new MyFlatButton();
- this.gridButton.Location = new Point(locationX, 5);
- this.gridButton.Size = new Size(20, 20);
- this.gridButton.Image = PdnResources.GetImageResource("Icons.MenuToolsGridLineIcon.png").Reference;
- this.gridButton.FlatStyle = FlatStyle.Flat;
- this.gridButton.FlatAppearance.BorderSize = 0;
- this.gridButton.MouseMove += new MouseEventHandler(onMouseMoveGrid);
- this.gridButton.MouseLeave += new EventHandler(onMouseLeaveGrid);
- //
- // 辅助线
- //
- this.locationX += 30;
- this.auxiliaryLineButton = new MyFlatButton();
- this.auxiliaryLineButton.Location = new Point(locationX, 5);
- this.auxiliaryLineButton.Size = new Size(20, 20);
- this.auxiliaryLineButton.Image = PdnResources.GetImageResource("Icons.MenuToolsAuxiliaryLineIcon.png").Reference;
- this.auxiliaryLineButton.FlatStyle = FlatStyle.Flat;
- this.auxiliaryLineButton.FlatAppearance.BorderSize = 0;
- this.auxiliaryLineButton.MouseMove += new MouseEventHandler(onMouseMoveAuxiliaryLine);
- this.auxiliaryLineButton.MouseLeave += new EventHandler(onMouseLeaveAuxiliaryLine);
- //
- // 水平镜像
- //
- this.locationX += 30;
- this.horizontalMirroringButton = new MyFlatButton();
- this.horizontalMirroringButton.Location = new Point(locationX, 5);
- this.horizontalMirroringButton.Size = new Size(20, 20);
- this.horizontalMirroringButton.Image = PdnResources.GetImageResource("Icons.MenuImageFlipHorizontalIcon.png").Reference;
- this.horizontalMirroringButton.FlatStyle = FlatStyle.Flat;
- this.horizontalMirroringButton.FlatAppearance.BorderSize = 0;
- this.horizontalMirroringButton.MouseMove += new MouseEventHandler(onMouseMoveHorizontalMirroring);
- this.horizontalMirroringButton.MouseLeave += new EventHandler(onMouseLeaveHorizontalMirroring);
- //
- // 垂直镜像
- //
- this.locationX += 30;
- this.verticalMirrorButton = new MyFlatButton();
- this.verticalMirrorButton.Location = new Point(locationX, 5);
- this.verticalMirrorButton.Size = new Size(20, 20);
- this.verticalMirrorButton.Image = PdnResources.GetImageResource("Icons.MenuImageFlipVerticalIcon.png").Reference;
- this.verticalMirrorButton.FlatStyle = FlatStyle.Flat;
- this.verticalMirrorButton.FlatAppearance.BorderSize = 0;
- this.verticalMirrorButton.MouseMove += new MouseEventHandler(onMouseMoveVerticalMirror);
- this.verticalMirrorButton.MouseLeave += new EventHandler(onMouseLeaveVerticalMirror);
- //
- // 中心镜像
- //
- this.locationX += 30;
- this.centerMirrorButton = new MyFlatButton();
- this.centerMirrorButton.Location = new Point(locationX, 5);
- this.centerMirrorButton.Size = new Size(20, 20);
- this.centerMirrorButton.Image = PdnResources.GetImageResource("Icons.MenuImageFlipCenterIcon.png").Reference;
- this.centerMirrorButton.FlatStyle = FlatStyle.Flat;
- this.centerMirrorButton.FlatAppearance.BorderSize = 0;
- this.centerMirrorButton.MouseMove += new MouseEventHandler(onMouseMoveCenterMirror);
- this.centerMirrorButton.MouseLeave += new EventHandler(onMouseLeaveCenterMirror);
- //
- // 移动模式
- //
- this.locationX += 30;
- this.mobileModeButton = new MyFlatButton();
- this.mobileModeButton.Location = new Point(locationX, 5);
- this.mobileModeButton.Size = new Size(20, 20);
- this.mobileModeButton.Image = PdnResources.GetImageResource("Icons.PanToolIcon.png").Reference;
- this.mobileModeButton.FlatStyle = FlatStyle.Flat;
- this.mobileModeButton.FlatAppearance.BorderSize = 0;
- this.mobileModeButton.MouseMove += new MouseEventHandler(onMouseMoveMobileMode);
- this.mobileModeButton.MouseLeave += new EventHandler(onMouseLeaveMobileMode);
- //
- // 移动模式
- //
- this.locationX += 30;
- this.cursorModeButton = new MyFlatButton();
- this.cursorModeButton.Location = new Point(locationX, 5);
- this.cursorModeButton.Size = new Size(20, 20);
- this.cursorModeButton.Image = PdnResources.GetImageResource("Icons.MenuChoiseActionIcon.png").Reference;
- this.cursorModeButton.FlatStyle = FlatStyle.Flat;
- this.cursorModeButton.BackColor = Color.FromArgb(181, 215, 243);
- this.cursorModeButton.FlatAppearance.BorderSize = 1;
- this.cursorModeButton.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
- this.cursorModeButton.selected = true;
- this.cursorModeButton.MouseMove += new MouseEventHandler(onMouseMoveCursorMode);
- this.cursorModeButton.MouseLeave += new EventHandler(onMouseLeaveCursorMode);
- //
- // 实际大小
- //
- this.locationX += 30;
- this.actualSizeButton = new MyFlatButton();
- this.actualSizeButton.Location = new Point(locationX, 5);
- this.actualSizeButton.Size = new Size(20, 20);
- this.actualSizeButton.Image = PdnResources.GetImageResource("Icons.MenuViewActualSizeIcon.png").Reference;
- this.actualSizeButton.FlatStyle = FlatStyle.Flat;
- this.actualSizeButton.FlatAppearance.BorderSize = 0;
- this.actualSizeButton.MouseMove += new MouseEventHandler(onMouseMoveActualSize);
- this.actualSizeButton.MouseLeave += new EventHandler(onMouseLeaveActualSize);
- //
- // 合适大小
- //
- this.locationX += 30;
- this.zoomToWindowButton = new MyFlatButton();
- this.zoomToWindowButton.Location = new Point(locationX, 5);
- this.zoomToWindowButton.Size = new Size(20, 20);
- this.zoomToWindowButton.Image = PdnResources.GetImageResource("Icons.MenuViewZoomToWindowIcon.png").Reference;
- this.zoomToWindowButton.FlatStyle = FlatStyle.Flat;
- this.zoomToWindowButton.FlatAppearance.BorderSize = 0;
- this.zoomToWindowButton.MouseMove += new MouseEventHandler(onMouseMoveZoomToWindow);
- this.zoomToWindowButton.MouseLeave += new EventHandler(onMouseLeaveZoomToWindow);
- //
- // 定倍显示
- //
- /*this.locationX += 20;
- this.fixedTimesButton = new MyFlatButton();
- this.fixedTimesButton.Location = new Point(locationX, 5);
- this.fixedTimesButton.Size = new Size(20, 20);
- this.fixedTimesButton.Image = PdnResources.GetImageResource("Icons.MenuFixedMultipleIcon.png").Reference;
- this.fixedTimesButton.FlatStyle = FlatStyle.Flat;
- this.fixedTimesButton.FlatAppearance.BorderSize = 0;*/
- //
- // 锁定扩缩
- //
- this.locationX += 30;
- this.lockdownButton = new MyFlatButton();
- this.lockdownButton.Location = new Point(locationX, 5);
- this.lockdownButton.Size = new Size(20, 20);
- this.lockdownButton.Image = PdnResources.GetImageResource("Icons.MenuLockZoomIcon.png").Reference;
- this.lockdownButton.FlatStyle = FlatStyle.Flat;
- this.lockdownButton.FlatAppearance.BorderSize = 0;
- this.lockdownButton.MouseMove += new MouseEventHandler(onMouseMoveLockdown);
- this.lockdownButton.MouseLeave += new EventHandler(onMouseLeaveLockdown);
- //
- // 缩小按钮
- //
- this.locationX += 30;
- this.zoomOutButton = new MyFlatButton();
- this.zoomOutButton.Location = new Point(locationX, 5);
- this.zoomOutButton.Size = new Size(20, 20);
- this.zoomOutButton.Image = PdnResources.GetImageResource("Icons.MenuViewZoomOutIcon.png").Reference;
- this.zoomOutButton.FlatStyle = FlatStyle.Flat;
- this.zoomOutButton.FlatAppearance.BorderSize = 0;
- this.zoomOutButton.MouseMove += new MouseEventHandler(onMouseMoveZoomOut);
- this.zoomOutButton.MouseLeave += new EventHandler(onMouseLeaveZoomOut);
- //
- // 放大按钮
- //
- this.locationX += 30;
- this.zoomInButton = new MyFlatButton();
- this.zoomInButton.Location = new Point(locationX, 5);
- this.zoomInButton.Size = new Size(20, 20);
- this.zoomInButton.Image = PdnResources.GetImageResource("Icons.MenuViewZoomInIcon.png").Reference;
- this.zoomInButton.FlatStyle = FlatStyle.Flat;
- this.zoomInButton.FlatAppearance.BorderSize = 0;
- this.zoomInButton.MouseMove += new MouseEventHandler(onMouseMoveZoomIn);
- this.zoomInButton.MouseLeave += new EventHandler(onMouseLeaveZoomIn);
- //
- // 放大缩小的TrackBar
- //
- this.locationX += 30;
- this.trackBar = new TrackBar();
- this.trackBar.AutoSize = false;
- this.trackBar.Minimum = 1;
- this.trackBar.Name = "amountTrackBar";
- this.trackBar.Location = new Point(locationX, 5);
- this.trackBar.Size = new Size(175, 20);
- this.trackBar.SmallChange = 1;
- this.trackBar.TickStyle = TickStyle.None;
- //this.trackBar.Value = 100;
- //
- // 放大缩小的百分比
- //
- this.locationX += 175;
- this.textBox = new TextBox();
- this.textBox.Size = new Size(40, 20);
- this.textBox.Location = new Point(locationX, 5);
- //
- // 另一个百分比,可能是定倍的倍数?
- //
- this.locationX += 40 + 5;
- this.textBox1 = new TextBox();
- this.textBox1.Size = new Size(40, 20);
- this.textBox1.Location = new Point(locationX, 5);
- this.locationX += 40;
- //this.transparencyTrackBar = new TrackBar();
- //this.transparencyTrackBar.AutoSize = false;
- //this.transparencyTrackBar.Minimum = 0;
- //this.transparencyTrackBar.Maximum = 255;
- //this.transparencyTrackBar.Name = "transparencyTrackBar";
- //this.transparencyTrackBar.Location = new Point(locationX, 5);
- //this.transparencyTrackBar.Size = new Size(175, 20);
- //this.transparencyTrackBar.SmallChange = 1;
- //this.transparencyTrackBar.TickStyle = TickStyle.None;
- this.locationX += 40;// + 5 + 5;
- //
- // 提示信息
- //
- this.toolTip = new ToolTip();
- this.toolTip.SetToolTip(this.bestButton, PdnResources.GetString("Menu.optimal.text"));
- this.toolTip.SetToolTip(this.maxMinButton, PdnResources.GetString("Menu.max.text")+"/"+ PdnResources.GetString("Menu.minimum.text"));
- this.toolTip.SetToolTip(this.originButton, PdnResources.GetString("Menu.Originalstate.text"));
- this.toolTip.SetToolTip(this.gamma45Button, PdnResources.GetString("Menu.imagecapture.Previewwindow.Gamma.text")+"0.45");
- this.toolTip.SetToolTip(this.gridButton, PdnResources.GetString("Menu.Tools.GridLine.Text"));
- this.toolTip.SetToolTip(this.auxiliaryLineButton, PdnResources.GetString("Menu.Tools.AuxiliaryLine.Text"));
- this.toolTip.SetToolTip(this.horizontalMirroringButton, PdnResources.GetString("Menu.Thelevelofthemirror.text"));
- this.toolTip.SetToolTip(this.verticalMirrorButton, PdnResources.GetString("Menu.Verticalmirror.text"));
- this.toolTip.SetToolTip(this.centerMirrorButton, PdnResources.GetString("Menu.Centerfthemirror.text"));
- this.toolTip.SetToolTip(this.actualSizeButton, PdnResources.GetString("Menu.Edit.ActualSize.Text"));
- this.toolTip.SetToolTip(this.zoomToWindowButton, PdnResources.GetString("Menu.Edit.ZoomToWindow.Text"));
- //this.toolTip.SetToolTip(this.fixedTimesButton, PdnResources.GetString("Menu.Edit.FixedMultiple.Text"));
- this.toolTip.SetToolTip(this.lockdownButton, PdnResources.GetString("Menu.Edit.LockZoom.Text"));
- this.toolTip.SetToolTip(this.mobileModeButton, PdnResources.GetString("Menu.Mobilemodel.text"));
- this.toolTip.SetToolTip(this.cursorModeButton, PdnResources.GetString("Menu.Pointertothemodel.text"));
- this.toolTip.SetToolTip(this.zoomOutButton, PdnResources.GetString("CommonAction.ZoomOut"));
- this.toolTip.SetToolTip(this.zoomInButton, PdnResources.GetString("CommonAction.ZoomIn"));
- this.toolTip.ShowAlways = true;
- this.panelLeft.Controls.Add(this.bestButton);
- this.panelLeft.Controls.Add(this.maxMinButton);
- this.panelLeft.Controls.Add(this.originButton);
- this.panelLeft.Controls.Add(this.gamma45Button);
- this.panelLeft.Controls.Add(this.gridButton);
- this.panelLeft.Controls.Add(this.auxiliaryLineButton);
- this.panelLeft.Controls.Add(this.horizontalMirroringButton);
- this.panelLeft.Controls.Add(this.verticalMirrorButton);
- this.panelLeft.Controls.Add(this.centerMirrorButton);
- this.panelLeft.Controls.Add(this.actualSizeButton);
- this.panelLeft.Controls.Add(this.zoomToWindowButton);
- this.panelLeft.Controls.Add(this.fixedTimesButton);
- this.panelLeft.Controls.Add(this.lockdownButton);
- this.panelLeft.Controls.Add(this.mobileModeButton);
- this.panelLeft.Controls.Add(this.cursorModeButton);
- this.panelLeft.Controls.Add(this.zoomOutButton);
- this.panelLeft.Controls.Add(this.zoomInButton);
- this.panelLeft.Controls.Add(this.trackBar);
- this.panelLeft.Controls.Add(this.textBox);
- //this.panelLeft.Controls.Add(this.textBox1);
- //this.panelLeft.Controls.Add(this.transparencyTrackBar);
- this.Controls.Add(this.panelLeft);
- }
- #region 设计器
- /// <summary>
- /// 必需的设计器变量。
- /// </summary>
- private System.ComponentModel.IContainer components = null;
- /// <summary>
- /// 清理所有正在使用的资源。
- /// </summary>
- /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
- #region 组件设计器生成的代码
- /// <summary>
- /// 设计器支持所需的方法 - 不要修改
- /// 使用代码编辑器修改此方法的内容。
- /// </summary>
- private void InitializeComponent()
- {
- components = new System.ComponentModel.Container();
- }
- #endregion
- #endregion
- }
- }
|