using System; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; using PaintDotNet.Base.Functionodel; namespace PaintDotNet.CustomControl { /// /// 画板底部快捷栏 右侧的多图/多相封装 /// public partial class PanelBottomRight : Panel { /// /// 从后往前播放模式 /// public Button play1Button; /// /// 从前往后播放模式 /// public Button play2Button; /// /// 循环播放模式 /// public Button play3Button; /// /// 播放(暂停) /// public Button playOrPauseButton; /// /// 删除当前显示页 /// public Button deleteButton; /// /// 修改播放时间间隔 /// public Button editTimeButton; /// /// 播放滑动滚动条 /// public TriangleTrackBar trackBar; /// /// 当前第几页,一共多少页 /// public TextBox textBox; /// /// hint 提示信息 /// public ToolTip toolTip; /// /// 位置 /// public int locationX = 5; /// /// 左侧快捷工具的容器 /// private Panel panelLeft; /// /// 显示多图/多相,ture为显示多图 /// private bool showPictures = false; /// /// 目前被改成tab的菜单了 /// public DocumentBottomStrip documentStrip; public bool ShowPictures { get { return this.showPictures; } set { this.showPictures = value; this.documentStrip.Visible = !this.showPictures; this.panelLeft.Visible = this.showPictures; } } /// /// 初始化方法 /// 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); } /// /// 初始化多相UI /// /// public void AddPhase(List 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> ItemCheckChanged; private void OnItemCheckChanged(int index) { if (ItemCheckChanged != null) { ItemCheckChanged(this, new EventArgs(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); } } /// /// 创建内部组件 /// 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); } /// /// 图片选择改变 /// /// /// private void trackBar_Scroll(object sender, EventArgs e) { this.textBox.Text = trackBar.Value + @"/" + trackBar.Maximum; } } }