12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226 |
- 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();
- }
- }
- }
|