using PaintDotNet.SystemLayer;
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace PaintDotNet.CustomControl
{
///
/// 公共的快捷栏
/// 给各个弹窗用
///
public class GeneralAnalysisCommonControlButtons : ScrollPanel
{
///
/// 放大按钮
///
public Button zoomInButton;
///
/// 缩小按钮
///
public Button zoomOutButton;
///
/// 合适大小
///
public Button zoomToWindowButton;
///
/// 实际大小
///
public Button actualSizeButton;
///
/// 指针模式
///
public Button pointerButton;
///
/// 移动模式
///
public Button mobileModeButton;
///
/// 透明度的TrackBar
///
public TrackBar trackBar;
public Label trackLabel;
///
/// 透明度的数值
///
public TextBox textBox;
public Label demoLabel;
///
/// 位置
///
public int locationX = 5;
///
/// 左侧快捷工具的容器
///
private Panel panelLeft;
///
/// hint 提示信息
///
public ToolTip toolTip;
public GeneralAnalysisCommonControlButtons()
{
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.MoveSelectionToolIcon.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;
//
// 放大缩小的TrackBar
//
this.locationX += 20;
this.trackLabel = new Label();
this.trackLabel.Location = new Point(locationX, 5);
this.trackLabel.Size = new Size(80, 20);
this.trackLabel.Visible = false;
this.locationX += 80;
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.Visible = false;
//
// 放大缩小的百分比
//
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.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.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.trackLabel);
this.panelLeft.Controls.Add(this.trackBar);
this.panelLeft.Controls.Add(this.textBox);
this.Controls.Add(this.panelLeft);
}
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);
}
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);
this.trackLabel.Visible = true;
}
#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
}
}