using Resources; using SmartCoalApplication.SystemLayer; using System; using System.Drawing; using System.Drawing.Drawing2D; using System.Windows.Forms; namespace SmartCoalApplication.Core.CustomControl { /// /// 公共的快捷栏 /// 给各个弹窗用 /// public class CommonControlButtons : ScrollPanel { /// /// 放大按钮 /// public Button zoomInButton; /// /// 缩小按钮 /// public Button zoomOutButton; /// /// 合适大小 /// public Button zoomToWindowButton; /// /// 实际大小 /// public Button actualSizeButton; /// /// 指针模式 /// public Button pointerButton; /// /// 移动模式 /// public Button mobileModeButton; /// /// 是否导电布 /// public CheckBox isModeCheckBox; /// /// 透明度的TrackBar /// public TrackBar trackBar; /// /// 透明度的数值 /// public TextBox textBox; /// /// 位置 /// public int locationX = 5; /// /// 位置 /// public int locationRightX = 5; /// /// 左侧快捷工具的容器 /// private Panel panelLeft; /// /// hint 提示信息 /// public ToolTip toolTip; /// /// 第一张 /// public Button zoomInFirst; /// /// 上一张 /// public Button zoomInLast; /// /// 下一张 /// public Button zoomInNext; /// /// 最后一张 /// public Button zoomInZuihou; public CommonControlButtons(int x = 0) { locationRightX = x; InitializeComponent(); InitInternalControl(); } /// /// 创建内部组件 /// private void InitInternalControl() { // // 设置Panel属性 // this.Cursor = Cursors.Default; // // 左侧panel属性 // this.panelLeft = new Panel(); this.panelLeft.Dock = DockStyle.Left; this.panelLeft.AutoSize = true; // // 放大按钮 // this.zoomInButton = new Button(); 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.locationX += 20; this.zoomOutButton = new Button(); 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.locationX += 20; this.zoomToWindowButton = new Button(); 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.locationX += 20; this.actualSizeButton = new Button(); 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.locationX += 20; this.pointerButton = new Button(); this.pointerButton.Location = new Point(locationX, 5); this.pointerButton.Size = new Size(20, 20); this.pointerButton.Image = PdnResources.GetImageResource("Icons.MenuChoiseActionIcon.png").Reference; this.pointerButton.FlatStyle = FlatStyle.Flat; this.pointerButton.FlatAppearance.BorderSize = 0; // // 移动模式 // this.locationX += 20; this.mobileModeButton = new Button(); 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.locationX += 20; this.isModeCheckBox = new CheckBox(); this.isModeCheckBox.Location = new Point(locationX, 5); this.isModeCheckBox.Size = new Size(106, 20); this.isModeCheckBox.Name = "checkBoxisModeCheckBox"; this.isModeCheckBox.TabIndex = 3; this.isModeCheckBox.Text = "導電布"; this.isModeCheckBox.UseVisualStyleBackColor = true; this.isModeCheckBox.Visible = false; // // 放大缩小的TrackBar // this.locationX += 20; this.trackBar = new TrackBar(); this.trackBar.AutoSize = false; this.trackBar.Minimum = 0; 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.Visible = false; this.trackBar.Maximum = 255; // // 放大缩小的百分比 // this.locationX += 175; this.textBox = new TextBox(); this.textBox.Size = new Size(40, 20); this.textBox.Location = new Point(locationX, 5); this.textBox.Visible = false; // // // this.zoomInZuihou = new Button(); this.zoomInZuihou.Location = new Point(locationRightX, 5); this.zoomInZuihou.Size = new Size(20, 20); this.zoomInZuihou.Image = PdnResources.GetImageResource("Icons.HistoryFastForwardIcon.png").Reference; this.zoomInZuihou.FlatStyle = FlatStyle.Flat; this.zoomInZuihou.FlatAppearance.BorderSize = 0; // // // this.locationRightX -= 20; this.zoomInNext = new Button(); this.zoomInNext.Location = new Point(locationRightX, 5); this.zoomInNext.Size = new Size(20, 20); this.zoomInNext.Image = PdnResources.GetImageResource("Icons.next.ico").Reference; this.zoomInNext.FlatStyle = FlatStyle.Flat; this.zoomInNext.FlatAppearance.BorderSize = 0; // // // this.locationRightX -= 20; this.zoomInLast = new Button(); this.zoomInLast.Location = new Point(locationRightX, 5); this.zoomInLast.Size = new Size(20, 20); this.zoomInLast.Image = PdnResources.GetImageResource("Icons.last.ico").Reference; this.zoomInLast.FlatStyle = FlatStyle.Flat; this.zoomInLast.FlatAppearance.BorderSize = 0; // // // this.locationRightX -= 20; this.zoomInFirst = new Button(); this.zoomInFirst.Location = new Point(locationRightX, 5); this.zoomInFirst.Size = new Size(20, 20); this.zoomInFirst.Image = PdnResources.GetImageResource("Icons.HistoryRewindIcon.png").Reference; this.zoomInFirst.FlatStyle = FlatStyle.Flat; this.zoomInFirst.FlatAppearance.BorderSize = 0; // // 提示信息 // this.toolTip = new ToolTip(); this.toolTip.SetToolTip(this.zoomInButton, PdnResources.GetString("Menu.Edit.ZoomIn.Text")); this.toolTip.SetToolTip(this.zoomOutButton, PdnResources.GetString("CommonAction.ZoomOut")); this.toolTip.SetToolTip(this.zoomToWindowButton, PdnResources.GetString("Menu.Edit.ZoomToWindow.Text")); this.toolTip.SetToolTip(this.actualSizeButton, PdnResources.GetString("Menu.Edit.ActualSize.Text")); this.toolTip.SetToolTip(this.pointerButton, PdnResources.GetString("Menu.Pointertothemodel.text")); this.toolTip.SetToolTip(this.mobileModeButton, PdnResources.GetString("Menu.Mobilemodel.text")); this.toolTip.SetToolTip(this.zoomInLast,"上一张" ); this.toolTip.SetToolTip(this.zoomInNext, "下一张"); this.toolTip.SetToolTip(this.zoomInZuihou, "最后一张"); this.toolTip.SetToolTip(this.zoomInFirst, "第一张"); this.panelLeft.Controls.Add(this.zoomInButton); this.panelLeft.Controls.Add(this.zoomOutButton); this.panelLeft.Controls.Add(this.zoomToWindowButton); this.panelLeft.Controls.Add(this.actualSizeButton); this.panelLeft.Controls.Add(this.pointerButton); this.panelLeft.Controls.Add(this.mobileModeButton); this.panelLeft.Controls.Add(this.isModeCheckBox); this.panelLeft.Controls.Add(this.trackBar); this.panelLeft.Controls.Add(this.textBox); this.panelLeft.Controls.Add(this.zoomInZuihou); this.panelLeft.Controls.Add(this.zoomInNext); this.panelLeft.Controls.Add(this.zoomInLast); this.panelLeft.Controls.Add(this.zoomInFirst); this.Controls.Add(this.panelLeft); } public void ShowRight() { this.zoomInLast.Visible = true; this.zoomInNext.Visible = true; this.zoomInZuihou.Visible = true; this.zoomInFirst.Visible = true; } public void HideZoomToWindowAndActualSize() { this.zoomToWindowButton.Visible = false; this.actualSizeButton.Visible = false; this.pointerButton.Location = new Point(this.pointerButton.Location.X - 40, this.pointerButton.Location.Y); this.mobileModeButton.Location = new Point(this.mobileModeButton.Location.X - 40, this.mobileModeButton.Location.Y); this.isModeCheckBox.Location = new Point(this.isModeCheckBox.Location.X - 30, this.isModeCheckBox.Location.Y); } public void ShowCheckBox() { this.isModeCheckBox.Visible = true; } public void ShowIsFanweibuchang() { this.isModeCheckBox.Text = "范围补偿";// "範圍補償";// 范围补偿"; this.isModeCheckBox.Visible = true; } public void ShowIsErzhichuli() { this.isModeCheckBox.Text = "二值处理";// "範圍補償";// 范围补偿"; this.isModeCheckBox.Visible = true; } public void WithTrackBar() { this.zoomToWindowButton.Visible = false; this.actualSizeButton.Visible = false; this.trackBar.Visible = true; this.pointerButton.Location = new Point(this.pointerButton.Location.X - 40, this.pointerButton.Location.Y); this.mobileModeButton.Location = new Point(this.mobileModeButton.Location.X - 40, this.mobileModeButton.Location.Y); } public void reset(int right) { this.zoomInZuihou.Location = new Point(right, 5); this.zoomInNext.Location = new Point(right - 20, 5); this.zoomInLast.Location = new Point(right - 40, 5); this.zoomInFirst.Location = new Point(right - 60, 5); } #region 设计器 /// /// 必需的设计器变量。 /// private System.ComponentModel.IContainer components = null; /// /// 清理所有正在使用的资源。 /// /// 如果应释放托管资源,为 true;否则为 false。 protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region 组件设计器生成的代码 /// /// 设计器支持所需的方法 - 不要修改 /// 使用代码编辑器修改此方法的内容。 /// private void InitializeComponent() { components = new System.ComponentModel.Container(); } #endregion #endregion } }