using System;
using System.Drawing;
using System.Windows.Forms;
using PaintDotNet.Setting.LabelComponent;
using PaintDotNet.Base.SettingModel;
namespace PaintDotNet.ImageCollect.CameraPreviewComponent.Properties
{
internal class PropertiesSettingDialog : FloatingToolForm
{
#region
///
/// Required designer variable.
///
private System.ComponentModel.IContainer components = null;
///
/// Clean up any resources being used.
///
/// true if managed resources should be disposed; otherwise, false.
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
private void InitializeLanguageText()
{
this.groupBox1.Text = PdnResources.GetString("Menu.Type.text");
this.button4.Text = PdnResources.GetString("Menu.ImageCollection.CameraConventional.Text");
this.button3.Text = PdnResources.GetString("Menu.ImageCollection.CameraFrame.Text");
this.button2.Text = PdnResources.GetString("Menu.Image.Adjust.Text");
this.button1.Text = PdnResources.GetString("Menu.display.text");
this.groupBox2.Text = PdnResources.GetString("Menu.Setting.Text");
this.btnReset.Text = PdnResources.GetString("Menu.imagecapture.Previewwindow.init.text");
this.btnClose.Text = PdnResources.GetString("Menu.File.Close.Text");
this.Text = PdnResources.GetString("Menu.imagecapture.Previewwindow.Previewwindoperties.text");
}
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.btnClose = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.btnReset = new System.Windows.Forms.Button();
this.controlPanel = new System.Windows.Forms.Panel();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.btnClose);
this.groupBox1.Controls.Add(this.button4);
this.groupBox1.Controls.Add(this.button3);
this.groupBox1.Controls.Add(this.button2);
this.groupBox1.Controls.Add(this.button1);
this.groupBox1.Location = new System.Drawing.Point(9, 10);
this.groupBox1.Margin = new System.Windows.Forms.Padding(2);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(2);
this.groupBox1.Size = new System.Drawing.Size(97, 502);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
//
// btnClose
//
this.btnClose.Location = new System.Drawing.Point(12, 466);
this.btnClose.Margin = new System.Windows.Forms.Padding(2);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(61, 30);
this.btnClose.TabIndex = 3;
this.btnClose.Text = "关闭";
this.btnClose.UseVisualStyleBackColor = true;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
//
// button4
//
this.button4.Location = new System.Drawing.Point(12, 169);
this.button4.Margin = new System.Windows.Forms.Padding(2);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(61, 26);
this.button4.TabIndex = 6;
this.button4.Text = "常规";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(12, 125);
this.button3.Margin = new System.Windows.Forms.Padding(2);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(61, 26);
this.button3.TabIndex = 5;
this.button3.Text = "边框";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(12, 84);
this.button2.Margin = new System.Windows.Forms.Padding(2);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(61, 25);
this.button2.TabIndex = 4;
this.button2.Text = "调节";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(12, 42);
this.button1.Margin = new System.Windows.Forms.Padding(2);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(61, 26);
this.button1.TabIndex = 3;
this.button1.Text = "显示";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// groupBox2
//
this.groupBox2.Controls.Add(this.btnReset);
this.groupBox2.Location = new System.Drawing.Point(124, 10);
this.groupBox2.Margin = new System.Windows.Forms.Padding(2);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Padding = new System.Windows.Forms.Padding(2);
this.groupBox2.Size = new System.Drawing.Size(463, 60);
this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false;
//
// btnReset
//
this.btnReset.Location = new System.Drawing.Point(384, 19);
this.btnReset.Margin = new System.Windows.Forms.Padding(2);
this.btnReset.Name = "btnReset";
this.btnReset.Size = new System.Drawing.Size(64, 30);
this.btnReset.TabIndex = 0;
this.btnReset.Text = "初始化";
this.btnReset.UseVisualStyleBackColor = true;
this.btnReset.Click += new System.EventHandler(this.btnReset_Click);
//
// controlPanel
//
this.controlPanel.AutoScroll = true;
this.controlPanel.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.controlPanel.Location = new System.Drawing.Point(110, 74);
this.controlPanel.Margin = new System.Windows.Forms.Padding(2);
this.controlPanel.Name = "controlPanel";
this.controlPanel.Size = new System.Drawing.Size(511, 437);
this.controlPanel.TabIndex = 2;
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Interval = 500;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// PropertiesSettingDialog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(630, 530);
this.Controls.Add(this.controlPanel);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Margin = new System.Windows.Forms.Padding(2);
this.Name = "PropertiesSettingDialog";
this.Text = "预览窗口-属性";
this.Load += new System.EventHandler(this.PropertiesSettingDialog_Load);
this.Controls.SetChildIndex(this.groupBox1, 0);
this.Controls.SetChildIndex(this.groupBox2, 0);
this.Controls.SetChildIndex(this.controlPanel, 0);
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button btnReset;
private System.Windows.Forms.Panel controlPanel;
private System.Windows.Forms.Button btnClose;
#endregion
///
/// 相机参数
///
public CameraParamModel m_cameraParamModel = Startup.instance.cameraParamModel;
//各页面组件
public DisplayCameraControl displayCameraControl;
private AdjustContainer adjustCameraControl;
private FrameCameraControl frameCameraControl;
private CommonCameraControl commonCameraControl;
private Timer timer1;
private Form m_parent;
public PropertiesSettingDialog(Form parent)
{
m_parent = parent;
displayCameraControl = new DisplayCameraControl(m_cameraParamModel, true);
displayCameraControl.Location = new Point(0, 0);
adjustCameraControl = new AdjustContainer();
adjustCameraControl.Initialize(m_cameraParamModel, true);
adjustCameraControl.Location = new Point(0, 0);
frameCameraControl = new FrameCameraControl(m_cameraParamModel, true);
frameCameraControl.Location = new Point(0, 0);
commonCameraControl = new CommonCameraControl();
commonCameraControl.Location = new Point(0, 0);
InitializeComponent();
InitializeLanguageText();
this.FormClosing += (s, e) =>
{
frameCameraControl.Dispose();
//adjustCameraControl.Dispose();
};
button1_Click(null, null);
}
///
/// 设置直方图的图像
///
///
public void resetMat(OpenCvSharp.Mat mat)
{
displayCameraControl.resetMat(mat);
}
private void button1_Click(object sender, EventArgs e)
{
this.controlPanel.Controls.Clear();
displayCameraControl.Location = new Point(0, 0);
this.controlPanel.Controls.Add(displayCameraControl);
}
private void button2_Click(object sender, EventArgs e)
{
this.controlPanel.Controls.Clear();
this.controlPanel.Controls.Add(adjustCameraControl);
}
private void button3_Click(object sender, EventArgs e)
{
this.controlPanel.Controls.Clear();
frameCameraControl.Location = new Point(0, 0);
this.controlPanel.Controls.Add(frameCameraControl);
}
private void button4_Click(object sender, EventArgs e)
{
this.controlPanel.Controls.Clear();
commonCameraControl.Location = new Point(0, 0);
this.controlPanel.Controls.Add(commonCameraControl);
}
private void btnClose_Click(object sender, EventArgs e)
{
this.Close();
this.Dispose();
}
private void btnReset_Click(object sender, EventArgs e)
{
CameraConfigs cameraConfig = CameraConfigs.GetInstance();
Startup.instance.cameraParamModel = cameraConfig.GetCurrentCameraParamModel();
m_cameraParamModel = Startup.instance.cameraParamModel;
if (displayCameraControl != null)
{
displayCameraControl.ResetCameraParamModel(m_cameraParamModel);
}
if (frameCameraControl != null)
{
frameCameraControl.ResetCameraParamModel(m_cameraParamModel);
}
if (commonCameraControl != null)
{
commonCameraControl.Initialize(m_cameraParamModel);
}
if (m_parent != null/* && !m_parent.IsDisposed*/)
{
((CameraPreviewDialog)m_parent).InitializeData();
}
}
private void PropertiesSettingDialog_Load(object sender, EventArgs e)
{
commonCameraControl.Initialize(m_cameraParamModel, true);
}
private void timer1_Tick(object sender, EventArgs e)
{
adjustCameraControl.UpdateDisplay();
}
}
}