using PaintDotNet.Camera; using PaintDotNet.ImageCollect; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace PaintDotNet.Preview2 { public class GrayModeControl : UserControl { private RadioButton radioButton2; private RadioButton radioButton1; private GroupBox groupBox1; public GrayModeControl() { InitializeComponent(); InitializeLanguageText(); } private void InitializeComponent() { this.groupBox1 = new System.Windows.Forms.GroupBox(); this.radioButton2 = new System.Windows.Forms.RadioButton(); this.radioButton1 = new System.Windows.Forms.RadioButton(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // // groupBox1 // this.groupBox1.Controls.Add(this.radioButton2); this.groupBox1.Controls.Add(this.radioButton1); this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill; this.groupBox1.Location = new System.Drawing.Point(0, 8); this.groupBox1.Name = "groupBox1"; this.groupBox1.Padding = new System.Windows.Forms.Padding(4); this.groupBox1.Size = new System.Drawing.Size(262, 47); this.groupBox1.TabIndex = 0; this.groupBox1.TabStop = false; this.groupBox1.Text = "黑白/彩色"; // // radioButton2 // this.radioButton2.AutoSize = true; this.radioButton2.BackColor = System.Drawing.Color.Transparent; this.radioButton2.Location = new System.Drawing.Point(121, 21); this.radioButton2.Name = "radioButton2"; this.radioButton2.Size = new System.Drawing.Size(71, 16); this.radioButton2.TabIndex = 1; this.radioButton2.TabStop = true; this.radioButton2.Text = "彩色图像"; this.radioButton2.UseVisualStyleBackColor = false; this.radioButton2.Click += new System.EventHandler(this.radioButton2_Click); // // radioButton1 // this.radioButton1.AutoSize = true; this.radioButton1.BackColor = System.Drawing.Color.Transparent; this.radioButton1.Location = new System.Drawing.Point(7, 21); this.radioButton1.Name = "radioButton1"; this.radioButton1.Size = new System.Drawing.Size(71, 16); this.radioButton1.TabIndex = 0; this.radioButton1.TabStop = true; this.radioButton1.Text = "黑白图像"; this.radioButton1.UseVisualStyleBackColor = false; this.radioButton1.Click += new System.EventHandler(this.radioButton1_Click); // // GrayModeControl // this.Controls.Add(this.groupBox1); this.Name = "GrayModeControl"; this.Padding = new System.Windows.Forms.Padding(0, 8, 0, 0); this.Size = new System.Drawing.Size(262, 55); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.ResumeLayout(false); } private void InitializeLanguageText() { this.groupBox1.Text = PdnResources.GetString("ColorDisplayWidget.BlackAndWhiteIconBox.ToolTipText") + "/" + PdnResources.GetString("Preview2Setting.colour"); this.radioButton2.Text = PdnResources.GetString("Preview2Setting.colour") +" " + PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.image.text"); this.radioButton1.Text = PdnResources.GetString("ColorDisplayWidget.BlackAndWhiteIconBox.ToolTipText") + " " + PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.image.text"); } public void Initialize() { radioButton1.Checked = CameraConfigs.Settings.Monochromatic == 1; radioButton2.Checked = CameraConfigs.Settings.Monochromatic == 0; } private void radioButton1_Click(object sender, EventArgs e) { CameraManager.CurrentCamera.GrayMode = 1; CameraConfigs.Settings.Monochromatic = 1; } private void radioButton2_Click(object sender, EventArgs e) { CameraManager.CurrentCamera.GrayMode = 0; CameraConfigs.Settings.Monochromatic = 0; } } }