| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313 | using System;using System.Collections.Generic;using System.Drawing;using System.Windows.Forms;using PaintDotNet.Base.Functionodel;namespace PaintDotNet.CustomControl{    /// <summary>    /// 画板底部快捷栏 右侧的多图/多相封装    /// </summary>    public partial class PanelBottomRight : Panel    {        /// <summary>        /// 从后往前播放模式        /// </summary>        public Button play1Button;        /// <summary>        /// 从前往后播放模式        /// </summary>        public Button play2Button;        /// <summary>        /// 循环播放模式        /// </summary>        public Button play3Button;        /// <summary>        /// 播放(暂停)        /// </summary>        public Button playOrPauseButton;        /// <summary>        /// 删除当前显示页        /// </summary>        public Button deleteButton;        /// <summary>        /// 修改播放时间间隔        /// </summary>        public Button editTimeButton;        /// <summary>        /// 播放滑动滚动条        /// </summary>        public TriangleTrackBar trackBar;        /// <summary>        /// 当前第几页,一共多少页        /// </summary>        public TextBox textBox;        /// <summary>        /// hint 提示信息        /// </summary>        public ToolTip toolTip;        /// <summary>        /// 位置        /// </summary>        public int locationX = 5;        /// <summary>        /// 左侧快捷工具的容器        /// </summary>        private Panel panelLeft;        /// <summary>        /// 显示多图/多相,ture为显示多图        /// </summary>        private bool showPictures = false;        /// <summary>        /// 目前被改成tab的菜单了        /// </summary>        public DocumentBottomStrip documentStrip;        public bool ShowPictures        {            get            {                return this.showPictures;            }            set            {                this.showPictures = value;                this.documentStrip.Visible = !this.showPictures;                this.panelLeft.Visible = this.showPictures;            }        }        /// <summary>        /// 初始化方法        /// </summary>        public PanelBottomRight()        {            InitializeComponent();            InitInternalControl();            this.documentStrip = new DocumentBottomStrip();            //            // documentStrip            //            this.documentStrip.AutoSize = false;            this.documentStrip.Name = "DocumentBottomStrip";            this.documentStrip.TabIndex = 5;            //设置是否多选模式            this.documentStrip.AllowMultiChoise = true;// false;            //this.documentStrip.DocumentListChanged += new EventHandler(DocumentStrip_DocumentListChanged);            //this.documentStrip.DocumentClicked += DocumentStrip_DocumentClicked;            this.documentStrip.ManagedFocus = false;// true;            this.documentStrip.Location = new Point(0, 0);            this.documentStrip.Size = new Size(200, 20);            this.documentStrip.Dock = DockStyle.Fill;// Right;            this.documentStrip.Visible = false;// !this.showPictures;            this.Controls.Add(this.documentStrip);        }        /// <summary>        /// 初始化多相UI        /// </summary>        /// <param name="PhaseModels"></param>        public void AddPhase(List<PhaseModel> PhaseModels)        {            ClearPhase();            if (PhaseModels!=null && PhaseModels.Count > 0)            {                for(int i=0; i< PhaseModels.Count; i++)                {                    this.documentStrip.AddTextBox(PhaseModels[i].name, Color.FromArgb(PhaseModels[i].color), PhaseModels[i].choise);                    this.documentStrip.Items[i].CheckChanged += new EventHandler(this.Items_CheckChange);                }            }            this.Refresh();        }        public void ClearPhase()        {            this.documentStrip.ClearTextBox();        }        public event EventHandler<EventArgs<int>> ItemCheckChanged;        private void OnItemCheckChanged(int index)        {            if (ItemCheckChanged != null)            {                ItemCheckChanged(this, new EventArgs<int>(index));            }        }        private void Items_CheckChange(object sender, EventArgs e)        {            IBottomNameStrip.Item item = (IBottomNameStrip.Item)sender;            if (item != null)            {                int index = int.Parse(item.Tag.ToString());                OnItemCheckChanged(index);            }        }        /// <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 += 20;            this.trackBar = new TriangleTrackBar();            this.trackBar.AutoSize = false;            this.trackBar.Minimum = 1;            this.trackBar.Name = "amountTrackBar";            this.trackBar.Location = new Point(locationX, 0);            this.trackBar.Size = new Size(175, 30);            this.trackBar.Minimum = 1;            this.trackBar.Maximum = 500;            this.trackBar.Value = 150;            this.trackBar.TrackBarScroll += new System.EventHandler(this.trackBar_Scroll);            //this.trackBar.SmallChange = 1;            //this.trackBar.TickStyle = TickStyle.None;            ////this.trackBar.Value = 100;            this.trackBar.trackBar1.Location = new System.Drawing.Point(10, 6);            this.trackBar.trackBar1.Size = new System.Drawing.Size(155, 19);            //            // 当前第几页,一共多少页            //            this.locationX += 175;            this.textBox = new TextBox();            this.textBox.Enabled = false;            this.textBox.TextAlign = HorizontalAlignment.Center;            this.textBox.Size = new Size(60, 20);            this.textBox.Location = new Point(locationX, 5);            this.textBox.Text = "150/500";            this.locationX += 60 + 5;// + 5;            //            // 从后往前播放            //            this.play1Button = new Button();            this.play1Button.Location = new Point(locationX, 5);            this.play1Button.Size = new Size(20, 20);            this.play1Button.Image = PdnResources.GetImageResource("Icons.MultiFromAfterPlayIcon.png").Reference;            this.play1Button.FlatStyle = FlatStyle.Flat;            this.play1Button.FlatAppearance.BorderSize = 0;            //            // 从前往后播放            //            this.locationX += 20;            this.play2Button = new Button();            this.play2Button.Location = new Point(locationX, 5);            this.play2Button.Size = new Size(20, 20);            this.play2Button.Image = PdnResources.GetImageResource("Icons.MultiFromBehindPlayIcon.png").Reference;            this.play2Button.FlatStyle = FlatStyle.Flat;            this.play2Button.FlatAppearance.BorderSize = 0;            //            // 循环播放            //            this.locationX += 20;            this.play3Button = new Button();            this.play3Button.Location = new Point(locationX, 5);            this.play3Button.Size = new Size(20, 20);            this.play3Button.Image = PdnResources.GetImageResource("Icons.MultiCirclePlayIcon.png").Reference;            this.play3Button.FlatStyle = FlatStyle.Flat;            this.play3Button.FlatAppearance.BorderSize = 0;            //            // 播放(暂停) 备注:这里需要判断显示播放/暂停            //            this.locationX += 20;            this.playOrPauseButton = new Button();            this.playOrPauseButton.Location = new Point(locationX, 5);            this.playOrPauseButton.Size = new Size(20, 20);            this.playOrPauseButton.Image = PdnResources.GetImageResource("Icons.MultiNowPlayIcon.png").Reference;            this.playOrPauseButton.FlatStyle = FlatStyle.Flat;            this.playOrPauseButton.FlatAppearance.BorderSize = 0;            //            // 删除当前显示页            //            this.locationX += 20;            this.deleteButton = new Button();            this.deleteButton.Location = new Point(locationX, 5);            this.deleteButton.Size = new Size(20, 20);            this.deleteButton.Image = PdnResources.GetImageResource("Icons.MultiNowDeleteIcon.png").Reference;            this.deleteButton.FlatStyle = FlatStyle.Flat;            this.deleteButton.FlatAppearance.BorderSize = 0;            //            // 修改播放时间间隔            //            this.locationX += 20;            this.editTimeButton = new Button();            this.editTimeButton.Location = new Point(locationX, 5);            this.editTimeButton.Size = new Size(20, 20);            this.editTimeButton.Image = PdnResources.GetImageResource("Icons.MultiChangeTimeIcon.png").Reference;            this.editTimeButton.FlatStyle = FlatStyle.Flat;            this.editTimeButton.FlatAppearance.BorderSize = 0;            ////            //// 播放滑动滚动条            ////            this.locationX += 20;            //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 + 5;            //            // 提示信息            //            this.toolTip = new ToolTip();            this.toolTip.SetToolTip(this.play1Button, PdnResources.GetString("Menu.Playitbackwards.text"));            this.toolTip.SetToolTip(this.play2Button, PdnResources.GetString("Menu.Playbackandforth.text"));            this.toolTip.SetToolTip(this.play3Button, PdnResources.GetString("Menu.Loopfor.text"));            this.toolTip.SetToolTip(this.playOrPauseButton, PdnResources.GetString("Menu.Playpause.text"));            this.toolTip.SetToolTip(this.deleteButton, PdnResources.GetString("Menu.Deletethecurrentdisplaypage.text"));            this.toolTip.SetToolTip(this.editTimeButton, PdnResources.GetString("Menu.Modifytheplaybackinterval.text"));            this.panelLeft.Visible = false;// this.showPictures;            this.panelLeft.Controls.Add(this.play1Button);            this.panelLeft.Controls.Add(this.play2Button);            this.panelLeft.Controls.Add(this.play3Button);            this.panelLeft.Controls.Add(this.playOrPauseButton);            this.panelLeft.Controls.Add(this.deleteButton);            this.panelLeft.Controls.Add(this.editTimeButton);            this.panelLeft.Controls.Add(this.trackBar);            this.panelLeft.Controls.Add(this.textBox);            this.Controls.Add(this.panelLeft);        }        /// <summary>        /// 图片选择改变        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void trackBar_Scroll(object sender, EventArgs e)        {            this.textBox.Text = trackBar.Value + @"/" + trackBar.Maximum;        }    }}
 |