| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404 |
- using Metis.ParameterSet;
- using OpenCvSharp;
- using OpenCvSharp.Extensions;
- using PaintDotNet.Annotation;
- using PaintDotNet.Annotation.Enum;
- using PaintDotNet.Base;
- using PaintDotNet.Base.CommTool;
- using PaintDotNet.Base.Functionodel;
- using PaintDotNet.CustomControl;
- using PaintDotNet.Data.Param;
- using PaintDotNet.DbOpreate.DbBll;
- using PaintDotNet.DbOpreate.DbModel;
- using PaintDotNet.DedicatedAnalysis.DuctileIron.Common;
- using PaintDotNet.Instrument;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Data.Entity.Migrations.Infrastructure;
- using System.Diagnostics.Contracts;
- using System.Drawing;
- using System.Drawing.Drawing2D;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace PaintDotNet.DedicatedAnalysis.HighSpeedSteelCarbonBlock.GB4462_84
- {
- /// <summary>
- /// 高速钢大块碳
- /// </summary>
- internal class HighSpeedSteelCarbonBlockDialog : PdnBaseForm
- {
- #region 基础控件
- private Button button1;
- private CheckBox checkBox1;
- private Button button2;
- private GroupBox groupBox2;
- private ListView listView1;
- private GroupBox groupBox3;
- private GroupBox groupBox5;
- private GroupBox groupBox6;
- private Panel panel2;
- private GroupBox groupBox8;
- private DataGridView dataGridView1;
- private GroupBox groupBox9;
- private Button button6;
- private Button button7;
- private ListView listView2;
- private DataGridView dataGridView2;
- private Button button9;
- private Button button8;
- private NumericUpDown numericUpDown1;
- private Label label8;
- private Label label9;
- private Label label10;
- private ImageList imageList1;
- private IContainer components;
- private GroupBox groupBox1;
- private TrackBar trackBar2;
- private NumericUpDown numericUpDown5;
- private NumericUpDown numericUpDown4;
- private Label label3;
- private CheckBox checkBox3;
- private Label label6;
- private Label label5;
- private Label label4;
- private Panel panel4;
- private Panel panel3;
- private RadioButton radioButton1;
- private RadioButton radioButton2;
- private RadioButton radioButton3;
- private RadioButton radioButton4;
- private TrackBar trackBar4;
- private Button button3;
- #endregion
- /// <summary>
- /// 调色板
- /// </summary>
- PaintDotNet.ColorsForm colorsForm1;
- PaintDotNet.ColorsForm colorsForm2;
- /// <summary>
- /// 主控件
- /// </summary>
- private AppWorkspace appWorkspace;
- /// <summary>
- /// 图像面板
- /// </summary>
- private DocumentWorkspaceWindow documentWorkspace;
- /// <summary>
- /// 公共按钮
- /// </summary>
- private CommonControlButtons commonControlButtons;
- /// <summary>
- /// 选中图片的bitmap
- /// </summary>
- private Bitmap bitmap;
- /// <summary>
- /// 计算结果的表格集合
- /// </summary>
- private List<DataTable> resultTableList = new List<DataTable>();
- /// <summary>
- /// 保存用于生成报告的图片
- /// </summary>
- private List<Bitmap> bitList;
- /// <summary>
- /// 储存点击保存结果后的所有原图与分析图
- /// </summary>
- private Dictionary<string, List<Bitmap>> bitDic = new Dictionary<string, List<Bitmap>>();
- /// <summary>
- /// 是否显示全部
- /// </summary>
- private bool showAll = false;
- /// <summary>
- /// 当前图片是否有视场
- /// </summary>
- private bool isHadView = false;
- /// <summary>
- /// 原图mat-包括视场
- /// </summary>
- private Mat mat;
- /// <summary>
- /// 相的集合
- /// </summary>
- //private PhaseModel phaseModel;
- /// <summary>
- /// 单位标尺
- /// </summary>
- private double unitLength = 1;
- /// <summary>
- /// 最大点碳化物点集合
- /// </summary>
- private List<List<OpenCvSharp.Point>> maxPoint;
- /// <summary>
- /// 钨系A标准
- /// </summary>
- private double[] tungstenA = new double[] { 18, 21, 23, 25 };
- /// <summary>
- /// 钨系B标准
- /// </summary>
- private double[] tungstenB = new double[] { 16, 18, 21, 23 };
- /// <summary>
- /// 钼系标准
- /// </summary>
- private double[] molybdenum = new double[] { 6.1, 8.3, 12.5, 15.6, 22.1 };
- /// <summary>
- /// 碳化物尺寸最大值
- /// </summary>
- private double maxSize = 0;
- /// <summary>
- /// 是否仅修改相的颜色
- /// </summary>
- private bool changeColor = false;
- /// <summary>
- /// 是否未对图片做其他操作
- /// </summary>
- private bool isFirstSwitch = false;
- /// <summary>
- /// 中间数据
- /// </summary>
- private List<ExportProjectModel> tempDataModel = new List<ExportProjectModel>();
- /// <summary>
- /// 面积
- /// </summary>
- private List<string> tempArea;
- private BinaryControl bc;
- //二值化集成1
- BinaryClass binaryClass;
- private int menuId;
- private string menuName;
- private DataGridView dataGridView3;
- private int defaultIndex = -1;
- /// <summary>
- /// 保存窗口参数
- /// </summary>
- /// <summary>
- /// 各个图片对应数据
- /// </summary>
- private Dictionary<string, GrainSizeAnalysisModel> eachData = new Dictionary<string, GrainSizeAnalysisModel>();
- private const string ParamKey_Report = "report";//报告设置
- private const string ParamKey_Screen = "screen";//筛选
- private const string ParamKey_ScreenMin = "screenMin";//面积最小值
- private const string ParamKey_ScreenMax = "screenMax";//面积最大值
- private const string ParamKey_Tungsten = "tungsten";//钨
- private const string ParamKey_Molybdenum = "molybdenum";//钼
- private const string ParamKey_ColumnA = "columnA";//A列
- private const string ParamKey_ColumnB = "columnB";//B列
- private const string ParamKey_MaxColour = "maxColour";//最大色
- private const string ParamKey_DecimalPlace = "decimalPlace";//保留小数位数
- private decimal areaMin = -1;//面积区间最小
- private decimal areaMax = -1;//面积区间最大
- private Button button4;
- private Button button5;
- private bool isExportResults = false;
- private bool isExportReports = false;
- private bool isExportProjects = false;
- /// <summary>
- /// 是否脚本运行
- /// </summary>
- private Boolean initScriptValues = false;
- /// <summary>
- /// 最大卡规直径
- /// </summary>
- private List<string> maxCaliperDiameter;
- public HighSpeedSteelCarbonBlockDialog(AppWorkspace appWorkspace, PdnMenuItem menuItem)
- {
- this.appWorkspace = appWorkspace;
- NullKey();
- InitializeComponent();
- InitializeLanguageText();
- InitializeCustomControl();
- this.menuId = menuItem.MenuId;
- this.menuName = menuItem.Text;
- this.binaryClass = new BinaryClass(menuId);
- InitGridHeader();
- InitOtherTools();
- InitPicList();
- InitCommonButtonEvent();
- SetAnalyzeModelFromXml("Template.Manager.item3.HighSpeedSteelCarbonBlock");
- }
- private void ShowImgEvent(object sender, EventArgs e)
- {
- listView1.Focus();
- if (this.defaultIndex != -1)
- {
- //如果是脚本执行,将参数带入
- if (appWorkspace.ScriptRunning && appWorkspace.ScriptCurrentParam != null)
- {
- this.initScriptValues = true;//ScriptAutomatic
- //Boolean initScriptValues = true;
- ////在这里反射出对应功能的参数类
- string className = InvariantData.path_Action + ".Action" + menuId;
- ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
- foreach (Args arg in param.Lists)
- {
- Args param1 = appWorkspace.ScriptCurrentParam.Lists.Find(m => m.Key.Equals(arg.Key));
- if (param1.value != null)
- arg.Value = param1.value;
- getValue(arg.key, arg.Value);
- }
- appWorkspace.ScriptCurrentParam = null;//阻止第二次进入仍然被赋值参数
- }
- else
- {//读取上次关闭窗口时保存的参数
- GetXmlParameter();
- GetListParamModel();
- }
- this.listView1.Items[defaultIndex].Focused = true;
- this.listView1.Items[defaultIndex].Selected = true;
- if (this.initScriptValues && this.appWorkspace.ScriptAutomatic)
- this.startScriptAutomaticAction();
- }
- }
- private void InitializeCustomControl()
- {
- //
- // bc
- //
- this.bc = new PaintDotNet.CustomControl.BinaryControl();
- this.bc.BinaryBackColor = System.Drawing.Color.Red;
- this.bc.BinaryChecked = false;
- this.bc.BinaryStyle = 1;
- this.bc.Location = new System.Drawing.Point(150, 59);
- this.bc.Name = "bc";
- this.bc.OriginChecked = false;
- this.bc.scope1End = 0D;
- this.bc.scope1Start = 0D;
- this.bc.scope2End = 0D;
- this.bc.scope2Start = 0D;
- this.bc.scope3End = 0D;
- this.bc.scope3Start = 0D;
- this.bc.Size = new System.Drawing.Size(360, 292);
- this.bc.TabIndex = 19;
- this.Controls.Add(this.bc);
- this.Controls.SetChildIndex(this.bc, 0);
- }
- private void InitializeLanguageText()
- {
- this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
- this.button2.Text = PdnResources.GetString("Menu.Saveresult.text");
- this.checkBox1.Text = PdnResources.GetString("Menu.Opensettingsatingreport.text");
- this.button1.Text = PdnResources.GetString("Menu.Setting.Text");
- this.groupBox2.Text = PdnResources.GetString("Menu.Tools.ImageIndex.Text");
- this.groupBox3.Text = PdnResources.GetString("Menu.Preview.text");
- this.groupBox5.Text = PdnResources.GetString("Menu.Particlescreening.text");
- this.label3.Text = PdnResources.GetString("Menu.range.text") + ":";
- this.checkBox3.Text = PdnResources.GetString("Menu.filter.text");
- this.groupBox6.Text = PdnResources.GetString("Menu.paramssettings.text");
- this.radioButton4.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.ColumnB.text");
- this.radioButton3.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.ColumnA.text");
- this.radioButton2.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Molybdenum.text");
- this.radioButton1.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Tungsten.text");
- this.label6.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Maximuecolor.text") + ":";
- this.label5.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.series.text") + ":";
- this.label4.Text = PdnResources.GetString("Menu.Highspeedtoolsteelcategory.text") + ":";
- this.groupBox8.Text = PdnResources.GetString("Menu.Theesultshow.text");
- this.groupBox9.Text = PdnResources.GetString("Menu.Analysisresult.text");
- this.button3.Text = PdnResources.GetString("Menu.Exportproject.text");
- this.label8.Text = PdnResources.GetString("Menu.Decimal.text") + ":";
- this.button9.Text = PdnResources.GetString("Menu.Exportresults.text");
- this.button8.Text = PdnResources.GetString("Menu.Tools.CreateReport.Text");
- this.button7.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
- this.button6.Text = PdnResources.GetString("Menu.Showall.text");
- this.Text = "GB/T 4462-1984(" + PdnResources.GetString("Menu.Highspeedsteelbulkcarbo.Text") + ")";
- this.button4.Text = PdnResources.GetString("Menu.File.SaveAll.Text");
- this.button5.Text = PdnResources.GetString("Menu.Applyall.text");
- }
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.button2 = new System.Windows.Forms.Button();
- this.checkBox1 = new System.Windows.Forms.CheckBox();
- this.button1 = new System.Windows.Forms.Button();
- this.groupBox2 = new System.Windows.Forms.GroupBox();
- this.listView1 = new System.Windows.Forms.ListView();
- this.imageList1 = new System.Windows.Forms.ImageList(this.components);
- this.groupBox3 = new System.Windows.Forms.GroupBox();
- this.groupBox5 = new System.Windows.Forms.GroupBox();
- this.trackBar4 = new System.Windows.Forms.TrackBar();
- this.trackBar2 = new System.Windows.Forms.TrackBar();
- this.numericUpDown5 = new System.Windows.Forms.NumericUpDown();
- this.numericUpDown4 = new System.Windows.Forms.NumericUpDown();
- this.label3 = new System.Windows.Forms.Label();
- this.checkBox3 = new System.Windows.Forms.CheckBox();
- this.groupBox6 = new System.Windows.Forms.GroupBox();
- this.panel4 = new System.Windows.Forms.Panel();
- this.radioButton4 = new System.Windows.Forms.RadioButton();
- this.radioButton3 = new System.Windows.Forms.RadioButton();
- this.panel3 = new System.Windows.Forms.Panel();
- this.radioButton2 = new System.Windows.Forms.RadioButton();
- this.radioButton1 = new System.Windows.Forms.RadioButton();
- this.label6 = new System.Windows.Forms.Label();
- this.label5 = new System.Windows.Forms.Label();
- this.label4 = new System.Windows.Forms.Label();
- this.panel2 = new System.Windows.Forms.Panel();
- this.groupBox8 = new System.Windows.Forms.GroupBox();
- this.dataGridView1 = new System.Windows.Forms.DataGridView();
- this.groupBox9 = new System.Windows.Forms.GroupBox();
- this.dataGridView3 = new System.Windows.Forms.DataGridView();
- this.button3 = new System.Windows.Forms.Button();
- this.label10 = new System.Windows.Forms.Label();
- this.label9 = new System.Windows.Forms.Label();
- this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
- this.label8 = new System.Windows.Forms.Label();
- this.button9 = new System.Windows.Forms.Button();
- this.button8 = new System.Windows.Forms.Button();
- this.dataGridView2 = new System.Windows.Forms.DataGridView();
- this.listView2 = new System.Windows.Forms.ListView();
- this.button7 = new System.Windows.Forms.Button();
- this.button6 = new System.Windows.Forms.Button();
- this.button4 = new System.Windows.Forms.Button();
- this.button5 = new System.Windows.Forms.Button();
- this.groupBox1.SuspendLayout();
- this.groupBox2.SuspendLayout();
- this.groupBox5.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.trackBar4)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.trackBar2)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).BeginInit();
- this.groupBox6.SuspendLayout();
- this.panel4.SuspendLayout();
- this.panel3.SuspendLayout();
- this.groupBox8.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
- this.groupBox9.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView3)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).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.button4);
- this.groupBox1.Controls.Add(this.button5);
- this.groupBox1.Controls.Add(this.button2);
- this.groupBox1.Controls.Add(this.checkBox1);
- this.groupBox1.Controls.Add(this.button1);
- this.groupBox1.Location = new System.Drawing.Point(14, 3);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(1107, 50);
- this.groupBox1.TabIndex = 1;
- this.groupBox1.TabStop = false;
- //
- // button2
- //
- this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.button2.Location = new System.Drawing.Point(925, 13);
- this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(84, 30);
- this.button2.TabIndex = 2;
- this.button2.UseVisualStyleBackColor = true;
- this.button2.Click += new System.EventHandler(this.button2_Click);
- //
- // checkBox1
- //
- this.checkBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.checkBox1.AutoSize = true;
- this.checkBox1.Location = new System.Drawing.Point(141, 21);
- this.checkBox1.Name = "checkBox1";
- this.checkBox1.Size = new System.Drawing.Size(15, 14);
- this.checkBox1.TabIndex = 1;
- this.checkBox1.UseVisualStyleBackColor = true;
- //
- // button1
- //
- this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.button1.Location = new System.Drawing.Point(15, 14);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(84, 30);
- this.button1.TabIndex = 0;
- this.button1.UseVisualStyleBackColor = true;
- this.button1.Click += new System.EventHandler(this.button1_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.listView1);
- this.groupBox2.Location = new System.Drawing.Point(14, 60);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(135, 607);
- this.groupBox2.TabIndex = 2;
- this.groupBox2.TabStop = false;
- //
- // listView1
- //
- this.listView1.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.listView1.HideSelection = false;
- this.listView1.LargeImageList = this.imageList1;
- this.listView1.Location = new System.Drawing.Point(5, 17);
- this.listView1.MultiSelect = false;
- this.listView1.Name = "listView1";
- this.listView1.Size = new System.Drawing.Size(124, 584);
- this.listView1.TabIndex = 0;
- this.listView1.UseCompatibleStateImageBehavior = false;
- this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
- this.listView1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseDown);
- //
- // imageList1
- //
- this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
- this.imageList1.ImageSize = new System.Drawing.Size(64, 64);
- this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
- //
- // groupBox3
- //
- this.groupBox3.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.groupBox3.Location = new System.Drawing.Point(515, 59);
- this.groupBox3.Name = "groupBox3";
- this.groupBox3.Size = new System.Drawing.Size(606, 606);
- this.groupBox3.TabIndex = 3;
- this.groupBox3.TabStop = false;
- //
- // groupBox5
- //
- this.groupBox5.Controls.Add(this.trackBar4);
- this.groupBox5.Controls.Add(this.trackBar2);
- this.groupBox5.Controls.Add(this.numericUpDown5);
- this.groupBox5.Controls.Add(this.numericUpDown4);
- this.groupBox5.Controls.Add(this.label3);
- this.groupBox5.Controls.Add(this.checkBox3);
- this.groupBox5.Location = new System.Drawing.Point(155, 351);
- this.groupBox5.Name = "groupBox5";
- this.groupBox5.Size = new System.Drawing.Size(353, 88);
- this.groupBox5.TabIndex = 5;
- this.groupBox5.TabStop = false;
- //
- // trackBar4
- //
- this.trackBar4.Cursor = System.Windows.Forms.Cursors.Hand;
- this.trackBar4.Location = new System.Drawing.Point(257, 41);
- this.trackBar4.Maximum = 0;
- this.trackBar4.Name = "trackBar4";
- this.trackBar4.Size = new System.Drawing.Size(92, 45);
- this.trackBar4.TabIndex = 14;
- this.trackBar4.TickStyle = System.Windows.Forms.TickStyle.None;
- this.trackBar4.Scroll += new System.EventHandler(this.trackBar4_Scroll);
- //
- // trackBar2
- //
- this.trackBar2.Cursor = System.Windows.Forms.Cursors.Hand;
- this.trackBar2.Location = new System.Drawing.Point(104, 41);
- this.trackBar2.Maximum = 0;
- this.trackBar2.Name = "trackBar2";
- this.trackBar2.Size = new System.Drawing.Size(92, 45);
- this.trackBar2.TabIndex = 13;
- this.trackBar2.TickStyle = System.Windows.Forms.TickStyle.None;
- this.trackBar2.Scroll += new System.EventHandler(this.trackBar2_Scroll);
- //
- // numericUpDown5
- //
- this.numericUpDown5.Location = new System.Drawing.Point(197, 41);
- this.numericUpDown5.Maximum = new decimal(new int[] {
- 0,
- 0,
- 0,
- 0});
- this.numericUpDown5.Name = "numericUpDown5";
- this.numericUpDown5.Size = new System.Drawing.Size(62, 21);
- this.numericUpDown5.TabIndex = 12;
- this.numericUpDown5.ValueChanged += new System.EventHandler(this.numericUpDown5_ValueChanged);
- //
- // numericUpDown4
- //
- this.numericUpDown4.Location = new System.Drawing.Point(44, 41);
- this.numericUpDown4.Maximum = new decimal(new int[] {
- 0,
- 0,
- 0,
- 0});
- this.numericUpDown4.Name = "numericUpDown4";
- this.numericUpDown4.Size = new System.Drawing.Size(62, 21);
- this.numericUpDown4.TabIndex = 10;
- this.numericUpDown4.ValueChanged += new System.EventHandler(this.numericUpDown4_ValueChanged);
- //
- // label3
- //
- this.label3.AutoSize = true;
- this.label3.Location = new System.Drawing.Point(9, 45);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(0, 12);
- this.label3.TabIndex = 9;
- //
- // checkBox3
- //
- this.checkBox3.AutoSize = true;
- this.checkBox3.Location = new System.Drawing.Point(30, 21);
- this.checkBox3.Name = "checkBox3";
- this.checkBox3.Size = new System.Drawing.Size(15, 14);
- this.checkBox3.TabIndex = 0;
- this.checkBox3.UseVisualStyleBackColor = true;
- this.checkBox3.CheckedChanged += new System.EventHandler(this.checkBox3_CheckedChanged);
- //
- // groupBox6
- //
- this.groupBox6.Controls.Add(this.panel4);
- this.groupBox6.Controls.Add(this.panel3);
- this.groupBox6.Controls.Add(this.label6);
- this.groupBox6.Controls.Add(this.label5);
- this.groupBox6.Controls.Add(this.label4);
- this.groupBox6.Controls.Add(this.panel2);
- this.groupBox6.Location = new System.Drawing.Point(155, 443);
- this.groupBox6.Name = "groupBox6";
- this.groupBox6.Size = new System.Drawing.Size(353, 103);
- this.groupBox6.TabIndex = 6;
- this.groupBox6.TabStop = false;
- //
- // panel4
- //
- this.panel4.Controls.Add(this.radioButton4);
- this.panel4.Controls.Add(this.radioButton3);
- this.panel4.Location = new System.Drawing.Point(77, 41);
- this.panel4.Name = "panel4";
- this.panel4.Size = new System.Drawing.Size(170, 22);
- this.panel4.TabIndex = 11;
- //
- // radioButton4
- //
- this.radioButton4.AutoSize = true;
- this.radioButton4.Location = new System.Drawing.Point(72, 2);
- this.radioButton4.Name = "radioButton4";
- this.radioButton4.Size = new System.Drawing.Size(14, 13);
- this.radioButton4.TabIndex = 1;
- this.radioButton4.TabStop = true;
- this.radioButton4.UseVisualStyleBackColor = true;
- this.radioButton4.CheckedChanged += new System.EventHandler(this.radioButton4_CheckedChanged);
- //
- // radioButton3
- //
- this.radioButton3.AutoSize = true;
- this.radioButton3.Checked = true;
- this.radioButton3.Location = new System.Drawing.Point(5, 2);
- this.radioButton3.Name = "radioButton3";
- this.radioButton3.Size = new System.Drawing.Size(14, 13);
- this.radioButton3.TabIndex = 0;
- this.radioButton3.TabStop = true;
- this.radioButton3.UseVisualStyleBackColor = true;
- this.radioButton3.CheckedChanged += new System.EventHandler(this.radioButton3_CheckedChanged);
- //
- // panel3
- //
- this.panel3.Controls.Add(this.radioButton2);
- this.panel3.Controls.Add(this.radioButton1);
- this.panel3.Location = new System.Drawing.Point(137, 16);
- this.panel3.Name = "panel3";
- this.panel3.Size = new System.Drawing.Size(170, 22);
- this.panel3.TabIndex = 10;
- //
- // radioButton2
- //
- this.radioButton2.AutoSize = true;
- this.radioButton2.Location = new System.Drawing.Point(72, 2);
- this.radioButton2.Name = "radioButton2";
- this.radioButton2.Size = new System.Drawing.Size(14, 13);
- this.radioButton2.TabIndex = 1;
- this.radioButton2.TabStop = true;
- this.radioButton2.UseVisualStyleBackColor = true;
- this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton2_CheckedChanged);
- //
- // radioButton1
- //
- this.radioButton1.AutoSize = true;
- this.radioButton1.Checked = true;
- this.radioButton1.Location = new System.Drawing.Point(5, 2);
- this.radioButton1.Name = "radioButton1";
- this.radioButton1.Size = new System.Drawing.Size(14, 13);
- this.radioButton1.TabIndex = 0;
- this.radioButton1.TabStop = true;
- this.radioButton1.UseVisualStyleBackColor = true;
- this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged);
- //
- // label6
- //
- this.label6.AutoSize = true;
- this.label6.Location = new System.Drawing.Point(30, 71);
- this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(0, 12);
- this.label6.TabIndex = 9;
- //
- // label5
- //
- this.label5.AutoSize = true;
- this.label5.Location = new System.Drawing.Point(30, 46);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(0, 12);
- this.label5.TabIndex = 8;
- //
- // label4
- //
- this.label4.AutoSize = true;
- this.label4.Location = new System.Drawing.Point(30, 21);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(0, 12);
- this.label4.TabIndex = 7;
- //
- // panel2
- //
- this.panel2.BackColor = System.Drawing.SystemColors.ButtonHighlight;
- this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.panel2.Location = new System.Drawing.Point(156, 68);
- this.panel2.Name = "panel2";
- this.panel2.Size = new System.Drawing.Size(101, 18);
- this.panel2.TabIndex = 6;
- this.panel2.Click += new System.EventHandler(this.panel2_Click);
- //
- // groupBox8
- //
- this.groupBox8.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.groupBox8.Controls.Add(this.dataGridView1);
- this.groupBox8.Location = new System.Drawing.Point(155, 547);
- this.groupBox8.Name = "groupBox8";
- this.groupBox8.Size = new System.Drawing.Size(353, 119);
- this.groupBox8.TabIndex = 8;
- this.groupBox8.TabStop = false;
- //
- // dataGridView1
- //
- this.dataGridView1.AllowUserToAddRows = false;
- this.dataGridView1.AllowUserToDeleteRows = false;
- this.dataGridView1.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.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
- this.dataGridView1.BackgroundColor = System.Drawing.Color.White;
- this.dataGridView1.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;
- this.dataGridView1.Location = new System.Drawing.Point(7, 17);
- this.dataGridView1.MultiSelect = false;
- this.dataGridView1.Name = "dataGridView1";
- this.dataGridView1.RowHeadersVisible = false;
- this.dataGridView1.RowTemplate.Height = 23;
- this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
- this.dataGridView1.Size = new System.Drawing.Size(340, 96);
- this.dataGridView1.TabIndex = 0;
- //
- // groupBox9
- //
- this.groupBox9.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox9.Controls.Add(this.dataGridView3);
- this.groupBox9.Controls.Add(this.button3);
- this.groupBox9.Controls.Add(this.label10);
- this.groupBox9.Controls.Add(this.label9);
- this.groupBox9.Controls.Add(this.numericUpDown1);
- this.groupBox9.Controls.Add(this.label8);
- this.groupBox9.Controls.Add(this.button9);
- this.groupBox9.Controls.Add(this.button8);
- this.groupBox9.Controls.Add(this.dataGridView2);
- this.groupBox9.Controls.Add(this.listView2);
- this.groupBox9.Controls.Add(this.button7);
- this.groupBox9.Controls.Add(this.button6);
- this.groupBox9.Location = new System.Drawing.Point(14, 672);
- this.groupBox9.Name = "groupBox9";
- this.groupBox9.Size = new System.Drawing.Size(1107, 204);
- this.groupBox9.TabIndex = 9;
- this.groupBox9.TabStop = false;
- //
- // dataGridView3
- //
- this.dataGridView3.AllowUserToAddRows = false;
- this.dataGridView3.AllowUserToDeleteRows = false;
- this.dataGridView3.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.dataGridView3.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
- this.dataGridView3.BackgroundColor = System.Drawing.Color.White;
- this.dataGridView3.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;
- this.dataGridView3.Location = new System.Drawing.Point(228, 121);
- this.dataGridView3.MultiSelect = false;
- this.dataGridView3.Name = "dataGridView3";
- this.dataGridView3.RowHeadersVisible = false;
- this.dataGridView3.RowTemplate.Height = 23;
- this.dataGridView3.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
- this.dataGridView3.Size = new System.Drawing.Size(719, 76);
- this.dataGridView3.TabIndex = 12;
- //
- // button3
- //
- this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button3.Location = new System.Drawing.Point(967, 102);
- this.button3.Name = "button3";
- this.button3.Size = new System.Drawing.Size(128, 26);
- this.button3.TabIndex = 10;
- this.button3.UseVisualStyleBackColor = true;
- this.button3.Click += new System.EventHandler(this.button3_Click);
- //
- // label10
- //
- this.label10.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.label10.AutoSize = true;
- this.label10.ForeColor = System.Drawing.SystemColors.ScrollBar;
- this.label10.Location = new System.Drawing.Point(953, 9);
- this.label10.Name = "label10";
- this.label10.Size = new System.Drawing.Size(11, 192);
- this.label10.TabIndex = 9;
- this.label10.Text = "|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|";
- //
- // label9
- //
- this.label9.AutoSize = true;
- this.label9.ForeColor = System.Drawing.SystemColors.ScrollBar;
- this.label9.Location = new System.Drawing.Point(210, 9);
- this.label9.Name = "label9";
- this.label9.Size = new System.Drawing.Size(11, 192);
- this.label9.TabIndex = 8;
- this.label9.Text = "|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|";
- //
- // numericUpDown1
- //
- this.numericUpDown1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.numericUpDown1.Location = new System.Drawing.Point(1019, 162);
- this.numericUpDown1.Maximum = new decimal(new int[] {
- 10,
- 0,
- 0,
- 0});
- this.numericUpDown1.Name = "numericUpDown1";
- this.numericUpDown1.Size = new System.Drawing.Size(70, 21);
- this.numericUpDown1.TabIndex = 7;
- this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);
- //
- // label8
- //
- this.label8.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.label8.AutoSize = true;
- this.label8.Location = new System.Drawing.Point(983, 167);
- this.label8.Name = "label8";
- this.label8.Size = new System.Drawing.Size(0, 12);
- this.label8.TabIndex = 6;
- //
- // button9
- //
- this.button9.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button9.Location = new System.Drawing.Point(967, 68);
- this.button9.Name = "button9";
- this.button9.Size = new System.Drawing.Size(128, 26);
- this.button9.TabIndex = 5;
- this.button9.UseVisualStyleBackColor = true;
- this.button9.Click += new System.EventHandler(this.button9_Click);
- //
- // button8
- //
- this.button8.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button8.Location = new System.Drawing.Point(967, 34);
- this.button8.Name = "button8";
- this.button8.Size = new System.Drawing.Size(128, 26);
- this.button8.TabIndex = 4;
- this.button8.UseVisualStyleBackColor = true;
- this.button8.Click += new System.EventHandler(this.button8_Click);
- //
- // dataGridView2
- //
- this.dataGridView2.AllowUserToAddRows = false;
- this.dataGridView2.AllowUserToDeleteRows = false;
- this.dataGridView2.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.dataGridView2.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
- this.dataGridView2.BackgroundColor = System.Drawing.Color.White;
- this.dataGridView2.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;
- this.dataGridView2.Location = new System.Drawing.Point(228, 13);
- this.dataGridView2.MultiSelect = false;
- this.dataGridView2.Name = "dataGridView2";
- this.dataGridView2.RowHeadersVisible = false;
- this.dataGridView2.RowTemplate.Height = 23;
- this.dataGridView2.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
- this.dataGridView2.Size = new System.Drawing.Size(719, 102);
- this.dataGridView2.TabIndex = 3;
- //
- // listView2
- //
- this.listView2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.listView2.HideSelection = false;
- this.listView2.Location = new System.Drawing.Point(16, 56);
- this.listView2.Name = "listView2";
- this.listView2.Size = new System.Drawing.Size(181, 140);
- this.listView2.TabIndex = 2;
- this.listView2.UseCompatibleStateImageBehavior = false;
- this.listView2.SelectedIndexChanged += new System.EventHandler(this.listView2_SelectedIndexChanged);
- //
- // button7
- //
- this.button7.Location = new System.Drawing.Point(145, 20);
- this.button7.Name = "button7";
- this.button7.Size = new System.Drawing.Size(52, 26);
- this.button7.TabIndex = 1;
- this.button7.UseVisualStyleBackColor = true;
- this.button7.Click += new System.EventHandler(this.button7_Click);
- //
- // button6
- //
- this.button6.Location = new System.Drawing.Point(16, 20);
- this.button6.Name = "button6";
- this.button6.Size = new System.Drawing.Size(93, 26);
- this.button6.TabIndex = 0;
- this.button6.UseVisualStyleBackColor = true;
- this.button6.Click += new System.EventHandler(this.button6_Click);
- //
- // button4
- //
- this.button4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button4.Location = new System.Drawing.Point(1015, 13);
- this.button4.Name = "button4";
- this.button4.Size = new System.Drawing.Size(84, 30);
- this.button4.TabIndex = 19;
- this.button4.Text = "保存全部";
- this.button4.UseVisualStyleBackColor = true;
- this.button4.Click += new System.EventHandler(this.button4_Click);
- //
- // button5
- //
- this.button5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button5.Location = new System.Drawing.Point(835, 13);
- this.button5.Name = "button5";
- this.button5.Size = new System.Drawing.Size(84, 30);
- this.button5.TabIndex = 18;
- this.button5.Text = "应用全部";
- this.button5.UseVisualStyleBackColor = true;
- this.button5.Click += new System.EventHandler(this.button5_Click);
- //
- // HighSpeedSteelCarbonBlockDialog
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
- this.ClientSize = new System.Drawing.Size(1133, 881);
- this.Controls.Add(this.groupBox9);
- this.Controls.Add(this.groupBox8);
- this.Controls.Add(this.groupBox6);
- this.Controls.Add(this.groupBox5);
- this.Controls.Add(this.groupBox3);
- this.Controls.Add(this.groupBox2);
- this.Controls.Add(this.groupBox1);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
- this.Name = "HighSpeedSteelCarbonBlockDialog";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Dialog_FormClosing);
- this.Load += new System.EventHandler(this.MicrostructureBandDialog_Load);
- this.Shown += new System.EventHandler(this.ShownChoiseItemAndInitData);
- this.Controls.SetChildIndex(this.groupBox1, 0);
- this.Controls.SetChildIndex(this.groupBox2, 0);
- this.Controls.SetChildIndex(this.groupBox3, 0);
- this.Controls.SetChildIndex(this.groupBox5, 0);
- this.Controls.SetChildIndex(this.groupBox6, 0);
- this.Controls.SetChildIndex(this.groupBox8, 0);
- this.Controls.SetChildIndex(this.groupBox9, 0);
- this.groupBox1.ResumeLayout(false);
- this.groupBox1.PerformLayout();
- this.groupBox2.ResumeLayout(false);
- this.groupBox5.ResumeLayout(false);
- this.groupBox5.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.trackBar4)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.trackBar2)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).EndInit();
- this.groupBox6.ResumeLayout(false);
- this.groupBox6.PerformLayout();
- this.panel4.ResumeLayout(false);
- this.panel4.PerformLayout();
- this.panel3.ResumeLayout(false);
- this.panel3.PerformLayout();
- this.groupBox8.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
- this.groupBox9.ResumeLayout(false);
- this.groupBox9.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView3)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit();
- this.ResumeLayout(false);
- }
- private void HighSpeedSteelCarbonBlockDialog_Load(object sender, EventArgs e)
- {
- this.binaryClass.loadParams();
- if (this.initScriptValues && this.appWorkspace.ScriptAutomatic)
- this.startScriptAutomaticAction();
- }
- /// <summary>
- /// 初始化其他控件
- /// </summary>
- private void InitOtherTools()
- {
- //
- //初始化图像控件
- //
- this.documentWorkspace = new DocumentWorkspaceWindow(this.appWorkspace);
- this.documentWorkspace.Dock = DockStyle.Fill;
- this.documentWorkspace.HookMouseEvents();
- this.documentWorkspace.AuxiliaryLineEnabled = false;
- this.documentWorkspace.Visible = false;
- this.documentWorkspace.activeTool = Annotation.Enum.DrawToolType.NullTool;
- this.groupBox3.Controls.Add(documentWorkspace);
- //
- //初始化操作按钮
- //
- this.commonControlButtons = new CommonControlButtons();
- this.commonControlButtons.Dock = DockStyle.Top;
- this.commonControlButtons.Height = 30;
- this.commonControlButtons.HideZoomToWindowAndActualSize();
- this.commonControlButtons.Visible = false;
- this.groupBox3.Controls.Add(commonControlButtons);
- //
- //调色板
- //
- this.colorsForm1 = new ColorsForm();
- this.colorsForm1.setSaveBtn_Click(new System.EventHandler(this.colorsForm1Changed));
- this.colorsForm1.StartPosition = FormStartPosition.CenterScreen;
- this.colorsForm2 = new ColorsForm();
- this.colorsForm2.setSaveBtn_Click(new System.EventHandler(this.colorsForm2Changed));
- this.colorsForm2.StartPosition = FormStartPosition.CenterScreen;
- //
- //颜色pane2给定初始值
- //
- this.panel2.BackColor = Color.Green;
- ////
- ////获取系统标尺-微米
- ////
- //this.appWorkspace.getMeasureInfo().TryGetValue(MeasurementUnit.Micron, out unitLength);
- //二值化集成2
- bc.OriginCheckedChangedAction += new EventHandler(this.bcOriginCheckedChanged);//初始化原图勾选改变事件
- binaryClass.createDocumentItems(new string[] { PdnResources.GetString("Menu.BinaryAction.BinaryExtraction.Text"), PdnResources.GetString("Menu.Particlescreening.text") }
- , this.bc, this.appWorkspace, this.documentWorkspace, this.listView1);//初始化相的工作结构
- binaryClass.BinaryImplFinishAction += new EventHandler(this.bClassBinaryImplFinishAction);//二值化后续处理事件
- }
- /// <summary>
- /// 初始化图片列表数据
- /// </summary>
- public void InitPicList()
- {
- //初始化图片列表
- for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
- {
- this.imageList1.Images.Add("img" + i, this.appWorkspace.DocumentWorkspaces[i].BinarizationThumbnail);
- this.listView1.Items.Add("", i);
- this.listView1.Items[i].ImageIndex = i;
- this.listView1.Items[i].Text = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
- this.listView1.Items[i].Name = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
- if (this.appWorkspace.DocumentWorkspaces[i].Equals(this.appWorkspace.ActiveDocumentWorkspace))
- {
- defaultIndex = i;
- }
- }
- this.Shown += ShowImgEvent;
- }
- /// <summary>
- /// 初始化表头
- /// </summary>
- private void InitGridHeader()
- {
- //
- //结果展示表
- //
- this.dataGridView1.ColumnHeadersHeight = 30;
- DataGridViewTextBoxColumn h1 = new DataGridViewTextBoxColumn();
- h1.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h1.Width = 66;
- DataGridViewTextBoxColumn h2 = new DataGridViewTextBoxColumn();
- h2.Width = 138;
- DataGridViewTextBoxColumn h3 = new DataGridViewTextBoxColumn();
- h3.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h3.Width = 66;
- DataGridViewTextBoxColumn h4 = new DataGridViewTextBoxColumn();
- h4.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h4.Width = 66;
- this.dataGridView1.Columns.Add(h1);
- this.dataGridView1.Columns.Add(h2);
- this.dataGridView1.Columns.Add(h3);
- this.dataGridView1.Columns.Add(h4);
- DataGridViewHelper helper = new DataGridViewHelper(this.dataGridView1);
- helper.Headers.Add(new DataGridViewHelper.TopHeader(0, 1, PdnResources.GetString("Menu.view.text")));
- helper.Headers.Add(new DataGridViewHelper.TopHeader(1, 1, PdnResources.GetString("Menu.Highspeedtoolsteelcategory.text")));
- helper.Headers.Add(new DataGridViewHelper.TopHeader(2, 1, PdnResources.GetString("Menu.sizeed.text")));
- helper.Headers.Add(new DataGridViewHelper.TopHeader(3, 1, PdnResources.GetString("Menu.levdel.Text")));
- this.dataGridView1.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView1.Columns[0].ReadOnly = true;
- this.dataGridView1.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;//文字居中
- this.dataGridView1.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView1.Columns[1].ReadOnly = true;
- this.dataGridView1.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView1.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView1.Columns[2].ReadOnly = true;
- this.dataGridView1.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView1.Columns[3].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView1.Columns[3].ReadOnly = true;
- this.dataGridView1.Columns[3].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView1.AllowUserToResizeRows = false;
- this.dataGridView1.AllowUserToResizeColumns = false;
- //
- //分析结果表
- //
- this.dataGridView2.ColumnHeadersHeight = 30;
- DataGridViewTextBoxColumn h5 = new DataGridViewTextBoxColumn();
- //h5.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h5.Width = 115;
- DataGridViewTextBoxColumn h6 = new DataGridViewTextBoxColumn();
- h6.Width = 155;
- DataGridViewTextBoxColumn h7 = new DataGridViewTextBoxColumn();
- //h7.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h7.Width = 190;
- DataGridViewTextBoxColumn h8 = new DataGridViewTextBoxColumn();
- //h8.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h8.Width = 115;
- DataGridViewTextBoxColumn h9 = new DataGridViewTextBoxColumn();
- //h9.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h9.Width = 115;
- this.dataGridView2.Columns.Add(h5);
- this.dataGridView2.Columns.Add(h6);
- this.dataGridView2.Columns.Add(h7);
- this.dataGridView2.Columns.Add(h8);
- this.dataGridView2.Columns.Add(h9);
- DataGridViewHelper helper2 = new DataGridViewHelper(this.dataGridView2);
- helper2.Headers.Add(new DataGridViewHelper.TopHeader(0, 1, PdnResources.GetString("Menu.picture.Text")));
- helper2.Headers.Add(new DataGridViewHelper.TopHeader(1, 1, PdnResources.GetString("Menu.view.text")));
- helper2.Headers.Add(new DataGridViewHelper.TopHeader(2, 1, PdnResources.GetString("Menu.Highspeedtoolsteelcategory.text")));
- helper2.Headers.Add(new DataGridViewHelper.TopHeader(3, 1, PdnResources.GetString("Menu.sizeed.text")));
- helper2.Headers.Add(new DataGridViewHelper.TopHeader(4, 1, PdnResources.GetString("Menu.levdel.Text")));
- this.dataGridView2.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView2.Columns[0].ReadOnly = true;
- this.dataGridView2.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView2.Columns[1].ReadOnly = true;
- this.dataGridView2.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView2.Columns[2].ReadOnly = true;
- this.dataGridView2.Columns[3].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView2.Columns[3].ReadOnly = true;
- this.dataGridView2.Columns[4].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView2.Columns[4].ReadOnly = true;
- this.dataGridView2.AllowUserToResizeRows = false;
- this.dataGridView2.AllowUserToResizeColumns = false;
- this.dataGridView3.ColumnHeadersHeight = 30;
- DataGridViewTextBoxColumn h10 = new DataGridViewTextBoxColumn();
- //h10.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h10.Width = 115;
- DataGridViewTextBoxColumn h11 = new DataGridViewTextBoxColumn();
- h11.Width = 155;
- DataGridViewTextBoxColumn h12 = new DataGridViewTextBoxColumn();
- //h12.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h12.Width = 190;
- DataGridViewTextBoxColumn h13 = new DataGridViewTextBoxColumn();
- //h13.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h13.Width = 115;
- DataGridViewTextBoxColumn h14 = new DataGridViewTextBoxColumn();
- //h14.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h14.Width = 115;
- this.dataGridView3.Columns.Add(h10);
- this.dataGridView3.Columns.Add(h11);
- this.dataGridView3.Columns.Add(h12);
- this.dataGridView3.Columns.Add(h13);
- this.dataGridView3.Columns.Add(h14);
- DataGridViewHelper helper3 = new DataGridViewHelper(this.dataGridView3);
- helper3.Headers.Add(new DataGridViewHelper.TopHeader(0, 1, PdnResources.GetString("Menu.picture.Text")));
- helper3.Headers.Add(new DataGridViewHelper.TopHeader(1, 1, PdnResources.GetString("Menu.view.text")));
- helper3.Headers.Add(new DataGridViewHelper.TopHeader(2, 1, PdnResources.GetString("Menu.Highspeedtoolsteelcategory.text")));
- helper3.Headers.Add(new DataGridViewHelper.TopHeader(3, 1, PdnResources.GetString("Menu.sizeed.text")));
- helper3.Headers.Add(new DataGridViewHelper.TopHeader(4, 1, PdnResources.GetString("Menu.levdel.Text")));
- this.dataGridView3.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView3.Columns[0].ReadOnly = true;
- this.dataGridView3.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView3.Columns[1].ReadOnly = true;
- this.dataGridView3.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView3.Columns[2].ReadOnly = true;
- this.dataGridView3.Columns[3].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView3.Columns[3].ReadOnly = true;
- this.dataGridView3.Columns[4].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView3.Columns[4].ReadOnly = true;
- this.dataGridView3.AllowUserToResizeRows = false;
- this.dataGridView3.AllowUserToResizeColumns = false;
- //
- //左下表
- //
- this.listView2.View = View.Details;
- ColumnHeader header0 = new ColumnHeader();
- header0.Text = PdnResources.GetString("Menu.Imagelist.Text");
- header0.Width = 175;
- this.listView2.Columns.Add(header0);
- }
- /// <summary>
- /// 初始化画布按键功能
- /// </summary>
- private void InitCommonButtonEvent()
- {
- this.commonControlButtons.zoomInButton.Click += new EventHandler(zoomInButton_Click);
- this.commonControlButtons.zoomOutButton.Click += new EventHandler(zoomOutButton_Click);
- this.commonControlButtons.zoomToWindowButton.Click += new EventHandler(zoomToWindowButton_Click);
- this.commonControlButtons.actualSizeButton.Click += new EventHandler(actualSizeButton_Click);
- this.commonControlButtons.pointerButton.Click += new EventHandler(pointerButton_Click);
- this.commonControlButtons.mobileModeButton.Click += new EventHandler(mobileModeButton_Click);
- }
- //二值化集成3
- #region 二值化相关方法
- private void Dialog_FormClosing(object sender, FormClosingEventArgs e)
- {
- #region [开启脚本录制]
- if (appWorkspace.startScriptRecording)
- {
- getScriptRecording();
- }
- #endregion
- binaryClass.saveParams();
- this.saveDialogParamValues();
- //xml保存路径
- string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml";
- GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));
- foreach (var analysisItem in this.eachData[GetImgKey()].ListParam)
- {
- bool foundItem = false;
- foreach (var item in analysisModelXml.ListParam)
- {
- if (item.param_key.Equals(analysisItem.param_key) && item.menuId == analysisItem.menuId)
- {
- item.param_value = analysisItem.param_value;
- foundItem = true;
- break;
- }
- }
- if (!foundItem)
- analysisModelXml.ListParam.Add(analysisItem.cloneModel());
- }
- //按路径和名称保存xml文件
- string userInfoXml = XmlSerializeHelper.XmlSerialize<GrainSizeAnalysisModel>(analysisModelXml);
- //保存xml
- FileOperationHelper.WriteStringToFile(userInfoXml, filePath, System.IO.FileMode.Create);
- }
- private void ShownChoiseItemAndInitData(object sender, EventArgs e)
- {
- binaryClass.RefreshHistogramControl1Values();
- }
- /// <summary>
- /// 添加参数改变的监听
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MicrostructureBandDialog_Load(object sender, EventArgs e)
- {
- this.binaryClass.loadParams();
- }
- private bool bcBinaryChecked()
- {
- return bc != null && bc.BinaryChecked;
- }
- private bool bcOriginChecked()
- {
- return bc != null && bc.OriginChecked;
- }
- /// <summary>
- /// 参数改变时,重新处理图像
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- //AppCommon appCommonDisplay = new AppCommon();
- private void bClassBinaryImplFinishAction(object sender, EventArgs e)
- {
- if (this.documentWorkspace.CompositionSurface == null)
- return;
- sum++;
- if (bcBinaryChecked())
- {
- if (bcOriginChecked())
- {
- this.documentWorkspace.PhaseModels[1].choise = false;
- }
- else
- {
- this.documentWorkspace.PhaseModels[1].choise = true;
- }
- ResetAreaAndContent();
- ReloadDebrisSelection();
- changeColor = false;
- this.documentWorkspace.PhaseModels[0].choise = false;
- }
- else
- {
- this.documentWorkspace.PhaseModels[0].choise = false;
- this.documentWorkspace.PhaseModels[1].choise = false;
- appCommon.DisplayData(this.dataGridView1, false);
- }
- //this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 显示原图/原图+二值图
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void bcOriginCheckedChanged(object sender, EventArgs e)
- {
- if (!bcOriginChecked())
- {
- if (bcBinaryChecked())
- {
- //this.documentWorkspace.PhaseModels[0].choise = false;
- this.documentWorkspace.PhaseModels[1].choise = true;
- appCommon.DisplayData(this.dataGridView1, true);
- }
- }
- else
- {
- this.documentWorkspace.PhaseModels[0].choise = false;
- this.documentWorkspace.PhaseModels[1].choise = false;
- appCommon.DisplayData(this.dataGridView1, false);
- }
- this.documentWorkspace.Refresh();
- }
- #endregion
- private void zoomInButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ZoomIn();
- }
- private void zoomOutButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ZoomOut();
- }
- private void zoomToWindowButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ZoomBasis = ZoomBasis.FitToWindow;
- }
- private void actualSizeButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ZoomBasis = ZoomBasis.ScaleFactor;
- this.documentWorkspace.ScaleFactor = ScaleFactor.OneToOne;
- }
- private void pointerButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.Pointer;
- }
- private void mobileModeButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.MoveMode;
- }
- /// <summary>
- /// 添加内容单元格
- /// </summary>
- /// <param name="text"></param>
- /// <param name="tag"></param>
- /// <returns></returns>
- private DataGridViewTextBoxCell CreateTextBoxCell(string text, object tag)
- {
- DataGridViewTextBoxCell textboxcell = new DataGridViewTextBoxCell();
- textboxcell.Value = text;
- textboxcell.Tag = tag;
- return textboxcell;
- }
- /// <summary>
- /// 设置按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button1_Click(object sender, EventArgs e)
- {
- AnalyzeSettingDialog metallographicMethodSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item3.HighSpeedSteelCarbonBlock");
- if (metallographicMethodSetDialog.hasModule)
- {
- metallographicMethodSetDialog.StartPosition = FormStartPosition.CenterScreen;
- metallographicMethodSetDialog.ShowDialog();
- }
- else
- {
- metallographicMethodSetDialog = null;
- }
- }
- DialogResult dr;
- /// <summary>
- /// 保存结果按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button2_Click(object sender, EventArgs e)
- {
- if (this.listView1.SelectedItems.Count > 0)
- {
- string imgName = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetFriendlyName();
- string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index];
- bool replace = false;
- int rowIndex = 0;
- if (this.dataGridView1.Rows.Count > 0)
- {
- if (this.listView2.Items.Count > 0)
- {
- foreach (ListViewItem item in this.listView2.Items)
- {
- if (!blSaveAll && item.Name.Equals(tag))
- {
- dr = MessageBox.Show(PdnResources.GetString("Menu.Theanalysisreertoreplaceit.text") + "?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
- break;
- }
- }
- foreach (ListViewItem item in this.listView2.Items)
- {
- if (item.Name.Equals(tag))
- {
- if (dr == DialogResult.OK || blSaveAll)
- {
- replace = true;
- }
- else
- {
- return;
- }
- break;
- }
- }
- }
- //有重名需要替换
- if (replace)
- {
- for (int i = 0; i < this.resultTableList.Count; i++)
- {
- if (this.resultTableList[i].TableName.Equals(tag))
- {
- rowIndex = i;
- this.resultTableList.Remove(this.resultTableList[i]);
- if (this.maxSize > 0)
- {
- resultTableList.Insert(rowIndex, dtResult);
- }
- }
- }
- }
- //新增
- else
- {
- ListViewItem listViewItem = new ListViewItem();
- listViewItem.Name = tag;
- listViewItem.SubItems[0].Text = imgName;
- this.listView2.Items.Add(listViewItem);
- this.listView2.SelectedItems.Clear();
- this.listView2.Items[this.listView2.Items.Count - 1].Selected = true;
- if (this.maxSize > 0)
- {
- resultTableList.Insert(rowIndex, dtResult);
- }
- }
- RefreshDataGridView2();
- //保存处理后的图片
- double pantographRatio = (double)this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数
- List<Bitmap> tempBit = new List<Bitmap>();
- Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
- originalBit.Tag = pantographRatio;
- tempBit.Add(originalBit);
- Bitmap processedBit = BitmapConverter.ToBitmap(this.documentWorkspace.PhaseModels[1].mat);
- Bitmap newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
- Graphics graphics = Graphics.FromImage(newBit);
- graphics.DrawImage(processedBit, new PointF(0, 0));
- newBit.Tag = pantographRatio;
- tempBit.Add(newBit);
- if (bitDic.ContainsKey(tag))
- bitDic[tag] = tempBit;
- else
- bitDic.Add(tag, tempBit);
- //拼接中间数据
- List<List<string>> dataList = new List<List<string>>();
- List<string> columnName = new List<string>();
- columnName.Add(PdnResources.GetString("Menu.Imagement.Measurementlist.ordernumber.text"));
- columnName.Add(PdnResources.GetString("Menu.area.text"));
- columnName.Add(PdnResources.GetString("Menu.Maximumcaliperdiameter.text"));
- dataList.Add(columnName);
- if (this.tempArea.Count > 0)
- {
- for (int i = 0; i < this.tempArea.Count; i++)
- {
- List<string> strList = new List<string>();
- strList.Add((i + 1).ToString());
- strList.Add(this.tempArea[i]);
- strList.Add(this.maxCaliperDiameter[i]);
- dataList.Add(strList);
- }
- }
- bool isExist = false;//是否已存在进行替换
- int modelIndex = -1;//要替换的下标
- for (int j = 0; j < tempDataModel.Count; j++)
- {
- if (tempDataModel[j].tagName.Equals(tag))
- {
- isExist = true;
- modelIndex = j;
- break;
- }
- }
- if (isExist && modelIndex > -1)
- tempDataModel[modelIndex].dataList = dataList;
- else
- {
- ExportProjectModel newModel = new ExportProjectModel();
- newModel.tagName = tag;
- newModel.picName = imgName;
- newModel.dataList = dataList;
- tempDataModel.Add(newModel);
- }
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Nocarbidtosave.text"));
- }
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapictaurefirst.Text"));
- }
- }
- /// <summary>
- /// 刷新分析结果表
- /// </summary>
- private void RefreshDataGridView2()
- {
- //需要计算平均值的集合
- List<double> lstSize = new List<double>();
- //综合平均值
- double avglstSize = 0;
- dataGridView2.Rows.Clear();
- dataGridView3.Rows.Clear();
- if (resultTableList.Count > 0)
- {
- if (this.showAll)
- {
- //dataGridView2.Rows.Clear();
- int i = 0;
- for (int k = 0; k < resultTableList.Count; k++)
- {
- dataGridView2.Rows.Add(resultTableList[k].Rows.Count);//增加同等数量的行数
- foreach (DataRow row in resultTableList[k].Rows)//逐个读取单元格的内容;
- {
- DataGridViewRow r1 = dataGridView2.Rows[i];
- r1.Cells[0].Value = row.RowState.ToString();
- for (int j = 0; j < resultTableList[k].Columns.Count; j++)
- {
- if (j == 0 || j == 1 || j == 2 || j == 4)
- {
- r1.Cells[j].Value = row[j].ToString();
- }
- else
- {
- r1.Cells[j].Value = Math.Round(double.Parse(string.IsNullOrEmpty(row[j].ToString()) ? "0" :
- row[j].ToString()), Convert.ToInt32(this.numericUpDown1.Value));
- }
- //r1.Cells[j].Value = row[j];
- if (!row[1].Equals(PdnResources.GetString("Menu.Image.Average.Text")))
- {
- if (j == 3)
- {
- lstSize.Add(double.Parse(row[j].ToString()));
- }
- }
- }
- i++;
- }
- }
- }
- else
- {
- //dataGridView2.Rows.Clear();
- if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
- {
- int h = 0;
- for (int i = 0; i < this.listView2.SelectedItems.Count; i++)
- {
- string tableName = this.listView2.SelectedItems[i].Name;
- foreach (DataTable dt in resultTableList)
- {
- if (dt.TableName.Equals(tableName))
- {
- dataGridView2.Rows.Add(dt.Rows.Count);//增加同等数量的行数
- foreach (DataRow row in dt.Rows)//逐个读取单元格的内容;
- {
- DataGridViewRow r1 = dataGridView2.Rows[h];
- r1.Cells[0].Value = row.RowState.ToString();
- for (int j = 0; j < dt.Columns.Count; j++)
- {
- if (j == 0 || j == 1 || j == 2 || j == 4)
- {
- r1.Cells[j].Value = row[j].ToString();
- }
- else
- {
- r1.Cells[j].Value = Math.Round(double.Parse(string.IsNullOrEmpty(row[j].ToString()) ? "0" :
- row[j].ToString()), Convert.ToInt32(this.numericUpDown1.Value));
- }
- //r1.Cells[j].Value = row[j];
- if (!row[1].Equals(PdnResources.GetString("Menu.Image.Average.Text")))
- {
- if (j == 3)
- {
- lstSize.Add(double.Parse(row[j].ToString()));
- }
- }
- }
- h++;
- }
- }
- }
- }
- }
- }
- if (dataGridView2.Rows.Count > 0)
- {
- string series = string.Empty;
- if (this.radioButton1.Checked)
- {
- if (this.radioButton3.Checked)
- series = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Tungsten.text") + PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.ColumnA.text");
- else
- series = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Tungsten.text") + PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.ColumnB.text");
- }
- else
- series = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Molybdenum.text");
- if (lstSize.Count > 0)
- {
- avglstSize = (double)lstSize.Average();
- }
- string avgLevel = string.Empty;
- if (this.radioButton1.Checked)
- {
- if (this.radioButton3.Checked)
- {
- if (avglstSize < tungstenA[0])
- avgLevel = "1";
- else if (avglstSize >= tungstenA[0] && avglstSize <= tungstenA[1])
- avgLevel = "2";
- else if (avglstSize >= tungstenA[1] && avglstSize <= tungstenA[2])
- avgLevel = "3";
- else if (avglstSize >= tungstenA[2] && avglstSize <= tungstenA[3])
- avgLevel = "4";
- else
- avgLevel = "S";
- }
- else
- {
- if (avglstSize < tungstenB[0])
- avgLevel = "1";
- else if (avglstSize >= tungstenB[0] && avglstSize <= tungstenB[1])
- avgLevel = "2";
- else if (avglstSize >= tungstenB[1] && avglstSize <= tungstenB[2])
- avgLevel = "3";
- else if (avglstSize >= tungstenB[2] && avglstSize <= tungstenB[3])
- avgLevel = "4";
- else
- avgLevel = "S";
- }
- }
- else
- {
- if (avglstSize < molybdenum[0])
- avgLevel = "2";
- else if (avglstSize >= molybdenum[0] && avglstSize < molybdenum[1])
- avgLevel = "3";
- else if (avglstSize >= molybdenum[1] && avglstSize < molybdenum[2])
- avgLevel = "4";
- else if (avglstSize >= molybdenum[2] && avglstSize < molybdenum[3])
- avgLevel = "5";
- else if (avglstSize >= molybdenum[3] && avglstSize < molybdenum[4])
- avgLevel = "6";
- else
- avgLevel = "S";
- }
- this.dataGridView3.Rows.Add(PdnResources.GetString("Menu.comprehensive.text"), PdnResources.GetString("Menu.Comprehensivaverage.text"), series, Math.Round(double.Parse(string.IsNullOrEmpty(avglstSize.ToString()) ? "0" : avglstSize.ToString()), Convert.ToInt32(this.numericUpDown1.Value)), avgLevel);
- }
- }
- }
- /// <summary>
- /// 全部显示按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button6_Click(object sender, EventArgs e)
- {
- if (this.button6.Text == PdnResources.GetString("Menu.Showall.text"))
- {
- this.button6.Text = PdnResources.GetString("Menu.Cancelshowall.text");
- this.showAll = true;
- RefreshDataGridView2();
- }
- else if (this.button6.Text == PdnResources.GetString("Menu.Cancelshowall.text"))
- {
- this.button6.Text = PdnResources.GetString("Menu.Showall.text");
- this.showAll = false;
- RefreshDataGridView2();
- }
- }
- /// <summary>
- /// 删除按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button7_Click(object sender, EventArgs e)
- {
- if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
- {
- DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Determineallanalysisrlete.text") + "?", PdnResources.GetString("Menu.alert.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
- if (dr == DialogResult.OK)
- {
- for (int i = 0; i < this.listView2.SelectedItems.Count; i++)
- {
- string tableName = this.listView2.SelectedItems[i].Name;
- foreach (DataTable dt in resultTableList)
- {
- if (dt.TableName.Equals(tableName))
- {
- resultTableList.Remove(dt);
- break;
- }
- }
- if (bitDic.ContainsKey(tableName))
- bitDic.Remove(tableName);
- foreach (ExportProjectModel model in this.tempDataModel)
- {
- if (model.tagName.Equals(tableName))
- {
- this.tempDataModel.Remove(model);
- break;
- }
- }
- }
- foreach (ListViewItem item in this.listView2.Items)
- {
- if (item.Selected)
- this.listView2.Items.Remove(item);
- }
- RefreshDataGridView2();
- }
- }
- }
- /// <summary>
- /// 生成报告按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button8_Click(object sender, EventArgs e)
- {
- if (dataGridView2.Rows.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Noanalysineratereport.text") + "!");
- return;
- }
- if (this.checkBox1.Checked)
- this.button1.PerformClick();
- if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
- {
- //获取word书签与excel单元格的关系,以字典方式存储
- List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
- Dictionary<string, string> tagInfos = new Dictionary<string, string>();
- if (mic_module_infos != null && mic_module_infos.Count > 0)
- {
- foreach (mic_module_infos info in mic_module_infos)
- {
- tagInfos.Add(info.tag_name, info.cell_position);
- }
- }
- //分析结果
- List<List<string>> analysisContent = new List<List<string>>();
- List<string> contentHead = new List<string>();
- contentHead.Add(PdnResources.GetString("Menu.picture.Text"));
- contentHead.Add(PdnResources.GetString("Menu.view.text"));
- contentHead.Add(PdnResources.GetString("Menu.Highspeedtoolsteelcategory.text"));
- contentHead.Add(PdnResources.GetString("Menu.sizeed.text"));
- contentHead.Add(PdnResources.GetString("Menu.levdel.Text"));
- analysisContent.Add(contentHead);
- foreach (DataGridViewRow item in this.dataGridView2.Rows)
- {
- List<string> content = new List<string>();
- content.Add(item.Cells[0].Value.ToString());
- content.Add(item.Cells[1].Value.ToString());
- content.Add(item.Cells[2].Value.ToString());
- content.Add(item.Cells[3].Value.ToString());
- content.Add(item.Cells[4].Value.ToString());
- analysisContent.Add(content);
- }
- analysisContent.Add(new List<string>() { "\r" });
- foreach (DataGridViewRow item in this.dataGridView3.Rows)
- {
- List<string> content = new List<string>();
- content.Add(item.Cells[0].Value.ToString());
- content.Add(item.Cells[1].Value.ToString());
- content.Add(item.Cells[2].Value.ToString());
- content.Add(item.Cells[3].Value.ToString());
- content.Add(item.Cells[4].Value.ToString());
- analysisContent.Add(content);
- }
- //图片
- bitList = new List<Bitmap>();
- if (this.showAll)
- {
- foreach (KeyValuePair<string, List<Bitmap>> kv in this.bitDic)
- {
- bitList.Add(kv.Value[0]);
- bitList.Add(kv.Value[1]);
- }
- }
- else
- {
- if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
- {
- foreach (ListViewItem item in this.listView2.SelectedItems)
- {
- if (bitDic.ContainsKey(item.Name))
- {
- bitList.Add(bitDic[item.Name][0]);
- bitList.Add(bitDic[item.Name][1]);
- }
- }
- }
- }
- this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, bitList, tagInfos);
- }
- else
- MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text") + "!");
- }
- /// <summary>
- /// 导出结果按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button9_Click(object sender, EventArgs e)
- {
- if (this.dataGridView2.Rows.Count > 0)
- {
- SaveFileDialog exe = new SaveFileDialog();
- exe.Filter = "Execl files (*.xlsx)|*.xlsx";
- exe.FilterIndex = 0;
- exe.RestoreDirectory = true;
- //exe.CreatePrompt = true;
- exe.Title = "Export Excel File";
- exe.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
- exe.FileName = PdnResources.GetString("Menu.Highspeedsteelbulkcarbo.Text") + PdnResources.GetString("Menu.Analysisresult.text") + DateTime.Now.ToString("yyyyMMddHHmmss");
- DialogResult dr = exe.ShowDialog();
- if (dr != DialogResult.OK)
- return;
- DataTable dtb = new DataTable();
- dtb.Columns.Add(PdnResources.GetString("Menu.picture.Text"));
- dtb.Columns.Add(PdnResources.GetString("Menu.view.text"));
- dtb.Columns.Add(PdnResources.GetString("Menu.Highspeedtoolsteelcategory.text"));
- dtb.Columns.Add(PdnResources.GetString("Menu.sizeed.text"));
- dtb.Columns.Add(PdnResources.GetString("Menu.levdel.Text"));
- for (int i = 0; i < this.dataGridView2.Rows.Count; i++)
- {
- DataRow dataRow = dtb.NewRow();
- dataRow[PdnResources.GetString("Menu.picture.Text")] = this.dataGridView2.Rows[i].Cells[0].Value;
- dataRow[PdnResources.GetString("Menu.view.text")] = this.dataGridView2.Rows[i].Cells[1].Value;
- dataRow[PdnResources.GetString("Menu.Highspeedtoolsteelcategory.text")] = this.dataGridView2.Rows[i].Cells[2].Value;
- dataRow[PdnResources.GetString("Menu.sizeed.text")] = this.dataGridView2.Rows[i].Cells[3].Value;
- dataRow[PdnResources.GetString("Menu.levdel.Text")] = this.dataGridView2.Rows[i].Cells[4].Value;
- dtb.Rows.Add(dataRow);
- }
- DataTable dtb1 = new DataTable();
- dtb1.Columns.Add(PdnResources.GetString("Menu.picture.Text"));
- dtb1.Columns.Add(PdnResources.GetString("Menu.view.text"));
- dtb1.Columns.Add(PdnResources.GetString("Menu.Highspeedtoolsteelcategory.text"));
- dtb1.Columns.Add(PdnResources.GetString("Menu.sizeed.text"));
- dtb1.Columns.Add(PdnResources.GetString("Menu.levdel.Text"));
- for (int i = 0; i < this.dataGridView3.Rows.Count; i++)
- {
- DataRow dataRow = dtb1.NewRow();
- dataRow[PdnResources.GetString("Menu.picture.Text")] = this.dataGridView3.Rows[i].Cells[0].Value;
- dataRow[PdnResources.GetString("Menu.view.text")] = this.dataGridView3.Rows[i].Cells[1].Value;
- dataRow[PdnResources.GetString("Menu.Highspeedtoolsteelcategory.text")] = this.dataGridView3.Rows[i].Cells[2].Value;
- dataRow[PdnResources.GetString("Menu.sizeed.text")] = this.dataGridView3.Rows[i].Cells[3].Value;
- dataRow[PdnResources.GetString("Menu.levdel.Text")] = this.dataGridView3.Rows[i].Cells[4].Value;
- dtb1.Rows.Add(dataRow);
- }
- List<DataTable> list = new List<DataTable>();
- list.Add(dtb);
- list.Add(dtb1);
- this.appWorkspace.ExportDataToExcelWithProgress(list, exe.FileName, true, false, true);
- }
- else
- MessageBox.Show(PdnResources.GetString("Menu.Noanalysineratereport.text") + "!");
- }
- /// <summary>
- /// 图像索引切换选中事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- int sum;//判断是否二值过
- private void listView1_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (this.listView1.FocusedItem != null && this.listView1.FocusedItem.Selected)
- {
- //获取标尺-微米
- unitLength = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRuler(MeasurementUnit.Micron);
- GetListParamModel();
- sum = 0;
- this.dataGridView1.Rows.Clear();
- if (this.documentWorkspace.PhaseModels.Count > 1)
- this.documentWorkspace.PhaseModels.Remove(this.documentWorkspace.PhaseModels[1]);
- this.documentWorkspace.GraphicsList = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GraphicsList;
- this.bitmap = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
- //二值化集成5
- binaryClass.listView1_SelectedIndexChangedNoCheckedChanged(this.bitmap, this.imageList1.Images.Keys[this.listView1.FocusedItem.Index]);
- this.documentWorkspace.Visible = true;
- this.commonControlButtons.Visible = true;
- changeColor = false;
- isFirstSwitch = true;
- if (sum == 0)
- {
- if (bcOriginChecked() || !bcBinaryChecked())
- {
- this.documentWorkspace.PhaseModels[1].choise = false;
- }
- else
- {
- this.documentWorkspace.PhaseModels[1].choise = true;
- }
- ResetAreaAndContent();
- ReloadDebrisSelection();
- }
- else
- {
- if (bcOriginChecked() || !bcBinaryChecked())
- {
- this.documentWorkspace.PhaseModels[1].choise = false;
- }
- else
- {
- this.documentWorkspace.PhaseModels[1].choise = true;
- }
- this.documentWorkspace.Refresh();
- }
- sum = 0;
- }
- }
- /// <summary>
- /// 计算指定索引列的平均值-暂时没用到
- /// </summary>
- /// <param name="ColumnIndex"></param>
- /// <returns></returns>
- private double CalculateAverage(int ColumnIndex)
- {
- double sum = 0;
- double avg = 0;
- if (this.dataGridView1.Rows.Count > 0)
- {
- for (int i = 0; i < this.dataGridView1.Rows.Count - 1; i++)
- {
- try
- {
- double cellValue = double.Parse(this.dataGridView1.Rows[i].Cells[ColumnIndex].Value.ToString());
- sum += cellValue;
- }
- catch (Exception e)
- {
- continue;
- }
- }
- avg = sum / this.dataGridView1.Rows.Count - 1;
- }
- return avg;
- }
- /// <summary>
- /// 分析结果列表选择切换
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void listView2_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (this.showAll)
- return;
- RefreshDataGridView2();
- }
- /// <summary>
- /// 刷新数据展示表
- /// </summary>
- private void RefreshDataGridView1()
- {
- this.dataGridView1.Rows.Clear();
- if (dtDataGridView1 != null && dtDataGridView1.Rows.Count > 0)
- {
- dataGridView1.Rows.Add(dtDataGridView1.Rows.Count);//增加同等数量的行数
- int i = 0;
- foreach (DataRow row in dtDataGridView1.Rows)//逐个读取单元格的内容;
- {
- DataGridViewRow r1 = dataGridView1.Rows[i];
- r1.Cells[0].Value = row.RowState.ToString();
- for (int j = 0; j < dtDataGridView1.Columns.Count; j++)
- {
- if (j == 0 || j == 1 || j == 3)
- {
- r1.Cells[j].Value = row[j].ToString();
- }
- else
- {
- r1.Cells[j].Value = Math.Round(double.Parse(string.IsNullOrEmpty(row[j].ToString()) ? "0" :
- row[j].ToString()), Convert.ToInt32(this.numericUpDown1.Value));
- }
- }
- i++;
- }
- }
- }
- private void colorsForm1Changed(object sender, EventArgs e)
- {
- binaryClass.SetBinaryBackColor(this.colorsForm1.UserPrimaryColor.ToColor());
- this.colorsForm1.Close();
- changeColor = true;
- ReLoadBinarization();
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 最大尺寸碳化物颜色panel被点击
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void panel2_Click(object sender, EventArgs e)
- {
- this.colorsForm2.UserPrimaryColor = ColorBgra.FromColor(this.panel2.BackColor);
- this.colorsForm2.ShowDialog();
- }
- private void colorsForm2Changed(object sender, EventArgs e)
- {
- this.panel2.BackColor = this.colorsForm2.UserPrimaryColor.ToColor();
- this.colorsForm2.Close();
- changeColor = true;
- ReLoadBinarization();
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 小数数字框值改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void numericUpDown1_ValueChanged(object sender, EventArgs e)
- {
- if (this.numericUpDown1.Value > this.numericUpDown1.Maximum)
- this.numericUpDown1.Value = this.numericUpDown1.Maximum;
- if (this.numericUpDown1.Value < this.numericUpDown1.Minimum)
- this.numericUpDown1.Value = this.numericUpDown1.Minimum;
- RefreshDataGridView1();
- RefreshDataGridView2();
- }
- /// <summary>
- /// 是否筛选
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void checkBox3_CheckedChanged(object sender, EventArgs e)
- {
- if (this.documentWorkspace == null || this.documentWorkspace.CompositionSurface == null)
- return;
- if (bcBinaryChecked() && this.checkBox3.Checked)
- {
- ReloadDebrisSelection();
- changeColor = false;
- if (!bcOriginChecked())
- {
- if (bcBinaryChecked())
- {
- this.documentWorkspace.PhaseModels[0].choise = false;
- this.documentWorkspace.PhaseModels[1].choise = true;
- }
- }
- }
- else if (bcBinaryChecked() && !this.checkBox3.Checked)
- {
- changeColor = false;
- ReLoadBinarization();
- if (!bcOriginChecked())
- {
- if (bcBinaryChecked())
- {
- this.documentWorkspace.PhaseModels[0].choise = false;
- this.documentWorkspace.PhaseModels[1].choise = true;
- }
- }
- }
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 二值处理
- /// </summary>
- /// <param name="colorOneStart"></param>
- /// <param name="colorOneEnd"></param>
- /// <param name="phaseColor"></param>
- /// <returns></returns>
- private unsafe Mat Binarization(int colorOneStart, int colorOneEnd, Color phaseColor)
- {
- Mat srcGray;
- if (mat.Type() == MatType.CV_8UC1)
- srcGray = mat;
- else
- srcGray = mat.CvtColor(ColorConversionCodes.BGR2GRAY);
- Mat src = new Mat(mat.Rows, mat.Cols, MatType.CV_8UC4, new Scalar(0, 0, 0, 0));
- int index0 = 0;
- byte* ptr0 = (byte*)mat.Data;
- int index1 = 0;
- byte* ptr1 = (byte*)srcGray.Data;
- int index2 = 0;
- byte* ptr2 = (byte*)src.Data;
- for (int o = 0; o < srcGray.Height; o++)
- {
- for (int p = 0; p < srcGray.Width; p++)
- {
- index0 = (int)((mat.Step() * o) + (p * 4));
- index1 = (int)((srcGray.Step() * o) + (p * 1));
- index2 = (int)((src.Step() * o) + (p * 4));
- if (ptr1[index1] >= colorOneStart && ptr1[index1] <= colorOneEnd)
- {
- if (isHadView)
- {
- if (ptr0[index0 + 3] != 0)
- {
- ptr2[index2] = phaseColor.B;
- ptr2[index2 + 1] = phaseColor.G;
- ptr2[index2 + 2] = phaseColor.R;
- ptr2[index2 + 3] = 255;
- }
- }
- else
- {
- ptr2[index2] = phaseColor.B;
- ptr2[index2 + 1] = phaseColor.G;
- ptr2[index2 + 2] = phaseColor.R;
- ptr2[index2 + 3] = 255;
- }
- }
- }
- }
- return src;
- }
- /// <summary>
- /// 刷新二值效果
- /// </summary>
- private void ReLoadBinarization()
- {
- if (this.documentWorkspace.CompositionSurface == null)
- return;
- if (bcBinaryChecked())
- {
- ResetAreaAndContent();
- //if (this.checkBox3.Checked)
- ReloadDebrisSelection();
- }
- else
- {
- this.documentWorkspace.PhaseModels[0].mat = null;
- //phaseModel.choise = false;
- isFirstSwitch = false;
- this.dataGridView1.Rows.Clear();
- maxSize = 0;
- tempArea = null;
- maxCaliperDiameter = null;
- }
- this.documentWorkspace.Refresh();
- }
- DataTable dtDataGridView1 = null;
- DataTable dtResult = null;
- AppCommon appCommon = new AppCommon();
- /// <summary>
- /// 刷新颗粒筛选效果
- /// </summary>
- private void ReloadDebrisSelection()
- {
- if (this.documentWorkspace != null && this.documentWorkspace.PhaseModels[0].mat != null)
- {
- this.dataGridView1.Rows.Clear();
- dtDataGridView1 = new DataTable();
- double sumFinalSize = 0;
- List<List<OpenCvSharp.Point>> ps = new List<List<OpenCvSharp.Point>>();//轮廓的拓扑信息
- Mat temp = new Mat();//中间变量
- this.documentWorkspace.PhaseModels[0].mat.CopyTo(temp);
- if (this.documentWorkspace.GraphicsList.IsExsitView())
- {
- List<OpenCvSharp.Point[][]> points;//各石墨轮廓集合
- List<List<int>> lstAttribute;//各个视场属性集合,索引0-横坐标,1-纵坐标,2-视场宽度,3-视场高度,4-视场面积
- List<HierarchyIndex[]> hierarchyIndices;
- int sumFieldl; //视场个数
- Mat tempCopy = BinaryClass.BGRA2GRAY(this.documentWorkspace.PhaseModels[0].mat);
- Rect rectCopy;
- //调用处理视场方法
- appCommon.MultiFieldView(appWorkspace, this.documentWorkspace.PhaseModels[0].mat, listView1, documentWorkspace, out points, out lstAttribute, out sumFieldl,out hierarchyIndices);
- tempArea = new List<string>();
- maxCaliperDiameter = new List<string>();
- int h = 0;
- foreach (OpenCvSharp.Point[][] contours in points)
- {
- h++;
- maxSize = 0;
- maxPoint = new List<List<OpenCvSharp.Point>>();
- for (int i = 0; i < contours.Length; i++)
- {
- if (hierarchyIndices[h-1][i].Parent == -1)
- {
- for (int f = 0; f < contours[i].Length; f++)
- {
- contours[i][f].X = contours[i][f].X + lstAttribute[h - 1][0];
- contours[i][f].Y = contours[i][f].Y + lstAttribute[h - 1][1];
- }
- //int length = Cv2.FloodFill(tempCopy, contours[i][0], new Scalar(0, 0, 0, 0), out rectCopy, null, null, FloodFillFlags.Link8);
- double area = appCommon.Area(tempCopy, contours[i][0]);
- if (this.checkBox3.Checked)
- {
- if (area >= (this.trackBar2.Value / unitLength / unitLength) && area <= (this.trackBar4.Value / unitLength / unitLength))
- {
- ps.Add(contours[i].ToList());
- }
- else
- {
- if (contours[i].Length <= 5)
- continue;
- else
- {
- tempArea.Add((area * unitLength * unitLength).ToString());
- maxCaliperDiameter.Add((BasicCalculationHelper.CalcLongTrail(contours[i]) * 2 * unitLength).ToString());
- OpenCvSharp.RotatedRect rect = OpenCvSharp.Cv2.FitEllipse(contours[i]);
- float tempMax = (rect.Size.Width + rect.Size.Height) / 2f;
- if (maxSize < tempMax)
- {
- maxSize = tempMax;
- if (maxPoint.Count > 0)
- {
- maxPoint.Clear();
- maxPoint.Add(contours[i].ToList());
- }
- else
- maxPoint.Add(contours[i].ToList());
- }
- }
- }
- }
- else
- {
- if (contours[i].Length <= 5)
- continue;
- else
- {
- tempArea.Add((area * unitLength * unitLength).ToString());
- maxCaliperDiameter.Add((BasicCalculationHelper.CalcLongTrail(contours[i]) * 2 * unitLength).ToString());
- OpenCvSharp.RotatedRect rect = OpenCvSharp.Cv2.FitEllipse(contours[i]);
- float tempMax = (rect.Size.Width + rect.Size.Height) / 2f;//计算碳化物尺寸
- if (maxSize < tempMax)
- {
- maxSize = tempMax;
- if (maxPoint.Count > 0)
- {
- maxPoint.Clear();
- maxPoint.Add(contours[i].ToList());
- }
- else
- maxPoint.Add(contours[i].ToList());
- }
- }
- }
- }
-
- }
- string series = string.Empty;
- if (this.radioButton1.Checked)
- {
- if (this.radioButton3.Checked)
- series = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Tungsten.text") + PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.ColumnA.text");
- else
- series = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Tungsten.text") + PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.ColumnB.text");
- }
- else
- series = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Molybdenum.text");
- double finalSize = maxSize * unitLength;
- string level = string.Empty;
- if (this.radioButton1.Checked)
- {
- if (this.radioButton3.Checked)
- {
- if (finalSize < tungstenA[0])
- level = "1";
- else if (finalSize >= tungstenA[0] && finalSize <= tungstenA[1])
- level = "2";
- else if (finalSize >= tungstenA[1] && finalSize <= tungstenA[2])
- level = "3";
- else if (finalSize >= tungstenA[2] && finalSize <= tungstenA[3])
- level = "4";
- else
- level = "S";
- }
- else
- {
- if (finalSize < tungstenB[0])
- level = "1";
- else if (finalSize >= tungstenB[0] && finalSize <= tungstenB[1])
- level = "2";
- else if (finalSize >= tungstenB[1] && finalSize <= tungstenB[2])
- level = "3";
- else if (finalSize >= tungstenB[2] && finalSize <= tungstenB[3])
- level = "4";
- else
- level = "S";
- }
- }
- else
- {
- if (finalSize < molybdenum[0])
- level = "2";
- else if (finalSize >= molybdenum[0] && finalSize < molybdenum[1])
- level = "3";
- else if (finalSize >= molybdenum[1] && finalSize < molybdenum[2])
- level = "4";
- else if (finalSize >= molybdenum[2] && finalSize < molybdenum[3])
- level = "5";
- else if (finalSize >= molybdenum[3] && finalSize < molybdenum[4])
- level = "6";
- else
- level = "S";
- }
- this.dataGridView1.Rows.Add($"{PdnResources.GetString("Menu.view.text")}{h}", series, finalSize, level);
- sumFinalSize += finalSize;
- Cv2.FillPoly(temp, ps, new Scalar(0, 0, 0, 0));
- if (maxPoint.Count > 0)
- {
- Mat[] arr = temp.Split();
- temp = temp.CvtColor(ColorConversionCodes.BGRA2BGR);
- int hh = Cv2.FloodFill(temp, maxPoint[0][maxPoint[0].Count - 1], new Scalar(this.panel2.BackColor.B, this.panel2.BackColor.G, this.panel2.BackColor.R, 255));
- Mat[] arr2 = temp.Split();
- arr[0] = arr2[0];
- arr[1] = arr2[1];
- arr[2] = arr2[2];
- Cv2.Merge(arr, temp);
- }
- }
- if (sumFieldl > 1 && maxSize > 0)
- {
- string series = string.Empty;
- if (this.radioButton1.Checked)
- {
- if (this.radioButton3.Checked)
- series = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Tungsten.text") + PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.ColumnA.text");
- else
- series = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Tungsten.text") + PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.ColumnB.text");
- }
- else
- series = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Molybdenum.text");
- double avgFinalSize = sumFinalSize / sumFieldl;
- string avgLevel = string.Empty;
- if (this.radioButton1.Checked)
- {
- if (this.radioButton3.Checked)
- {
- if (avgFinalSize < tungstenA[0])
- avgLevel = "1";
- else if (avgFinalSize >= tungstenA[0] && avgFinalSize <= tungstenA[1])
- avgLevel = "2";
- else if (avgFinalSize >= tungstenA[1] && avgFinalSize <= tungstenA[2])
- avgLevel = "3";
- else if (avgFinalSize >= tungstenA[2] && avgFinalSize <= tungstenA[3])
- avgLevel = "4";
- else
- avgLevel = "S";
- }
- else
- {
- if (avgFinalSize < tungstenB[0])
- avgLevel = "1";
- else if (avgFinalSize >= tungstenB[0] && avgFinalSize <= tungstenB[1])
- avgLevel = "2";
- else if (avgFinalSize >= tungstenB[1] && avgFinalSize <= tungstenB[2])
- avgLevel = "3";
- else if (avgFinalSize >= tungstenB[2] && avgFinalSize <= tungstenB[3])
- avgLevel = "4";
- else
- avgLevel = "S";
- }
- }
- else
- {
- if (avgFinalSize < molybdenum[0])
- avgLevel = "2";
- else if (avgFinalSize >= molybdenum[0] && avgFinalSize < molybdenum[1])
- avgLevel = "3";
- else if (avgFinalSize >= molybdenum[1] && avgFinalSize < molybdenum[2])
- avgLevel = "4";
- else if (avgFinalSize >= molybdenum[2] && avgFinalSize < molybdenum[3])
- avgLevel = "5";
- else if (avgFinalSize >= molybdenum[3] && avgFinalSize < molybdenum[4])
- avgLevel = "6";
- else
- avgLevel = "S";
- }
- this.dataGridView1.Rows.Add(PdnResources.GetString("Menu.Image.Average.Text"), series, avgFinalSize, avgLevel);
- }
- if (tempCopy != null)
- {
- tempCopy.Release();
- }
- }
- else
- {
- OpenCvSharp.Point[][] contours;//原始轮廓信息
- HierarchyIndex[] hierachy;
- Mat tempCopy = BinaryClass.BGRA2GRAY(this.documentWorkspace.PhaseModels[0].mat);
- //Rect rectCopy;
- Cv2.FindContours(BinaryClass.BGRA2GRAY(this.documentWorkspace.PhaseModels[0].mat), out contours, out hierachy, RetrievalModes.CComp, ContourApproximationModes.ApproxNone);
- maxSize = 0;
- maxPoint = new List<List<OpenCvSharp.Point>>();
- for (int i = 0; i < hierachy.Length; i++)
- {
- if (hierachy[i].Parent == -1)
- {
- //int length = Cv2.FloodFill(tempCopy, contours[i][0], new Scalar(0, 0, 0, 0), out rectCopy, null, null, FloodFillFlags.Link8);
- double area = appCommon.Area(tempCopy, contours[i][0]);
- if (this.checkBox3.Checked)
- {
- if (area >= (this.trackBar2.Value / unitLength / unitLength) && area <= (this.trackBar4.Value / unitLength / unitLength))
- {
- ps.Add(contours[i].ToList());
- }
- else
- {
- if (contours[i].Length <= 5)
- continue;
- else
- {
- tempArea.Add((area * unitLength * unitLength).ToString());
- maxCaliperDiameter.Add((BasicCalculationHelper.CalcLongTrail(contours[i]) * 2 * unitLength).ToString());
- OpenCvSharp.RotatedRect rect = OpenCvSharp.Cv2.FitEllipse(contours[i]);
- float tempMax = (rect.Size.Width + rect.Size.Height) / 2f;
- if (maxSize < tempMax)
- {
- maxSize = tempMax;
- if (maxPoint.Count > 0)
- {
- maxPoint.Clear();
- maxPoint.Add(contours[i].ToList());
- }
- else
- maxPoint.Add(contours[i].ToList());
- }
- }
- }
- }
- else
- {
- if (contours[i].Length <= 5)
- continue;
- else
- {
- tempArea.Add((area * unitLength * unitLength).ToString());
- maxCaliperDiameter.Add((BasicCalculationHelper.CalcLongTrail(contours[i]) * 2 * unitLength).ToString());
- OpenCvSharp.RotatedRect rect = OpenCvSharp.Cv2.FitEllipse(contours[i]);
- float tempMax = (rect.Size.Width + rect.Size.Height) / 2f;//计算碳化物尺寸
- if (maxSize < tempMax)
- {
- maxSize = tempMax;
- if (maxPoint.Count > 0)
- {
- maxPoint.Clear();
- maxPoint.Add(contours[i].ToList());
- }
- else
- maxPoint.Add(contours[i].ToList());
- }
- }
- }
- }
- }
- if (maxSize > 0)
- {
- string series = string.Empty;
- if (this.radioButton1.Checked)
- {
- if (this.radioButton3.Checked)
- series = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Tungsten.text") + PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.ColumnA.text");
- else
- series = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Tungsten.text") + PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.ColumnB.text");
- }
- else
- series = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Molybdenum.text");
- double finalSize = maxSize * unitLength;
- string level = string.Empty;
- if (this.radioButton1.Checked)
- {
- if (this.radioButton3.Checked)
- {
- if (finalSize < tungstenA[0])
- level = "1";
- else if (finalSize >= tungstenA[0] && finalSize <= tungstenA[1])
- level = "2";
- else if (finalSize >= tungstenA[1] && finalSize <= tungstenA[2])
- level = "3";
- else if (finalSize >= tungstenA[2] && finalSize <= tungstenA[3])
- level = "4";
- else
- level = "S";
- }
- else
- {
- if (finalSize < tungstenB[0])
- level = "1";
- else if (finalSize >= tungstenB[0] && finalSize <= tungstenB[1])
- level = "2";
- else if (finalSize >= tungstenB[1] && finalSize <= tungstenB[2])
- level = "3";
- else if (finalSize >= tungstenB[2] && finalSize <= tungstenB[3])
- level = "4";
- else
- level = "S";
- }
- }
- else
- {
- if (finalSize < molybdenum[0])
- level = "2";
- else if (finalSize >= molybdenum[0] && finalSize < molybdenum[1])
- level = "3";
- else if (finalSize >= molybdenum[1] && finalSize < molybdenum[2])
- level = "4";
- else if (finalSize >= molybdenum[2] && finalSize < molybdenum[3])
- level = "5";
- else if (finalSize >= molybdenum[3] && finalSize < molybdenum[4])
- level = "6";
- else
- level = "S";
- }
- this.dataGridView1.Rows.Add(PdnResources.GetString("Menu.view.text") + "1", series, finalSize, level);
- }
- Cv2.FillPoly(temp, ps, new Scalar(0, 0, 0, 0));
- if (maxPoint.Count > 0)
- {
- Mat[] arr = temp.Split();
- temp = temp.CvtColor(ColorConversionCodes.BGRA2BGR);
- int h = Cv2.FloodFill(temp, maxPoint[0][maxPoint[0].Count - 1], new Scalar(this.panel2.BackColor.B, this.panel2.BackColor.G, this.panel2.BackColor.R, 255));
- Mat[] arr2 = temp.Split();
- arr[0] = arr2[0];
- arr[1] = arr2[1];
- arr[2] = arr2[2];
- Cv2.Merge(arr, temp);
- }
- if (tempCopy != null)
- {
- tempCopy.Release();
- }
- //Cv2.FillPoly(temp, maxPoint, new Scalar(this.panel2.BackColor.B, this.panel2.BackColor.G, this.panel2.BackColor.R, 255));
- }
- this.documentWorkspace.PhaseModels[1].mat = temp;
- this.documentWorkspace.Refresh();
- //数据结果保存
- dtDataGridView1 = appCommon.ResultDataSaving(dataGridView1);
- string imgName = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetFriendlyName();
- string tag = this.imageList1.Images.Keys[this.listView1.FocusedItem.Index];
- //dtResult = new DataTable(tag);
- //分析数据保存
- dtResult = appCommon.AnalysisDataSaving(dataGridView1, imgName, tag);
- if (dtDataGridView1.Rows.Count > 0)
- {
- RefreshDataGridView1();
- }
- if (bcOriginChecked())
- {
- appCommon.DisplayData(this.dataGridView1, false);
- }
- }
- }
- /// <summary>
- /// 刷新其他信息
- /// </summary>
- private void ResetAreaAndContent()
- {
- if (this.documentWorkspace.PhaseModels[0].mat != null && bcBinaryChecked())
- {
- OpenCvSharp.Point[][] contours;//原始轮廓信息
- HierarchyIndex[] hierachy;
- Mat temp = new Mat();
- this.documentWorkspace.PhaseModels[0].mat.CopyTo(temp);
- Mat tempCopy = BinaryClass.BGRA2GRAY(this.documentWorkspace.PhaseModels[0].mat);
- //Rect rectCopy;
- Cv2.FindContours(BinaryClass.BGRA2GRAY(this.documentWorkspace.PhaseModels[0].mat), out contours, out hierachy, RetrievalModes.CComp, ContourApproximationModes.ApproxNone);
- if (hierachy.Length > 0)
- {
- double maxArea = 0;//面积最大值
- double minArea = 9999999999;//面积最小值
- maxSize = 0;
- maxPoint = new List<List<OpenCvSharp.Point>>();
- tempArea = new List<string>();
- maxCaliperDiameter = new List<string>();
- for (int i = 0; i < hierachy.Length; i++)
- {
- if (hierachy[i].Parent == -1)
- {
- //int length = Cv2.FloodFill(tempCopy, contours[i][0], new Scalar(0, 0, 0, 0), out rectCopy, null, null, FloodFillFlags.Link8);
- double area = appCommon.Area(tempCopy, contours[i][0]);
- if (maxArea < area)
- maxArea = area;
- if (minArea > area)
- minArea = area;
- }
- //if (contours[i].Length <= 5)
- // continue;
- //else
- //{
- // tempArea.Add((area * unitLength).ToString());
- // maxCaliperDiameter.Add((BasicCalculationHelper.CalcLongTrail(contours[i]) * 2 * unitLength).ToString());
- // OpenCvSharp.RotatedRect rect = OpenCvSharp.Cv2.FitEllipse(contours[i]);
- // float tempMax = (rect.Size.Width + rect.Size.Height) / 2f;//计算碳化物尺寸
- // if(maxSize < tempMax)
- // {
- // maxSize = tempMax;
- // if (maxPoint.Count > 0)
- // {
- // maxPoint.Clear();
- // maxPoint.Add(contours[i].ToList());
- // }
- // else
- // maxPoint.Add(contours[i].ToList());
- // }
- //}
- }
- ////填充最大碳化物
- //Cv2.FillPoly(temp, maxPoint, new Scalar(this.panel2.BackColor.B, this.panel2.BackColor.G, this.panel2.BackColor.R, 255));
- //this.documentWorkspace.PhaseModels[1].mat = temp;
- if (!changeColor)
- {
- maxArea = maxArea * unitLength * unitLength;
- minArea = minArea * unitLength * unitLength;
- int maxNum = (int)Math.Ceiling(maxArea);//获取面积最大值
- int minNum = (int)Math.Floor(minArea);//获取面积最小值
- //先解绑事件以防数据赋值异常
- this.numericUpDown4.ValueChanged -= numericUpDown4_ValueChanged;
- this.numericUpDown5.ValueChanged -= numericUpDown5_ValueChanged;
- this.trackBar2.Scroll -= trackBar2_Scroll;
- this.trackBar4.Scroll -= trackBar4_Scroll;
- this.numericUpDown4.Maximum = maxNum;
- this.numericUpDown4.Minimum = minNum;
- this.trackBar2.Maximum = maxNum;
- this.trackBar2.Minimum = minNum;
- this.numericUpDown5.Maximum = maxNum;
- this.numericUpDown5.Minimum = minNum;
- this.trackBar4.Maximum = maxNum;
- this.trackBar4.Minimum = minNum;
- this.numericUpDown4.Value = minNum;
- this.trackBar2.Value = minNum;
- this.numericUpDown5.Value = maxNum;
- this.trackBar4.Value = maxNum;
- if (areaMin != -1 && areaMin >= this.numericUpDown4.Minimum && areaMin <= this.numericUpDown5.Maximum)
- {
- trackBar2.Value = (int)areaMin;
- this.numericUpDown4.Value = areaMin;
- }
- if (areaMax != -1 && areaMax >= this.numericUpDown4.Value && areaMax <= this.numericUpDown5.Maximum)
- {
- trackBar4.Value = (int)areaMax;
- this.numericUpDown5.Value = areaMax;
- }
- this.numericUpDown4.ValueChanged += new EventHandler(numericUpDown4_ValueChanged);
- this.numericUpDown5.ValueChanged += new EventHandler(numericUpDown5_ValueChanged);
- this.trackBar2.Scroll += new EventHandler(trackBar2_Scroll);
- this.trackBar4.Scroll += new EventHandler(trackBar4_Scroll);
- //if (dtDataGridView1.Rows.Count > 0)
- //{
- // RefreshDataGridView1();
- //}
- }
- }
- if (tempCopy != null)
- {
- tempCopy.Release();
- }
- }
- }
- private void radioButton1_CheckedChanged(object sender, EventArgs e)
- {
- //this.radioButton3.Enabled = true;
- //this.radioButton4.Enabled = true;
- //ReloadDebrisSelection();
- }
- private void radioButton2_CheckedChanged(object sender, EventArgs e)
- {
- if (this.radioButton2.Checked)
- {
- this.radioButton3.Enabled = false;
- this.radioButton4.Enabled = false;
- }
- else
- {
- this.radioButton3.Enabled = true;
- this.radioButton4.Enabled = true;
- }
- ReloadDebrisSelection();
- }
- private void radioButton3_CheckedChanged(object sender, EventArgs e)
- {
- ReloadDebrisSelection();
- }
- private void radioButton4_CheckedChanged(object sender, EventArgs e)
- {
- //RefreshDataGridView1();
- }
- /// <summary>
- /// 颗粒筛选范围最小值
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void numericUpDown4_ValueChanged(object sender, EventArgs e)
- {
- if (this.numericUpDown4.Value > this.numericUpDown5.Value)
- this.numericUpDown4.Value = this.numericUpDown5.Value;
- this.trackBar2.Value = Convert.ToInt32(this.numericUpDown4.Value);
- areaMin = this.numericUpDown4.Value;
- areaMax = this.numericUpDown5.Value;
- if (this.checkBox3.Checked && bcBinaryChecked())
- ReloadDebrisSelection();
- }
- /// <summary>
- /// 颗粒筛选范围最大值
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void numericUpDown5_ValueChanged(object sender, EventArgs e)
- {
- if (this.numericUpDown5.Value < this.numericUpDown4.Value)
- this.numericUpDown5.Value = this.numericUpDown4.Value;
- this.trackBar4.Value = Convert.ToInt32(this.numericUpDown5.Value);
- areaMin = this.numericUpDown4.Value;
- areaMax = this.numericUpDown5.Value;
- if (this.checkBox3.Checked && bcBinaryChecked())
- ReloadDebrisSelection();
- }
- /// <summary>
- /// 颗粒筛选最小值滚动条
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void trackBar2_Scroll(object sender, EventArgs e)
- {
- this.numericUpDown4.Value = this.trackBar2.Value;
- }
- /// <summary>
- /// 颗粒筛选最大值滚动条
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void trackBar4_Scroll(object sender, EventArgs e)
- {
- this.numericUpDown5.Value = this.trackBar4.Value;
- }
- /// <summary>
- /// 是否二值化
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void checkBox2_CheckedChanged(object sender, EventArgs e)
- {
- if (this.documentWorkspace.CompositionSurface == null)
- return;
- if (!bcBinaryChecked())
- this.checkBox3.Checked = false;
- changeColor = false;
- ReLoadBinarization();
- }
- /// <summary>
- /// 导出项目到项目工程
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button3_Click(object sender, EventArgs e)
- {
- try
- {
- if (dataGridView2.Rows.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Noanalysineratereport.text") + "!");
- return;
- }
- if (this.analyzeSettingModel == null)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text") + "!");
- return;
- }
- //获取项目工程内的文件夹路径
- ProjectEngineering.NodeItem item = this.appWorkspace.GetInsertProjectPath(2, "Menu.DedicatedAnalysis.BlackMetal.HighSpeedSteelCarbonBlock.Text", this.analyzeSettingModel.savePath);
- if (item != null)
- {
- //向文件夹内保存图片和报告
- if (!string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
- {
- //获取word书签与excel单元格的关系,以字典方式存储
- List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
- Dictionary<string, string> tagInfos = new Dictionary<string, string>();
- if (mic_module_infos != null && mic_module_infos.Count > 0)
- {
- foreach (mic_module_infos info in mic_module_infos)
- {
- tagInfos.Add(info.tag_name, info.cell_position);
- }
- }
- //分析结果
- List<List<string>> analysisContent = new List<List<string>>();
- List<string> contentHead = new List<string>();
- contentHead.Add(PdnResources.GetString("Menu.picture.Text"));
- contentHead.Add(PdnResources.GetString("Menu.view.text"));
- contentHead.Add(PdnResources.GetString("Menu.Highspeedtoolsteelcategory.text"));
- contentHead.Add(PdnResources.GetString("Menu.sizeed.text"));
- contentHead.Add(PdnResources.GetString("Menu.levdel.Text"));
- analysisContent.Add(contentHead);
- foreach (DataGridViewRow rowItem in this.dataGridView2.Rows)
- {
- List<string> content = new List<string>();
- content.Add(rowItem.Cells[0].Value.ToString());
- content.Add(rowItem.Cells[1].Value.ToString());
- content.Add(rowItem.Cells[2].Value.ToString());
- content.Add(rowItem.Cells[3].Value.ToString());
- content.Add(rowItem.Cells[4].Value.ToString());
- analysisContent.Add(content);
- }
- analysisContent.Add(new List<string>() { "\r" });
- foreach (DataGridViewRow rowItem in this.dataGridView3.Rows)
- {
- List<string> content = new List<string>();
- content.Add(rowItem.Cells[0].Value.ToString());
- content.Add(rowItem.Cells[1].Value.ToString());
- content.Add(rowItem.Cells[2].Value.ToString());
- content.Add(rowItem.Cells[3].Value.ToString());
- content.Add(rowItem.Cells[4].Value.ToString());
- analysisContent.Add(content);
- }
- //图片
- bitList = new List<Bitmap>();
- if (this.showAll)
- {
- foreach (KeyValuePair<string, List<Bitmap>> kv in this.bitDic)
- {
- bitList.Add(kv.Value[0]);
- bitList.Add(kv.Value[1]);
- }
- }
- else
- {
- if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
- {
- foreach (ListViewItem rowItem in this.listView2.SelectedItems)
- {
- if (bitDic.ContainsKey(rowItem.Name))
- {
- bitList.Add(bitDic[rowItem.Name][0]);
- bitList.Add(bitDic[rowItem.Name][1]);
- }
- }
- }
- }
- //中间数据
- if (!this.showAll)
- {
- if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
- {
- List<ExportProjectModel> exportModel = new List<ExportProjectModel>();
- foreach (ListViewItem rowItem in this.listView2.SelectedItems)
- {
- foreach (ExportProjectModel model in this.tempDataModel)
- {
- if (model.tagName.Equals(rowItem.Name))
- {
- ExportProjectModel tempModel = new ExportProjectModel();
- tempModel.tagName = model.tagName;
- tempModel.picName = model.picName;
- tempModel.dataList = model.dataList;
- exportModel.Add(tempModel);
- break;
- }
- }
- }
- this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, exportModel, bitList, tagInfos, item.path, item.code);
- }
- }
- else
- this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, tempDataModel, bitList, tagInfos, item.path, item.code);
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text") + "!");
- return;
- }
- //保存项目信息到数据库
- this.appWorkspace.InsertIntoDB(this.analyzeSettingModel, item);
- }
- }
- catch (Exception)
- {
- }
- }
- #region 参数保存及提取
- /// <summary>
- /// 保存参数的key,value和type
- /// </summary>
- /// <param name="param_key"></param>
- /// <param name="param_value"></param>
- /// <param name="param_type"></param>
- private void saveParamValue(string param_key, string param_value, int param_type)
- {
- bool foundItem = false;
- if (!this.eachData.ContainsKey(GetImgKey())) {
- GrainSizeAnalysisModel analysisItem = new GrainSizeAnalysisModel();
- analysisItem.menuId = this.menuId;
- analysisItem.param_key = param_key;
- analysisItem.param_type = param_type;
- analysisItem.param_value = param_value;
- analysisItem.setValue();
- analysisItem.ListParam = new List<GrainSizeAnalysisModel>();
- analysisItem.ListParam.Add(analysisItem);
- this.eachData.Add(GetImgKey(), analysisItem);
- }
- foreach (var item in this.eachData[GetImgKey()].ListParam)
- {
- if (item.param_key.Equals(param_key) && item.menuId == this.menuId)
- {
- item.param_value = param_value;
- item.setValue();
- foundItem = true;
- break;
- }
- }
- if (!foundItem)
- {
- GrainSizeAnalysisModel analysisItem = new GrainSizeAnalysisModel();
- analysisItem.menuId = this.menuId;
- analysisItem.param_key = param_key;
- analysisItem.param_type = param_type;
- analysisItem.param_value = param_value;
- analysisItem.setValue();
- this.eachData[GetImgKey()].ListParam.Add(analysisItem);
- }
- }
- /// <summary>
- /// 保存界面中的参数到model
- /// </summary>
- private void saveDialogParamValues()
- {
- saveParamValue(ParamKey_Report, checkBox1.Checked ? "0" : "1", (int)PaintDotNet.Base.Dtryt.Boolean);//报告设置
- saveParamValue(ParamKey_Screen, checkBox3.Checked ? "0" : "1", (int)PaintDotNet.Base.Dtryt.Boolean);//筛选
- saveParamValue(ParamKey_ScreenMin, numericUpDown4 != null ? numericUpDown4.Value.ToString() : "", (int)PaintDotNet.Base.Dtryt.Decimal);//面积最小值
- saveParamValue(ParamKey_ScreenMax, numericUpDown5 != null ? numericUpDown5.Value.ToString() : "", (int)PaintDotNet.Base.Dtryt.Decimal);//面积最大值
- saveParamValue(ParamKey_Tungsten, radioButton1.Checked ? "0" : "1", (int)PaintDotNet.Base.Dtryt.Boolean);//钨
- saveParamValue(ParamKey_Molybdenum, radioButton2.Checked ? "0" : "1", (int)PaintDotNet.Base.Dtryt.Boolean);//钼
- saveParamValue(ParamKey_ColumnA, radioButton3.Checked ? "0" : "1", (int)PaintDotNet.Base.Dtryt.Boolean);//A列
- saveParamValue(ParamKey_ColumnB, radioButton4.Checked ? "0" : "1", (int)PaintDotNet.Base.Dtryt.Boolean);//B列
- saveParamValue(ParamKey_MaxColour, panel2.BackColor.ToArgb().ToString(), (int)Base.Dtryt.Color);//最大色
- saveParamValue(ParamKey_DecimalPlace, numericUpDown1 != null ? numericUpDown1.Value.ToString() : "", (int)Base.Dtryt.Decimal);//保留小数位数
- }
- /// <summary>
- /// 获取保存的参数
- /// </summary>
- private void GetListParamModel()
- {
- if (this.eachData.ContainsKey(GetImgKey()) && this.eachData[GetImgKey()] != null )
- {
- for (int i = 0; i < this.eachData[GetImgKey()].ListParam.Count; i++)
- {
- switch (this.eachData[GetImgKey()].ListParam[i].param_key)
- {
- case ParamKey_Report:
- checkBox1.Checked = (Boolean)this.eachData[GetImgKey()].ListParam[i].value;
- break;
- case ParamKey_Screen:
- checkBox3.Checked = (Boolean)this.eachData[GetImgKey()].ListParam[i].value;
- break;
- case ParamKey_ScreenMin:
- areaMin = decimal.Parse(this.eachData[GetImgKey()].ListParam[i].param_value);
- break;
- case ParamKey_ScreenMax:
- areaMax = decimal.Parse(this.eachData[GetImgKey()].ListParam[i].param_value);
- break;
- case ParamKey_Tungsten:
- radioButton1.Checked = (Boolean)this.eachData[GetImgKey()].ListParam[i].value;
- break;
- case ParamKey_Molybdenum:
- radioButton2.Checked = (Boolean)this.eachData[GetImgKey()].ListParam[i].value;
- break;
- case ParamKey_ColumnA:
- radioButton3.Checked = (Boolean)this.eachData[GetImgKey()].ListParam[i].value;
- break;
- case ParamKey_ColumnB:
- radioButton4.Checked = (Boolean)this.eachData[GetImgKey()].ListParam[i].value;
- break;
- case ParamKey_MaxColour:
- panel2.BackColor = Color.FromArgb((int)this.eachData[GetImgKey()].ListParam[i].value);
- break;
- case ParamKey_DecimalPlace:
- numericUpDown1.Value = decimal.Parse(this.eachData[GetImgKey()].ListParam[i].param_value);
- break;
- }
- }
- }
- }
- /// <summary>
- /// 获取XML保存的参数
- /// </summary>
- private void GetXmlParameter()
- {
- string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml";
- GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));
- for (int i = 0; i < listView1.Items.Count; i++)
- {
- if (this.eachData.ContainsKey(listView1.Items[i].Index.ToString()))
- {
- this.eachData[listView1.Items[i].Index.ToString()] = analysisModelXml.cloneListParamModel(this.menuId);
- }
- else {
- this.eachData.Add(listView1.Items[i].Index.ToString(), analysisModelXml.cloneListParamModel(this.menuId));
- }
- }
- foreach (var item in this.eachData[GetImgKey()].ListParam)
- item.setValue();
- }
- /// <summary>
- /// 保存参数,防止没有图片
- /// </summary>
- private void NullKey()
- {
- GrainSizeAnalysisModel grainsizeanalysismodel = new GrainSizeAnalysisModel();
- grainsizeanalysismodel.ListParam = new List<GrainSizeAnalysisModel>();
- this.eachData.Add("null", grainsizeanalysismodel);
- }
- private string GetImgKey()
- {
- string key = this.listView1.FocusedItem != null ? this.listView1.FocusedItem.Index.ToString() : "null";
- return key;
- }
- #endregion
- private void button5_Click(object sender, EventArgs e)
- {
- if (this.listView1.FocusedItem == null)
- {
- return;
- }
- binaryClass.saveParams();
- binaryClass.applyToAll(this.imageList1.Images.Keys, this.imageList1.Images.Keys[int.Parse(GetImgKey())]);
- saveDialogParamValues();
- GrainSizeAnalysisModel data = new GrainSizeAnalysisModel();
- if (eachData.ContainsKey(GetImgKey()))
- {
- data = eachData[GetImgKey()];
- }
- for (int i = 0; i < listView1.Items.Count; i++)
- {
- eachData[i.ToString()] = data.cloneListParamModel(this.menuId);
- this.listView1.EnsureVisible(i);
- this.listView1.Items[i].Focused = true;
- this.listView1.Items[i].Selected = true;
- }
- }
- private bool blSaveAll = false;
- private void button4_Click(object sender, EventArgs e)
- {
- if (this.listView1.FocusedItem == null)
- {
- return;
- }
- if (eachData.Count - 1 != listView1.Items.Count)
- {
- MessageBox.Show("请先点击应用全部!");
- return;
- }
- saveDialogParamValues();
- int current = int.Parse(GetImgKey());
- for (int i = 0; i < listView1.Items.Count; i++)
- {
- this.listView1.EnsureVisible(i);
- this.listView1.Items[i].Focused = true;
- this.listView1.Items[i].Selected = true;
- this.button2.PerformClick();
- blSaveAll = true;
- }
- this.listView1.EnsureVisible(current);
- this.listView1.Items[current].Focused = true;
- this.listView1.Items[current].Selected = true;
- blSaveAll = false;
- }
- private void listView1_MouseDown(object sender, MouseEventArgs e)
- {
- if (this.listView1.FocusedItem != null)
- saveDialogParamValues();
- }
- #region [脚本相关]
- private void getValue(string key, object value) {
- switch (key)
- {
- case "parameter1":
- checkBox3.Checked = Convert.ToBoolean(value);
- break;
- case "parameter2":
- int min = Convert.ToInt32(value);
- decimal minDec = Convert.ToDecimal(value);
- if (bcBinaryChecked())
- {
- if (trackBar2.Minimum > min || trackBar2.Maximum < min)
- {
- trackBar2.Value = trackBar2.Minimum;
- }
- else {
- trackBar2.Value = min;
- }
- if (numericUpDown4.Minimum > min || numericUpDown4.Maximum < min)
- {
- numericUpDown4.Value = numericUpDown4.Minimum;
- }
- else {
- numericUpDown4.Value = minDec;
- }
- }
- break;
- case "parameter3":
- int max = Convert.ToInt32(value);
- decimal maxDec = Convert.ToDecimal(value);
- if (bcBinaryChecked())
- {
- if (trackBar4.Minimum > max || trackBar4.Maximum < max)
- {
- trackBar4.Value = trackBar4.Maximum;
- }
- else
- {
- trackBar4.Value = max;
- }
- if (numericUpDown5.Minimum > max || numericUpDown5.Maximum < max)
- {
- numericUpDown5.Value = numericUpDown5.Maximum;
- }
- else
- {
- numericUpDown5.Value = maxDec;
- }
- }
- break;
- case "parameter4":
- int val = (int)value;
- radioButton1.Checked = val == 1 ? true : false;
- radioButton2.Checked = val == 1 ? false : true;
- break;
- case "parameter5":
- int val1 = (int)value;
- radioButton3.Checked = val1 == 1 ? true : false;
- radioButton4.Checked = val1 == 1 ? false : true;
- break;
- case "parameter6":
- int val2 = (int)value;
- panel2.BackColor = Color.FromArgb(val2);
- break;
- case "OpenWhileExportReport":
- checkBox1.Checked = Convert.ToBoolean(value);
- break;
- case "CalculatorDecimalDigits":
- numericUpDown1.Value = Convert.ToDecimal(value);
- break;
- case "ExportResults":
- isExportResults = Convert.ToBoolean(value);
- break;
- case "ExportReports":
- isExportReports = Convert.ToBoolean(value);
- break;
- case "ExportProjects":
- isExportProjects = Convert.ToBoolean(value);
- break;
- }
- }
- private void startScriptAutomaticAction() {
- this.button5.PerformClick();
- this.button4.PerformClick();
- this.button6.Text = PdnResources.GetString("Menu.Cancelshowall.text");
- this.showAll = true;
- RefreshDataGridView2();
- if (isExportResults)//导出结果
- this.button8.PerformClick();
- if (isExportReports)//生成报告
- this.button9.PerformClick();
- if (isExportProjects)//导出项目
- this.button3.PerformClick();
- this.appWorkspace.ScriptAutomatic = false;
- this.Close();
- }
- #endregion
- #region [脚本录制]
- private void getScriptRecording()
- {
- string className = InvariantData.path_Action + ".Action" + menuId;
- ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
- List<Args> args = param.Lists;
- foreach (var item in args)
- {
- item.value = setScriptRecording(item.key);
- }
- //找出二值相关参数 进行赋值
- List<Args> isNullList = args.Where(m => m.value == null).ToList();
- foreach (var item in isNullList)
- {
- item.value = binaryClass.setScriptRecording(item.key);
- }
- appWorkspace.SetScriptStartRecording(this.menuId, menuName, args);
- }
- private object setScriptRecording(string key)
- {
- object value = null;
- switch (key)
- {
- case "parameter1":
- value = checkBox3.Checked;
- break;
- case "parameter2":
- value = trackBar2.Value;
- break;
- case "parameter3":
- value = trackBar4.Value;
- break;
- case "parameter4":
- value = radioButton1.Checked ? 1 : 2;
- break;
- case "parameter5":
- value = radioButton3.Checked ? 1 : 2;
- break;
- case "parameter6":
- value = panel2.BackColor.ToArgb();
- break;
- case "OpenWhileExportReport":
- value = checkBox1.Checked;
- break;
- case "CalculatorDecimalDigits":
- value = numericUpDown1.Value;
- break;
- case "ExportResults":
- value = isExportResults;
- break;
- case "ExportReports":
- value = isExportReports;
- break;
- case "ExportProjects":
- value = isExportProjects;
- break;
- }
- return value;
- }
- #endregion
- }
- }
|