using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using PaintDotNet.Base.SettingModel;
namespace PaintDotNet.Setting.LabelComponent
{
///
/// 标注设置-标记设置->点标记
///
public class LabelMarkPointControl : UserControl
{
#region 控件
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Panel panel1;
#endregion
///
/// 点标记样式
///
private LabelStyleModel.PointMark model;
PaintDotNet.ColorsForm colorsForm1;
///
/// 点样式下拉选
///
// string[] pointStyle = new string[] { PdnResources.GetString("Menu.LabelAction.ArrowAction.Text")
// , PdnResources.GetString("Menu.Set.Labelsettings.Dots.text")
// , PdnResources.GetString("Menu.Set.Labelsettings.triangle.text") };
public LabelMarkPointControl(LabelStyleModel.PointMark model)
{
this.model = model;
InitializeComponent();
InitializeControlData();
InitializeData();
}
///
/// 获取当前页面model值
///
///
public LabelStyleModel.PointMark getNowModel(LabelStyleModel.PointMark model)
{
model.pointStyle = this.comboBox1.SelectedIndex.ToString();
model.pointColor = Convert.ToInt32(this.panel1.BackColor.ToArgb());
return model;
}
///
/// 设置下拉等数据源
///
private void InitializeControlData()
{
//绑定点样式下拉选
this.comboBox1.DataSource = new BindingSource(InvariantData.someStyle, null);
this.comboBox1.DisplayMember = "Value";
this.comboBox1.ValueMember = "Key";
//this.comboBox1.DataSource = pointStyle;
}
///
/// 绑定样式数据
///
private void InitializeData()
{
this.comboBox1.SelectedIndex = int.Parse(this.model.pointStyle);
this.panel1.BackColor = Color.FromArgb(this.model.pointColor);
}
private void InitializeComponent()
{
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.panel1 = new System.Windows.Forms.Panel();
this.SuspendLayout();
//
// comboBox1
//
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(84, 4);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(152, 20);
this.comboBox1.TabIndex = 1;
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(4, 8);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(65, 12);
this.label1.TabIndex = 0;
this.label1.Text = PdnResources.GetString("Menu.Set.Labelsettings.Pointstyle.text")+":";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 34);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(65, 12);
this.label2.TabIndex = 2;
this.label2.Text = PdnResources.GetString("Menu.Set.Labelsettings.Pointcolor.text")+":";
//
// panel1
//
this.panel1.Location = new System.Drawing.Point(84, 31);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(152, 20);
this.panel1.TabIndex = 5;
this.panel1.Click += new System.EventHandler(this.panel1_Click);
//
// LabelMarkPointControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.panel1);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.label1);
this.Controls.Add(this.label2);
this.Name = "LabelMarkPointControl";
this.Size = new System.Drawing.Size(490, 205);
this.ResumeLayout(false);
this.PerformLayout();
this.colorsForm1 = new ColorsForm();
this.colorsForm1.StartPosition = FormStartPosition.CenterScreen;
this.colorsForm1.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
}
private void colorsFormUserPrimaryColorChanged(object sender, ColorEventArgs ce)
{
}
///
/// panel1画板点击
///
///
///
private void panel1_Click(object sender, EventArgs e)
{
this.colorsForm1.UserPrimaryColor = ColorBgra.FromColor(this.panel1.BackColor);
this.colorsForm1.setSaveBtn_Click(new System.EventHandler(this.panel1Changed));
this.colorsForm1.ShowDialog();
}
private void panel1Changed(object sender, EventArgs e)
{
this.panel1.BackColor = this.colorsForm1.UserPrimaryColor.ToColor();
this.colorsForm1.Close();
}
}
}