using Resources; using SmartCoalApplication.Base; using SmartCoalApplication.SystemLayer; using System; using System.Drawing; using System.Drawing.Drawing2D; using System.Windows.Forms; namespace SmartCoalApplication.Core.CustomControl { /// /// 画板底部的快捷栏 /// 非公共,每个DocumentWorkspace自己保持自己的 /// public class PanelBottom : ScrollPanel { ///// ///// 最佳 ///// //public MyFlatButton bestButton; ///// ///// 最大最小 ///// //public MyFlatButton maxMinButton; ///// ///// 原始状态 ///// //public MyFlatButton originButton; ///// ///// 伽马0.45 ///// //public MyFlatButton gamma45Button; ///// ///// 网格 ///// //public MyFlatButton gridButton; ///// ///// 辅助线 ///// //public MyFlatButton auxiliaryLineButton; ///// ///// 水平镜像 ///// //public MyFlatButton horizontalMirroringButton; ///// ///// 垂直镜像 ///// //public MyFlatButton verticalMirrorButton; ///// ///// 中心镜像 ///// //public MyFlatButton centerMirrorButton; ///// ///// 移动模式 ///// //public MyFlatButton mobileModeButton; ///// ///// 指针模式 ///// //public MyFlatButton cursorModeButton; ///// ///// 实际大小 ///// //public MyFlatButton actualSizeButton; ///// ///// 合适大小 ///// //public MyFlatButton zoomToWindowButton; ///// ///// 定倍显示 ///// //public MyFlatButton fixedTimesButton; ///// ///// 锁定扩缩 ///// //public MyFlatButton lockdownButton; /// /// 缩小按钮 /// public MyFlatButton zoomOutButton; /// /// 放大按钮 /// public MyFlatButton zoomInButton; /// /// 放大缩小的TrackBar /// public TrackBar trackBar; /// /// 放大缩小的百分比 /// public TextBox textBox; /// /// 另一个百分比,可能是比原始图片的倍数 /// public TextBox textBox1; /// /// 透明度的TrackBar /// //public TrackBar transparencyTrackBar; /// /// hint 提示信息 /// public ToolTip toolTip; /// /// 位置 /// public int locationX = 5; /// /// 左侧快捷工具的容器 /// private Panel panelLeft; /// /// 目前被改成tab的菜单了 /// 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.Controls.Add(this.documentStrip); } /// /// 缩小按钮 /// /// /// 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); } } /// /// 缩小按钮 /// /// /// 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); } } /// /// 放大按钮 /// /// /// 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); } } /// /// 放大按钮 /// /// /// 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); } } /// /// 给DocumentView的事件,用于相的选中和取消 /// public event EventHandler> ItemICheckChanged; private void OnItemICheckChanged(int index) { if (ItemICheckChanged != null) { ItemICheckChanged(this, new EventArgs(index)); } } private void ItemCheckChanged(object sender, EventArgs e) { OnItemICheckChanged(e.Data); } /// /// 创建内部组件 /// private void InitInternalControl() { // // 设置Panel属性 // this.Cursor = Cursors.Default; // // 左侧panel属性 // this.panelLeft = new Panel(); this.panelLeft.Dock = DockStyle.Left; this.panelLeft.AutoSize = true; // // 缩小按钮 // 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.zoomOutButton, PdnResources.GetString("CommonAction.ZoomOut")); this.toolTip.SetToolTip(this.zoomInButton, PdnResources.GetString("CommonAction.ZoomIn")); this.toolTip.ShowAlways = true; 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 设计器 /// /// 必需的设计器变量。 /// 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 } }