123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227 |
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Drawing;
- using System.IO.Ports;
- using System.Windows.Forms;
- using PaintDotNet.Base.CommTool;
- using PaintDotNet.CustomControl;
- using PaintDotNet.GeneralAnalysis.Countometer;
- using PaintDotNet.ImageCollect;
- using PaintDotNet.Base.SettingModel;
- using StageController;
- using StageController.M3H;
- using PaintDotNet.Hardware;
- namespace PaintDotNet.GeneralAnalysis
- {
- /// <summary>
- /// 积数仪
- /// </summary>
- internal class GeneralCountometerDialog : FloatingToolForm
- {
- #region 控件相关
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.Button btnShowHistory;
- private System.Windows.Forms.Button btnSave;
- private System.Windows.Forms.Button btnHotKey;
- private System.Windows.Forms.Button btnAssay;
- private System.Windows.Forms.Button btnPreView;
- private System.Windows.Forms.Button btnSetting;
- private System.Windows.Forms.GroupBox groupBox2;
- private System.Windows.Forms.GroupBox groupBox3;
- private System.Windows.Forms.Label lblSummation;
- private System.Windows.Forms.DataGridView dgvKeyList;
- private System.Windows.Forms.GroupBox groupBox4;
- private System.Windows.Forms.GroupBox groupBox5;
- private System.Windows.Forms.GroupBox groupBox6;
- private System.Windows.Forms.Button btnTissueAdd;
- private System.Windows.Forms.Button btnTissueEdit;
- private System.Windows.Forms.Button btnTissueDelete;
- private System.Windows.Forms.ListBox lstTissuesList;
- private System.Windows.Forms.Panel panel1;
- private System.Windows.Forms.Label lblNull;
- private System.Windows.Forms.Panel panel2;
- private System.Windows.Forms.DataGridViewTextBoxColumn hotKey;
- private System.Windows.Forms.DataGridViewTextBoxColumn name;
- private System.Windows.Forms.DataGridViewTextBoxColumn count;
- private System.Windows.Forms.DataGridViewTextBoxColumn ratio;
- private System.ComponentModel.IContainer components;
- private System.Windows.Forms.DataVisualization.Charting.Chart chart1;
- private System.Windows.Forms.ToolTip toolTip1;
- private void InitializeLanguageText()
- {
- this.lblNull.Text = PdnResources.GetString("Menu.Generalanalysis.Integrator.Nostatistics.text");
- this.groupBox5.Text = PdnResources.GetString("Menu.Generalanalysis.Integrator.X,Yaxiscontrol.text");
- this.groupBox6.Text = PdnResources.GetString("Menu.Generalanalysis.Integrator.imitatelensarea.text");
- this.Text = PdnResources.GetString("Menu.GeneralAnalysis.Countometer.Text");
- this.lblSummation.Text = PdnResources.GetString("Menu.Generalanalysis.Integrator.total.text") + ":0";
- this.hotKey.HeaderText = PdnResources.GetString("Menu.icon.text");
- this.name.HeaderText = PdnResources.GetString("Menu.name.text");
- this.count.HeaderText = PdnResources.GetString("Menu.Generalanalysis.Integrator.Quantity.text");
- this.ratio.HeaderText = PdnResources.GetString("Menu.proportion.text");
- this.groupBox4.Text = PdnResources.GetString("Menu.Organizationinformation.text");
- this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
- this.btnShowHistory.Text = PdnResources.GetString("Menu.Generalanalysis.Integrator.HistoryView.text");
- this.btnSave.Text = PdnResources.GetString("Menu.File.Save.Text");
- this.btnHotKey.Text = PdnResources.GetString("Menu.Generalanalysis.Integrator.Definekey.text");
- this.btnAssay.Text = PdnResources.GetString("Menu.Generalanalysis.Integrator.ensure.text");
- this.btnPreView.Text = PdnResources.GetString("Menu.Preview.text");
- this.btnSetting.Text = PdnResources.GetString("Menu.Setting.Text");
- this.groupBox2.Text = PdnResources.GetString("Menu.Generalanalysis.Integrator.Measuringtissue.text");
- this.groupBox3.Text = PdnResources.GetString("Menu.Organizationinformation.text");
- }
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
- System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
- System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.btnShowHistory = new System.Windows.Forms.Button();
- this.btnSave = new System.Windows.Forms.Button();
- this.btnHotKey = new System.Windows.Forms.Button();
- this.btnAssay = new System.Windows.Forms.Button();
- this.btnPreView = new System.Windows.Forms.Button();
- this.btnSetting = new System.Windows.Forms.Button();
- this.groupBox2 = new System.Windows.Forms.GroupBox();
- this.lstTissuesList = new System.Windows.Forms.ListBox();
- this.btnTissueEdit = new System.Windows.Forms.Button();
- this.btnTissueDelete = new System.Windows.Forms.Button();
- this.btnTissueAdd = new System.Windows.Forms.Button();
- this.groupBox3 = new System.Windows.Forms.GroupBox();
- this.lblSummation = new System.Windows.Forms.Label();
- this.dgvKeyList = new System.Windows.Forms.DataGridView();
- this.hotKey = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.name = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.count = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.ratio = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.groupBox4 = new System.Windows.Forms.GroupBox();
- this.lblNull = new System.Windows.Forms.Label();
- this.groupBox5 = new System.Windows.Forms.GroupBox();
- this.panel1 = new System.Windows.Forms.Panel();
- this.groupBox6 = new System.Windows.Forms.GroupBox();
- this.panel2 = new System.Windows.Forms.Panel();
- this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
- this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart();
- this.groupBox1.SuspendLayout();
- this.groupBox2.SuspendLayout();
- this.groupBox3.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.dgvKeyList)).BeginInit();
- this.groupBox4.SuspendLayout();
- this.groupBox5.SuspendLayout();
- this.groupBox6.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit();
- this.SuspendLayout();
- //
- // groupBox1
- //
- this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox1.Controls.Add(this.btnShowHistory);
- this.groupBox1.Controls.Add(this.btnSave);
- this.groupBox1.Controls.Add(this.btnHotKey);
- this.groupBox1.Controls.Add(this.btnAssay);
- this.groupBox1.Controls.Add(this.btnPreView);
- this.groupBox1.Controls.Add(this.btnSetting);
- this.groupBox1.Location = new System.Drawing.Point(12, 12);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(1216, 79);
- this.groupBox1.TabIndex = 2;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "操作";
- //
- // btnShowHistory
- //
- this.btnShowHistory.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.btnShowHistory.Location = new System.Drawing.Point(905, 24);
- this.btnShowHistory.Name = "btnShowHistory";
- this.btnShowHistory.Size = new System.Drawing.Size(96, 37);
- this.btnShowHistory.TabIndex = 5;
- this.btnShowHistory.Text = "历史查看";
- this.btnShowHistory.UseVisualStyleBackColor = true;
- this.btnShowHistory.Click += new System.EventHandler(this.btnShowHistory_Click);
- //
- // btnSave
- //
- this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.btnSave.Location = new System.Drawing.Point(808, 24);
- this.btnSave.Name = "btnSave";
- this.btnSave.Size = new System.Drawing.Size(96, 37);
- this.btnSave.TabIndex = 4;
- this.btnSave.Text = "保存";
- this.btnSave.UseVisualStyleBackColor = true;
- this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
- //
- // btnHotKey
- //
- this.btnHotKey.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.btnHotKey.Location = new System.Drawing.Point(711, 24);
- this.btnHotKey.Name = "btnHotKey";
- this.btnHotKey.Size = new System.Drawing.Size(96, 37);
- this.btnHotKey.TabIndex = 3;
- this.btnHotKey.Text = "定义键";
- this.btnHotKey.UseVisualStyleBackColor = true;
- this.btnHotKey.Click += new System.EventHandler(this.btnHotKey_Click);
- //
- // btnAssay
- //
- this.btnAssay.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.btnAssay.Location = new System.Drawing.Point(614, 24);
- this.btnAssay.Name = "btnAssay";
- this.btnAssay.Size = new System.Drawing.Size(96, 37);
- this.btnAssay.TabIndex = 2;
- this.btnAssay.Text = "测定";
- this.btnAssay.UseVisualStyleBackColor = true;
- this.btnAssay.Click += new System.EventHandler(this.btnAssay_Click);
- //
- // btnPreView
- //
- this.btnPreView.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.btnPreView.Location = new System.Drawing.Point(1099, 24);
- this.btnPreView.Name = "btnPreView";
- this.btnPreView.Size = new System.Drawing.Size(96, 37);
- this.btnPreView.TabIndex = 1;
- this.btnPreView.Text = "预览";
- this.btnPreView.UseVisualStyleBackColor = true;
- this.btnPreView.Click += new System.EventHandler(this.btnPreView_Click);
- //
- // btnSetting
- //
- this.btnSetting.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.btnSetting.Location = new System.Drawing.Point(1002, 24);
- this.btnSetting.Name = "btnSetting";
- this.btnSetting.Size = new System.Drawing.Size(96, 37);
- this.btnSetting.TabIndex = 0;
- this.btnSetting.Text = "设置";
- this.btnSetting.UseVisualStyleBackColor = true;
- this.btnSetting.Click += new System.EventHandler(this.btnSetting_Click);
- //
- // groupBox2
- //
- this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.groupBox2.Controls.Add(this.lstTissuesList);
- this.groupBox2.Controls.Add(this.btnTissueEdit);
- this.groupBox2.Controls.Add(this.btnTissueDelete);
- this.groupBox2.Controls.Add(this.btnTissueAdd);
- this.groupBox2.Location = new System.Drawing.Point(12, 97);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(287, 567);
- this.groupBox2.TabIndex = 3;
- this.groupBox2.TabStop = false;
- //
- // lstTissuesList
- //
- this.lstTissuesList.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.lstTissuesList.FormattingEnabled = true;
- this.lstTissuesList.ItemHeight = 12;
- this.lstTissuesList.Location = new System.Drawing.Point(15, 60);
- this.lstTissuesList.Name = "lstTissuesList";
- this.lstTissuesList.Size = new System.Drawing.Size(258, 484);
- this.lstTissuesList.TabIndex = 0;
- this.lstTissuesList.SelectedIndexChanged += new System.EventHandler(this.lstTissuesList_SelectedIndexChanged);
- //
- // btnTissueEdit
- //
- this.btnTissueEdit.Location = new System.Drawing.Point(184, 24);
- this.btnTissueEdit.Name = "btnTissueEdit";
- this.btnTissueEdit.Size = new System.Drawing.Size(41, 26);
- this.btnTissueEdit.TabIndex = 10;
- this.btnTissueEdit.UseVisualStyleBackColor = true;
- this.btnTissueEdit.Click += new System.EventHandler(this.btnTissueEdit_Click);
- //
- // btnTissueDelete
- //
- this.btnTissueDelete.Location = new System.Drawing.Point(232, 24);
- this.btnTissueDelete.Name = "btnTissueDelete";
- this.btnTissueDelete.Size = new System.Drawing.Size(41, 26);
- this.btnTissueDelete.TabIndex = 9;
- this.btnTissueDelete.UseVisualStyleBackColor = true;
- this.btnTissueDelete.Click += new System.EventHandler(this.btnTissueDelete_Click);
- //
- // btnTissueAdd
- //
- this.btnTissueAdd.Location = new System.Drawing.Point(136, 24);
- this.btnTissueAdd.Name = "btnTissueAdd";
- this.btnTissueAdd.Size = new System.Drawing.Size(41, 26);
- this.btnTissueAdd.TabIndex = 8;
- this.btnTissueAdd.UseVisualStyleBackColor = true;
- this.btnTissueAdd.Click += new System.EventHandler(this.btnTissueAdd_Click);
- //
- // groupBox3
- //
- this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.groupBox3.Controls.Add(this.lblSummation);
- this.groupBox3.Controls.Add(this.dgvKeyList);
- this.groupBox3.Location = new System.Drawing.Point(305, 97);
- this.groupBox3.Name = "groupBox3";
- this.groupBox3.Size = new System.Drawing.Size(516, 321);
- this.groupBox3.TabIndex = 4;
- this.groupBox3.TabStop = false;
- this.groupBox3.Text = "组织信息";
- //
- // lblSummation
- //
- this.lblSummation.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.lblSummation.AutoSize = true;
- this.lblSummation.Location = new System.Drawing.Point(6, 294);
- this.lblSummation.Name = "lblSummation";
- this.lblSummation.Size = new System.Drawing.Size(41, 12);
- this.lblSummation.TabIndex = 1;
- this.lblSummation.Text = "合计:";
- //
- // dgvKeyList
- //
- this.dgvKeyList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.dgvKeyList.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- this.dgvKeyList.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
- this.hotKey,
- this.name,
- this.count,
- this.ratio});
- this.dgvKeyList.Location = new System.Drawing.Point(6, 24);
- this.dgvKeyList.Name = "dgvKeyList";
- this.dgvKeyList.RowHeadersVisible = false;
- this.dgvKeyList.RowHeadersWidth = 51;
- this.dgvKeyList.RowTemplate.Height = 27;
- this.dgvKeyList.Size = new System.Drawing.Size(502, 255);
- this.dgvKeyList.TabIndex = 0;
- this.dgvKeyList.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvKeyList_CellClick);
- //
- // hotKey
- //
- this.hotKey.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
- this.hotKey.DataPropertyName = "hotKey";
- dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 10.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.hotKey.DefaultCellStyle = dataGridViewCellStyle1;
- this.hotKey.MinimumWidth = 6;
- this.hotKey.Name = "hotKey";
- this.hotKey.ReadOnly = true;
- this.hotKey.Resizable = System.Windows.Forms.DataGridViewTriState.True;
- this.hotKey.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- //
- // name
- //
- this.name.DataPropertyName = "name";
- this.name.MinimumWidth = 6;
- this.name.Name = "name";
- this.name.ReadOnly = true;
- this.name.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- this.name.Width = 125;
- //
- // count
- //
- this.count.MinimumWidth = 6;
- this.count.Name = "count";
- this.count.ReadOnly = true;
- this.count.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- this.count.Width = 125;
- //
- // ratio
- //
- this.ratio.MinimumWidth = 6;
- this.ratio.Name = "ratio";
- this.ratio.ReadOnly = true;
- this.ratio.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- this.ratio.Width = 125;
- //
- // groupBox4
- //
- this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.groupBox4.Controls.Add(this.lblNull);
- this.groupBox4.Controls.Add(this.chart1);
- this.groupBox4.Location = new System.Drawing.Point(305, 424);
- this.groupBox4.Name = "groupBox4";
- this.groupBox4.Size = new System.Drawing.Size(266, 240);
- this.groupBox4.TabIndex = 5;
- this.groupBox4.TabStop = false;
- this.groupBox4.Text = "组织信息";
- //
- // lblNull
- //
- this.lblNull.AutoSize = true;
- this.lblNull.Location = new System.Drawing.Point(84, 99);
- this.lblNull.Name = "lblNull";
- this.lblNull.Size = new System.Drawing.Size(0, 12);
- this.lblNull.TabIndex = 1;
- //
- // groupBox5
- //
- this.groupBox5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.groupBox5.Controls.Add(this.panel1);
- this.groupBox5.Location = new System.Drawing.Point(577, 424);
- this.groupBox5.Name = "groupBox5";
- this.groupBox5.Size = new System.Drawing.Size(243, 240);
- this.groupBox5.TabIndex = 6;
- this.groupBox5.TabStop = false;
- this.groupBox5.Text = "X、Y轴控制";
- //
- // panel1
- //
- this.panel1.Location = new System.Drawing.Point(22, 24);
- this.panel1.Name = "panel1";
- this.panel1.Size = new System.Drawing.Size(215, 210);
- this.panel1.TabIndex = 0;
- //
- // groupBox6
- //
- this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox6.Controls.Add(this.panel2);
- this.groupBox6.Location = new System.Drawing.Point(827, 97);
- this.groupBox6.Name = "groupBox6";
- this.groupBox6.Size = new System.Drawing.Size(401, 567);
- this.groupBox6.TabIndex = 7;
- this.groupBox6.TabStop = false;
- this.groupBox6.Text = "模拟镜头区域";
- //
- // panel2
- //
- this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.panel2.BackColor = System.Drawing.SystemColors.Control;
- this.panel2.Location = new System.Drawing.Point(13, 90);
- this.panel2.MinimumSize = new System.Drawing.Size(100, 100);
- this.panel2.Name = "panel2";
- this.panel2.Size = new System.Drawing.Size(374, 471);
- this.panel2.TabIndex = 0;
- this.panel2.SizeChanged += new System.EventHandler(this.panel2_SizeChanged);
- //
- // chart1
- //
- this.chart1.BackColor = System.Drawing.SystemColors.Control;
- chartArea1.BackColor = System.Drawing.SystemColors.Control;
- chartArea1.Name = "ChartArea1";
- this.chart1.ChartAreas.Add(chartArea1);
- legend1.BackColor = System.Drawing.SystemColors.Control;
- legend1.Name = "Legend1";
- this.chart1.Legends.Add(legend1);
- this.chart1.Location = new System.Drawing.Point(18, 34);
- this.chart1.Name = "chart1";
- series1.ChartArea = "ChartArea1";
- series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Pie;
- series1.Color = System.Drawing.SystemColors.Control;
- series1.LabelBackColor = System.Drawing.SystemColors.Control;
- series1.Legend = "Legend1";
- series1.Name = "Series1";
- this.chart1.Series.Add(series1);
- this.chart1.Size = new System.Drawing.Size(230, 183);
- this.chart1.TabIndex = 0;
- this.chart1.Text = "chart1";
- //
- // GeneralCountometerDialog
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(1240, 676);
- this.Controls.Add(this.groupBox6);
- this.Controls.Add(this.groupBox5);
- this.Controls.Add(this.groupBox4);
- this.Controls.Add(this.groupBox3);
- this.Controls.Add(this.groupBox2);
- this.Controls.Add(this.groupBox1);
- this.Location = new System.Drawing.Point(0, 0);
- this.Name = "GeneralCountometerDialog";
- this.Text = "积数仪";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.GeneralCountometerDialog_FormClosing);
- this.Load += new System.EventHandler(this.GeneralCountometerDialog_Load);
- this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.GeneralCountometerDialog_KeyDown);
- this.Controls.SetChildIndex(this.groupBox1, 0);
- this.Controls.SetChildIndex(this.groupBox2, 0);
- this.Controls.SetChildIndex(this.groupBox3, 0);
- this.Controls.SetChildIndex(this.groupBox4, 0);
- this.Controls.SetChildIndex(this.groupBox5, 0);
- this.Controls.SetChildIndex(this.groupBox6, 0);
- this.groupBox1.ResumeLayout(false);
- this.groupBox2.ResumeLayout(false);
- this.groupBox3.ResumeLayout(false);
- this.groupBox3.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.dgvKeyList)).EndInit();
- this.groupBox4.ResumeLayout(false);
- this.groupBox4.PerformLayout();
- this.groupBox5.ResumeLayout(false);
- this.groupBox6.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit();
- this.ResumeLayout(false);
- }
- #endregion
- protected AppWorkspace m_appWorkspace;
- protected AxisController m_Stage;
- private SQLiteHelper m_sqlHelper;
- private DataTable m_tissuesList;
- private DataTable m_hotKeyList;
- private string m_tissuesId;
- private int m_total = 0;
- private int m_selectedIndex = 0;
- private bool m_isAssay;
- private string m_bgColor = "#ffffffff";
- private string m_lensColor = "#ffffffff";
- private string m_lensBgColor = "#ffffffff";
- private string m_gridsColor = "#ffffffff";
- private string m_blocksColor = "#ffffffff";
- private string m_portName;
- private int m_baudRate;
- private string m_checkBits;
- private int m_step = 1000;
- private int m_pointRatio;
- private double m_pointX;
- private double m_pointY;
- private int m_rangeRatio;
- private double m_rangeX;
- private double m_rangeY;
- private AssayUserControl m_assayControl;
- private int m_assayRectX = 0;
- private int m_assayRectY = 0;
- private List<Dictionary<string, object>> m_rectList;
- private bool m_isFinish = false;
- public GeneralCountometerDialog(AppWorkspace appWorkspace)
- {
- m_appWorkspace = appWorkspace;
- InitializeComponent();
- InitializeLanguageText();
- InitializeButtonBackgroudImage();
- InitializeToolTip();
- InitializeData();
- this.panel1.Controls.Add(initSportCircal(100));
- SettingLoad();
- }
- public void InitStage()
- {
- m_Stage = AxisController.GetInstance();
- if (!m_Stage.IsOpen)
- {
- MessageBox.Show(PdnResources.GetString("Message.AxisController.NotConnected"));
- this.Close();
- }
- }
- private void InitializeButtonBackgroudImage()
- {
- this.btnTissueAdd.FlatStyle = FlatStyle.Flat;
- this.btnTissueAdd.FlatAppearance.BorderSize = 0;
- this.btnTissueAdd.BackgroundImageLayout = ImageLayout.Center;
- this.btnTissueAdd.BackgroundImage = PdnResources.GetImageResource("Icons.MenuRulesListAddIcon.png").Reference;
- this.btnTissueEdit.FlatStyle = FlatStyle.Flat;
- this.btnTissueEdit.FlatAppearance.BorderSize = 0;
- this.btnTissueEdit.BackgroundImageLayout = ImageLayout.Center;
- this.btnTissueEdit.BackgroundImage = PdnResources.GetImageResource("Icons.MenuRulesListEditIcon.png").Reference;
- this.btnTissueDelete.FlatStyle = FlatStyle.Flat;
- this.btnTissueDelete.FlatAppearance.BorderSize = 0;
- this.btnTissueDelete.BackgroundImageLayout = ImageLayout.Center;
- this.btnTissueDelete.BackgroundImage = PdnResources.GetImageResource("Icons.MenuRulesListDeleteIcon.png").Reference;
- }
- private void InitializeToolTip()
- {
- this.toolTip1 = new ToolTip();
- this.toolTip1.SetToolTip(this.btnTissueAdd, PdnResources.GetString("Menu.New.text"));
- this.toolTip1.SetToolTip(this.btnTissueEdit, PdnResources.GetString("Menu.modify.Text"));
- this.toolTip1.SetToolTip(this.btnTissueDelete, PdnResources.GetString("Menu.Edit.Delete.Text"));
- this.toolTip1.ShowAlways = true;
- }
- private void InitializeData()
- {
- m_rectList = new List<Dictionary<string, object>>();
- m_sqlHelper = new SQLiteHelper(); //连接数据库
- m_sqlHelper.Connect();
- TissuesListLoad();
- }
- private void init()
- {
- btnHotKey.Enabled = true;
- btnSetting.Enabled = true;
- m_isAssay = false;
- btnAssay.Text = PdnResources.GetString("Menu.Generalanalysis.Integrator.ensure.text");
- m_isFinish = false;
- m_total = 0;
- m_assayRectX = 0;
- m_assayRectY = 0;
- UpdateCenterCatalog();
- m_rectList.Clear();
- AssayUIRefresh();
- }
- /// <summary>
- /// 运动模式操作台
- /// </summary>
- public CircleControl initSportCircal(int size)
- {
- var circleSportControl = new CircleControl(size);
- circleSportControl.mouseUp += new EventHandler(sportMouseUp);
- circleSportControl.mouseDown += new EventHandler(sportMouseDown);
- return circleSportControl;
- }
- #region 运动圆环
- protected virtual void sportMouseDown(object sender, EventArgs e)
- {
- var circleSportControl = (CircleControl)sender;
- if (circleSportControl._position < 8)
- {
- var p = circleSportControl._position;
- if (p < 0 || p > 7)
- return;
- var map = circleSportControl.positionMap[p];
- m_Stage.Move(1000 * map[0], 1000 * map[1]);
- }
- else
- {
- var direction = circleSportControl._position - 8;
- m_Stage.Split(direction);
- }
- }
- // 运动圆环外层按钮弹起
- protected virtual void sportMouseUp(object sender, EventArgs e)
- {
- var circleSportControl = (CircleControl)sender;
- if (circleSportControl._position > 7)
- m_Stage.FreeStage();
- }
- #endregion
- public void SettingLoad()
- {
- string select_sql = "select * from mic_countometer_setting "; //查询的SQL语句
- DataTable dt = m_sqlHelper.ExecuteDataTable(select_sql, null); //执行查询操作,结果存放在dt中
- if (dt != null && dt.Rows.Count > 0)
- {
- m_bgColor = dt.Rows[0]["bg_color"].ToString();
- m_lensColor = dt.Rows[0]["lens_color"].ToString();
- m_lensBgColor = dt.Rows[0]["lens_bg_color"].ToString();
- m_gridsColor = dt.Rows[0]["grids_color"].ToString();
- m_blocksColor = dt.Rows[0]["blocks_color"].ToString();
- m_portName = dt.Rows[0]["com_port"].ToString();
- m_baudRate = int.Parse(dt.Rows[0]["base_bps"].ToString());
- m_checkBits = dt.Rows[0]["base_check_bits"].ToString();
- m_step = int.Parse(dt.Rows[0]["step"].ToString());
- m_pointRatio = int.Parse(dt.Rows[0]["point_ratio"].ToString());
- m_pointX = int.Parse(dt.Rows[0]["point_x"].ToString());
- m_pointY = int.Parse(dt.Rows[0]["point_y"].ToString());
- m_rangeRatio = int.Parse(dt.Rows[0]["range_ratio"].ToString());
- m_rangeX = int.Parse(dt.Rows[0]["range_x"].ToString());
- m_rangeY = int.Parse(dt.Rows[0]["range_y"].ToString());
- AssayUIRefresh();
- }
- }
- public void TissuesListLoad()
- {
- SelectTissuesList();
- TissuesKeyRefresh();
- }
- private void SelectTissuesList()
- {
- // 组织列表
- string select_sql = "select * from mic_tissues "; //查询的SQL语句
- m_tissuesList = m_sqlHelper.ExecuteDataTable(select_sql, null); //执行查询操作,结果存放在dt中
- }
- public void TissuesKeyRefresh()
- {
- dgvKeyList.AutoGenerateColumns = false;
- dgvKeyList.AllowUserToAddRows = false;
- this.lstTissuesList.Items.Clear();
- if (m_tissuesList.Rows.Count > 0)
- {
- for (int i = 0; i < m_tissuesList.Rows.Count; ++i)
- {
- lstTissuesList.Items.Add(m_tissuesList.Rows[i]["tissue_name"].ToString());
- }
- if (m_selectedIndex > m_tissuesList.Rows.Count - 1)
- {
- m_selectedIndex = m_tissuesList.Rows.Count - 1;
- }
- lstTissuesList.SelectedIndex = m_selectedIndex;
- }
- else
- {
- m_tissuesId = null;
- }
- }
- /// <summary>
- /// 定义键
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnHotKey_Click(object sender, EventArgs e)
- {
- if (m_tissuesId == null)
- {
- MessageBox.Show(PdnResources.GetString("Menu.ddorganizationalinformationfirst.Text"));
- return;
- }
- HotKeySetingDialog dg = new HotKeySetingDialog(this, m_tissuesId);
- dg.ShowDialog();
- }
- /// <summary>
- /// 设置
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnSetting_Click(object sender, EventArgs e)
- {
- SettingDialog dg = new SettingDialog(this);
- dg.ShowDialog();
- }
- /// <summary>
- /// 查看历史
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnShowHistory_Click(object sender, EventArgs e)
- {
- HistoryDialog dg = new HistoryDialog(m_tissuesId);
- dg.ShowDialog();
- }
- /// <summary>
- /// 保存
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnSave_Click(object sender, EventArgs e)
- {
- if (m_rectList.Count <= 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.renorecordedchangesandnoneedt.Text"));
- return;
- }
- SavingDialog dg = new SavingDialog(m_tissuesId, m_hotKeyList);
- dg.ShowDialog();
- // 重新初始化
- init();
- }
- /// <summary>
- /// 组织 添加
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnTissueAdd_Click(object sender, EventArgs e)
- {
- TissuesDialog dg = new TissuesDialog(this, true, null);
- dg.ShowDialog();
- }
- /// <summary>
- /// 组织 修改
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnTissueEdit_Click(object sender, EventArgs e)
- {
- if (m_tissuesId == null)
- {
- MessageBox.Show(PdnResources.GetString("Menu.ddorganizationalinformationfirst.Text"));
- return;
- }
- TissuesDialog dg = new TissuesDialog(this, false, m_tissuesId);
- dg.ShowDialog();
- }
- /// <summary>
- /// 组织 删除
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnTissueDelete_Click(object sender, EventArgs e)
- {
- this.SavingYesOrNo();
- if (btnAssay.Text == PdnResources.GetString("Menu.stop.text"))
- {
- MessageBox.Show("正在测定,不可删除!");
- return;
- }
- if (m_tissuesId == null)
- {
- MessageBox.Show(PdnResources.GetString("Menu.heorganizationinformationtodelete.Text"));
- return;
- }
- DialogResult result = MessageBox.Show(PdnResources.GetString("Menu.surewanttodeleteheselect.Text") + "?", PdnResources.GetString("Menu.Tips.text"), MessageBoxButtons.OKCancel);
- if (result == DialogResult.OK)
- {
- // 删除组织信息
- string delete_sql = "delete from mic_tissues where id = '" + m_tissuesId + "'";
- m_sqlHelper.ExecuteNonQuery(delete_sql, null); //执行删除操作
- // 删除定义键
- delete_sql = "delete from mic_tissues_key where tissue_id = '" + m_tissuesId + "'";
- m_sqlHelper.ExecuteNonQuery(delete_sql, null); //执行删除操作
- this.TissuesListLoad();
- //MessageBox.Show(PdnResources.GetString("Menu.successfullydeleted.text"));
- }
- }
- private void btnPreView_Click(object sender, EventArgs e)
- {
- Form form = Application.OpenForms["CameraPreviewDialog"];//尝试获取已经弹出的窗口对象
- FloatingFormMethod.ShowFloatForm(form, form == null ? new CameraPreviewDialog(m_appWorkspace)/*没有弹出的窗口对象则创建*/ : null, m_appWorkspace);
- }
- private void lstTissuesList_SelectedIndexChanged(object sender, EventArgs e)
- {
- this.SavingYesOrNo();
- m_selectedIndex = this.lstTissuesList.SelectedIndex;
- m_tissuesId = m_tissuesList.Rows[m_selectedIndex]["id"].ToString();
- UpdateCenterCatalog();
- }
- private bool SavingYesOrNo()
- {
- bool save = false;
- if (m_rectList.Count > 0)
- {
- DialogResult result = MessageBox.Show(PdnResources.GetString("Menu.thertheaccumulatorhaarecordsave.Text") + "?", PdnResources.GetString("Menu.Tips.text"), MessageBoxButtons.OKCancel);
- if (result == DialogResult.OK)
- {
- //打开保存窗口
- SavingDialog savingDialog = new SavingDialog(m_tissuesId, m_hotKeyList);
- savingDialog.ShowDialog();
- save = true;
- }
- // 重新初始化数据
- init();
- }
- return save;
- }
- /// <summary>
- /// 更新中间key设置
- /// </summary>
- private void UpdateCenterCatalog()
- {
- // 组织列表
- string select_sql = "select * from mic_tissues_key where delete_flag = 0 and tissue_id = '" + m_tissuesId + "'"; //查询的SQL语句
- m_hotKeyList = m_sqlHelper.ExecuteDataTable(select_sql, null); //执行查询操作,结果存放在dt中
- if (m_hotKeyList != null)
- {
- m_hotKeyList.Columns.Add("count");
- m_hotKeyList.Columns.Add("ratio");
- }
- this.DrawDgvKeyList();
- this.DawPieChart();
- }
- private void DrawDgvKeyList()
- {
- this.dgvKeyList.Rows.Clear();
- if (m_hotKeyList == null)
- {
- return;
- }
- if (m_hotKeyList.Rows.Count > 0)
- {
- dgvKeyList.Rows.Add(m_hotKeyList.Rows.Count);
- for (int i = 0; i < m_hotKeyList.Rows.Count; ++i)
- {
- Color bgColor = ColorTranslator.FromHtml(m_hotKeyList.Rows[i]["color"].ToString());
- dgvKeyList.Rows[i].Cells["hotKey"].Value = m_hotKeyList.Rows[i]["hot_key"].ToString();
- dgvKeyList.Rows[i].Cells["hotKey"].Style.BackColor = bgColor;
- dgvKeyList.Rows[i].Cells["hotKey"].Style.ForeColor = Color.White;
- dgvKeyList.Rows[i].Cells["hotKey"].Style.SelectionBackColor = bgColor;
- dgvKeyList.Rows[i].Cells["hotKey"].Style.SelectionForeColor = Color.White;
- dgvKeyList.Rows[i].Cells["name"].Value = m_hotKeyList.Rows[i]["name"].ToString();
- string count = m_hotKeyList.Rows[i]["count"].ToString();
- if (string.IsNullOrEmpty(count))
- {
- count = "0";
- }
- m_hotKeyList.Rows[i]["count"] = count;
- dgvKeyList.Rows[i].Cells["count"].Value = count;
- string ratio = m_hotKeyList.Rows[i]["ratio"].ToString();
- if (string.IsNullOrEmpty(ratio))
- {
- ratio = "0";
- }
- m_hotKeyList.Rows[i]["ratio"] = ratio;
- dgvKeyList.Rows[i].Cells["ratio"].Value = ratio;
- }
- }
- }
- private void dgvKeyList_CellClick(object sender, DataGridViewCellEventArgs e)
- {
- if (!m_isAssay)
- {
- return;
- }
- if (m_isFinish)
- {
- MessageBox.Show(PdnResources.GetString("Menu.measurementshaveallbeencom.Text"));
- return;
- }
- // 点击图标
- if (dgvKeyList.Columns[e.ColumnIndex].Name == "hotKey" && e.RowIndex >= 0)
- {
- int value = int.Parse(dgvKeyList.Rows[e.RowIndex].Cells["count"].Value.ToString()) + 1;
- m_hotKeyList.Rows[e.RowIndex]["count"] = value;
- dgvKeyList.Rows[e.RowIndex].Cells["count"].Value = value;
- if (m_hotKeyList.Rows[e.RowIndex]["is_count"].ToString().Equals("1"))
- {
- m_total += 1;
- CalcRatio();
- }
- this.PrintToControl(m_hotKeyList.Rows[e.RowIndex]);
- this.DawPieChart();
- }
- }
- private void CalcRatio()
- {
- for (int i = 0; i < m_hotKeyList.Rows.Count; ++i)
- {
- if (m_hotKeyList.Rows[i]["is_count"].ToString().Equals("1"))
- {
- int count = int.Parse(m_hotKeyList.Rows[i]["count"].ToString());
- decimal ratio = 0;
- if (m_total > 0)
- {
- string t = (count * 1.0 / m_total).ToString();
- ratio = decimal.Round(decimal.Parse(t) * 100, 2);
- }
- string ratioStr = ratio + "%";
- m_hotKeyList.Rows[i]["ratio"] = ratioStr;
- dgvKeyList.Rows[i].Cells["ratio"].Value = ratioStr;
- }
- }
- }
- private void ResetCount(string keyString)
- {
- for (int i = 0; i < m_hotKeyList.Rows.Count; ++i)
- {
- if (keyString.Equals(m_hotKeyList.Rows[i]["hot_key"].ToString()))
- {
- int count = int.Parse(m_hotKeyList.Rows[i]["count"].ToString()) - 1;
- m_hotKeyList.Rows[i]["count"] = count;
- dgvKeyList.Rows[i].Cells["count"].Value = count;
- if (m_hotKeyList.Rows[i]["is_count"].ToString().Equals("1"))
- {
- m_total -= 1;
- }
- break;
- }
- }
- CalcRatio();
- }
- private void PrintToControl(DataRow data)
- {
- double x = 0, y = 0;
- if (PdnResources.GetString("Menu.Weightmeasurement.Text").Equals(data["direction"].ToString()))
- {
- // 全部重测回到开始位置了
- if (m_rectList.Count == 0)
- {
- return;
- }
- if (m_assayRectY % 2 == 0) // 向右走
- {
- if (m_assayRectX == 0)
- {
- m_assayRectY -= 1;
- y = m_rangeY;
- }
- else
- {
- m_assayRectX -= 1;
- x = -m_rangeX;
- }
- }
- else // 向左走
- {
- if (m_assayRectX == m_pointX - 1)
- {
- m_assayRectY -= 1;
- y = m_rangeY;
- }
- else
- {
- m_assayRectX += 1;
- x = m_rangeX;
- }
- }
- m_Stage.Move(x, y);
- Dictionary<String, object> lastRect = m_rectList[m_rectList.Count - 1];
- ResetCount(lastRect["key"].ToString());
- m_rectList.RemoveAt(m_rectList.Count - 1);
- Dictionary<String, object> rect1 = new Dictionary<String, object>
- {
- { "x", m_assayRectX },
- { "y", m_assayRectY },
- { "color", ColorTranslator.FromHtml(m_lensColor) },
- { "key", data["hot_key"].ToString() }
- };
- m_assayControl.DrawRectAssay(rect1);
- return;
- }
- Dictionary<String, object> rect = new Dictionary<String, object>
- {
- { "x", m_assayRectX },
- { "y", m_assayRectY },
- { "color", ColorTranslator.FromHtml(data["color"].ToString()) },
- { "key", data["hot_key"].ToString() }
- };
- m_rectList.Add(rect);
- m_assayControl.DrawRectAssay(rect);
- if (m_rectList.Count == m_pointX * m_pointY)
- {
- m_isFinish = true;
- UpdateAssayState();
- MessageBox.Show(PdnResources.GetString("Menu.measurementshaveallbeencom.Text"));
- return;
- }
- x = 0; y = 0;
- if (m_assayRectY % 2 == 0) // 向右走
- {
- if (m_assayRectX + 1 >= m_pointX)
- {
- m_assayRectY += 1;
- y = -m_rangeY;
- }
- else
- {
- m_assayRectX += 1;
- x = m_rangeX;
- }
- }
- else
- {
- if (m_assayRectX == 0)
- {
- m_assayRectY += 1;
- y = -m_rangeY;
- }
- else
- {
- m_assayRectX -= 1;
- x = -m_rangeX;
- }
- }
- m_Stage.Move(x, y);
- }
- private void DawPieChart()
- {
- lblSummation.Text = PdnResources.GetString("Menu.Generalanalysis.Integrator.total.text") + ":" + m_total.ToString();
- if (m_total <= 0)
- {
- lblNull.Visible = true;
- chart1.Visible = false;
- return;
- }
- lblNull.Visible = false;
- chart1.Visible = true;
- // 饼图
- List<string> xData = new List<string>();
- List<decimal> yData = new List<decimal>();
- DataRow[] dr = m_hotKeyList.Select("is_count = '1'");
- for (int i = 0; i < dr.Length; ++i)
- {
- string name = dr[i]["name"].ToString();
- decimal count = (decimal.Parse(dr[i]["count"].ToString()));
- string ratio = dr[i]["ratio"].ToString();
- xData.Add(name + "(" + ratio + ")");
- yData.Add(count);
- }
- chart1.Series[0]["PieLabelStyle"] = "Disabled";//将文字移到外侧Outside Inside
- chart1.Series[0].Points.DataBindXY(xData, yData);
- for (int i = 0; i < dr.Length; ++i)
- {
- Color color = ColorTranslator.FromHtml(dr[i]["color"].ToString());
- chart1.Series[0].Points[i].Color = color;
- }
- }
- private void UpdateAssayState()
- {
- if (m_isAssay)
- {
- btnHotKey.Enabled = true;
- btnSetting.Enabled = true;
- m_isAssay = false;
- btnAssay.Text = PdnResources.GetString("Menu.Generalanalysis.Integrator.ensure.text");
- }
- else
- {
- // 开始测定前检查前一次测定是否已保存
- bool save = this.SavingYesOrNo();
- if (save)
- {
- btnHotKey.Enabled = true;
- btnSetting.Enabled = true;
- m_isAssay = false;
- btnAssay.Text = PdnResources.GetString("Menu.Generalanalysis.Integrator.ensure.text");
- }
- else
- {
- btnHotKey.Enabled = false;
- btnSetting.Enabled = false;
- m_isAssay = true;
- btnAssay.Text = PdnResources.GetString("Menu.stop.text");
- }
- }
- }
- private void btnAssay_Click(object sender, EventArgs e)
- {
- if (m_tissuesId == null)
- {
- MessageBox.Show(PdnResources.GetString("Menu.ddorganizationalinformationfirst.Text"));
- return;
- }
- UpdateAssayState();
- }
- private void panel2_SizeChanged(object sender, EventArgs e)
- {
- if (this.WindowState != FormWindowState.Minimized)
- {
- AssayUIRefresh();
- }
- }
- private void AssayUIRefresh()
- {
- m_assayControl = new AssayUserControl(panel2.Width, panel2.Height, m_pointX, m_pointY, m_rangeX, m_rangeY, m_rectList, m_rangeRatio);
- m_assayControl.BgColor = ColorTranslator.FromHtml(m_bgColor);
- m_assayControl.LensBgColor = ColorTranslator.FromHtml(m_lensBgColor);
- m_assayControl.LensColor = ColorTranslator.FromHtml(m_lensColor);
- m_assayControl.GridsColor = ColorTranslator.FromHtml(m_gridsColor);
- //assay.LensColor = ColorTranslator.FromHtml(m_lensColor);
- m_assayControl.initialize();
- this.panel2.Controls.Clear();
- this.panel2.Controls.Add(m_assayControl);
- }
- private void GeneralCountometerDialog_KeyDown(object sender, KeyEventArgs e)
- {
- if (m_isAssay)
- {
- if (m_isFinish)
- {
- MessageBox.Show(PdnResources.GetString("Menu.measurementshaveallbeencom.Text"));
- return;
- }
- e.Handled = true;
- string keyString = e.KeyCode.ToString();
- if (keyString.Equals("ControlKey"))
- {
- keyString = "Control";
- }
- if (keyString.Equals("Menu"))
- {
- keyString = "Alt";
- }
- if (!keyString.Equals(""))
- {
- for (int i = 0; i < m_hotKeyList.Rows.Count; ++i)
- {
- if (keyString.Equals(m_hotKeyList.Rows[i]["hot_key"].ToString()))
- {
- int value = int.Parse(dgvKeyList.Rows[i].Cells["count"].Value.ToString()) + 1;
- m_hotKeyList.Rows[i]["count"] = value;
- dgvKeyList.Rows[i].Cells["count"].Value = value;
- if (m_hotKeyList.Rows[i]["is_count"].ToString().Equals("1"))
- {
- m_total += 1;
- CalcRatio();
- }
- PrintToControl(m_hotKeyList.Rows[i]);
- this.DawPieChart();
- break;
- }
- }
- }
- }
- }
- private void GeneralCountometerDialog_FormClosing(object sender, FormClosingEventArgs e)
- {
- this.SavingYesOrNo(); // 检查测定是否已保存
- m_sqlHelper.DisConnect();
- m_Stage.FreeStage();
- }
- private void GeneralCountometerDialog_Load(object sender, EventArgs e)
- {
- InitStage();
- }
- }
- }
|