123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350 |
- 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
- {
- /// <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.Controls.Add(this.documentStrip);
- }
- /// <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.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 设计器
- /// <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
- }
- }
|