📄 复件 formmain.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.OleDb;
using System.Threading;
using mathfunsharp;
using System.Drawing.Drawing2D;
using OWNERDATASET;
using OWNERGRID;
//using Office;
using SimpleGA;
namespace expert
{
/// <summary>
/// FormMain 的摘要说明。
/// </summary>
public class FormMain : System.Windows.Forms.Form
{
#region field definition
private ProbControl myControl;
private myCriGridCtrl cridg;
private myExamGridCtrl examdg;
private myResultGridCtrl resultdg;
private myTemplateGridCtrl templatedg;
private myItemValueGridCtrl itemvaluedg;
private System.Windows.Forms.Splitter splitter1;
protected ImageList imageListtoolbar;
private System.Windows.Forms.MainMenu mainMenu;
private System.Windows.Forms.Splitter splitter2;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage critabPage;
private System.Windows.Forms.TabPage examtabPage;
private System.Windows.Forms.TabPage itemvaluetabPage;
private System.Windows.Forms.TabPage resulttabPage;
private System.Windows.Forms.TabPage templatetabPage;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem AboutMenu;
private YQGA myc;
#endregion
private System.Windows.Forms.TextBox output;
GAGEnomeSetting NomeS;
private TemplateMapping currTemplate;
Thread GAThread;
SimpleGA.YQGA.__Delegate_OnProgressStep OnProgressStepDelegate;
SimpleGA.YQGA.__Delegate_OnDone OnDoneDelegate;
SimpleGA.YQGA.__Delegate_OnSingleGeneration OnSingleGeneration;
private System.Windows.Forms.MenuItem menuAbortCurrentSample;
private System.Windows.Forms.MenuItem menuAbortAllSamples;
private System.Windows.Forms.MenuItem menuGA;
private System.Windows.Forms.MenuItem menuGAStart;
private System.Windows.Forms.MenuItem menuGASuspend;
private System.Windows.Forms.MenuItem menuGAResume;
private System.Windows.Forms.MenuItem menuGAAbort;
private System.Windows.Forms.MenuItem menuItem2;
private System.Windows.Forms.MenuItem templateReason;
private System.Windows.Forms.MenuItem templatereasonsetting;
private TemplateReasonSetting dlgTemplateReasonSetting;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public unsafe FormMain()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
imageListtoolbar = new ImageList () ;
// The default image size is 16 x 16, which sets up a larger
// image size.
imageListtoolbar.ImageSize = new Size(16,16);
//imageListtoolbar.TransparentColor = Color.White;
imageListtoolbar.Images.Add(Image.FromFile("btnupdate.bmp"));
myc=new YQGA();
NomeS=new GAGEnomeSetting();
NomeS.AdvisorBitScore.Text =myc.AdvisorBitScore.ToString();
NomeS.TargetBitScore.Text =myc.TargetBitScore.ToString();
NomeS.NegativeBitScore.Text =myc.NegativeBitScore.ToString();
NomeS.FullMatchScoreCoeff.Text=myc.FullMatchScoreCoeff.ToString();
NomeS.NnGenerations.Text =myc.NnGenerations.ToString();
NomeS.ProgressStep.Text =myc.ProgressStep.ToString();
NomeS.NpopulationSize.Text =myc.NpopulationSize.ToString();
NomeS.NnBestGenomes.Text =myc.NnBestGenomes.ToString();
NomeS.GAWidth.Text =myc.Width.ToString();
OnProgressStepDelegate=new SimpleGA.YQGA.__Delegate_OnProgressStep(GetProgressStep);
OnDoneDelegate=new SimpleGA.YQGA.__Delegate_OnDone(DoneReport);
OnSingleGeneration=new SimpleGA.YQGA.__Delegate_OnSingleGeneration(SingleGeneration);
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
NomeS.Dispose();
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.splitter1 = new System.Windows.Forms.Splitter();
this.mainMenu = new System.Windows.Forms.MainMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.AboutMenu = new System.Windows.Forms.MenuItem();
this.menuGA = new System.Windows.Forms.MenuItem();
this.menuGAStart = new System.Windows.Forms.MenuItem();
this.menuGASuspend = new System.Windows.Forms.MenuItem();
this.menuGAResume = new System.Windows.Forms.MenuItem();
this.menuAbortCurrentSample = new System.Windows.Forms.MenuItem();
this.menuAbortAllSamples = new System.Windows.Forms.MenuItem();
this.menuGAAbort = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.templateReason = new System.Windows.Forms.MenuItem();
this.templatereasonsetting = new System.Windows.Forms.MenuItem();
this.splitter2 = new System.Windows.Forms.Splitter();
this.panel1 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.critabPage = new System.Windows.Forms.TabPage();
this.examtabPage = new System.Windows.Forms.TabPage();
this.resulttabPage = new System.Windows.Forms.TabPage();
this.templatetabPage = new System.Windows.Forms.TabPage();
this.itemvaluetabPage = new System.Windows.Forms.TabPage();
this.output = new System.Windows.Forms.TextBox();
this.panel2.SuspendLayout();
this.tabControl1.SuspendLayout();
this.SuspendLayout();
//
// splitter1
//
this.splitter1.BackColor = System.Drawing.SystemColors.Desktop;
this.splitter1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.splitter1.Location = new System.Drawing.Point(267, 0);
this.splitter1.Name = "splitter1";
this.splitter1.Size = new System.Drawing.Size(8, 606);
this.splitter1.TabIndex = 1;
this.splitter1.TabStop = false;
//
// mainMenu
//
this.mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1,
this.menuGA,
this.menuItem2});
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.AboutMenu});
this.menuItem1.Text = "帮助";
//
// AboutMenu
//
this.AboutMenu.Index = 0;
this.AboutMenu.Text = "关于...";
this.AboutMenu.Popup += new System.EventHandler(this.AboutMenu_Popup);
this.AboutMenu.Click += new System.EventHandler(this.AboutMenu_Click);
//
// menuGA
//
this.menuGA.Index = 1;
this.menuGA.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuGAStart,
this.menuGASuspend,
this.menuGAResume,
this.menuAbortCurrentSample,
this.menuAbortAllSamples,
this.menuGAAbort});
this.menuGA.Text = "专家知识库";
this.menuGA.Popup += new System.EventHandler(this.menuGA_Popup);
//
// menuGAStart
//
this.menuGAStart.Index = 0;
this.menuGAStart.Text = "启动遗传算法生成模板";
this.menuGAStart.Click += new System.EventHandler(this.menuGAStart_Click);
//
// menuGASuspend
//
this.menuGASuspend.Index = 1;
this.menuGASuspend.Text = "暂停(挂起)";
this.menuGASuspend.Click += new System.EventHandler(this.menuGASuspend_Click);
//
// menuGAResume
//
this.menuGAResume.Index = 2;
this.menuGAResume.Text = "恢复";
this.menuGAResume.Click += new System.EventHandler(this.menuGAResume_Click);
//
// menuAbortCurrentSample
//
this.menuAbortCurrentSample.Index = 3;
this.menuAbortCurrentSample.Text = "终止当前样本的计算";
this.menuAbortCurrentSample.Click += new System.EventHandler(this.menuAbortCurrentSample_Click);
//
// menuAbortAllSamples
//
this.menuAbortAllSamples.Index = 4;
this.menuAbortAllSamples.Text = "终止剩余样本的计算";
this.menuAbortAllSamples.Click += new System.EventHandler(this.menuAbortAllSamples_Click);
//
// menuGAAbort
//
this.menuGAAbort.Index = 5;
this.menuGAAbort.Text = "立即终止";
this.menuGAAbort.Click += new System.EventHandler(this.menuGAAbort_Click);
//
// menuItem2
//
this.menuItem2.Index = 2;
this.menuItem2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.templateReason,
this.templatereasonsetting});
this.menuItem2.Text = "模板推理";
//
// templateReason
//
this.templateReason.Index = 0;
this.templateReason.Text = "模板推理";
this.templateReason.Click += new System.EventHandler(this.templateReason_Click);
//
// templatereasonsetting
//
this.templatereasonsetting.Index = 1;
this.templatereasonsetting.Text = "推理参数设置";
this.templatereasonsetting.Click += new System.EventHandler(this.templatereasonsetting_Click);
//
// splitter2
//
this.splitter2.BackColor = System.Drawing.SystemColors.Desktop;
this.splitter2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.splitter2.Dock = System.Windows.Forms.DockStyle.Top;
this.splitter2.Location = new System.Drawing.Point(275, 307);
this.splitter2.Name = "splitter2";
this.splitter2.Size = new System.Drawing.Size(653, 8);
this.splitter2.TabIndex = 3;
this.splitter2.TabStop = false;
//
// panel1
//
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(275, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(653, 307);
this.panel1.TabIndex = 4;
//
// panel2
//
this.panel2.Controls.Add(this.tabControl1);
this.panel2.Dock = System.Windows.Forms.DockStyle.Left;
this.panel2.Location = new System.Drawing.Point(0, 0);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(267, 606);
this.panel2.TabIndex = 5;
//
// tabControl1
//
this.tabControl1.Controls.Add(this.critabPage);
this.tabControl1.Controls.Add(this.examtabPage);
this.tabControl1.Controls.Add(this.resulttabPage);
this.tabControl1.Controls.Add(this.templatetabPage);
this.tabControl1.Controls.Add(this.itemvaluetabPage);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(267, 606);
this.tabControl1.TabIndex = 0;
//
// critabPage
//
this.critabPage.Location = new System.Drawing.Point(4, 24);
this.critabPage.Name = "critabPage";
this.critabPage.Size = new System.Drawing.Size(259, 578);
this.critabPage.TabIndex = 0;
this.critabPage.Text = "标准样本";
//
// examtabPage
//
this.examtabPage.Location = new System.Drawing.Point(4, 24);
this.examtabPage.Name = "examtabPage";
this.examtabPage.Size = new System.Drawing.Size(259, 578);
this.examtabPage.TabIndex = 1;
this.examtabPage.Text = "待测样本";
//
// resulttabPage
//
this.resulttabPage.Location = new System.Drawing.Point(4, 24);
this.resulttabPage.Name = "resulttabPage";
this.resulttabPage.Size = new System.Drawing.Size(259, 578);
this.resulttabPage.TabIndex = 2;
this.resulttabPage.Text = "解释结果";
//
// templatetabPage
//
this.templatetabPage.Location = new System.Drawing.Point(4, 24);
this.templatetabPage.Name = "templatetabPage";
this.templatetabPage.Size = new System.Drawing.Size(259, 578);
this.templatetabPage.TabIndex = 2;
this.templatetabPage.Text = "模板";
//
// itemvaluetabPage
//
this.itemvaluetabPage.Location = new System.Drawing.Point(4, 24);
this.itemvaluetabPage.Name = "itemvaluetabPage";
this.itemvaluetabPage.Size = new System.Drawing.Size(259, 578);
this.itemvaluetabPage.TabIndex = 3;
this.itemvaluetabPage.Text = "参数设置";
//
// output
//
this.output.Dock = System.Windows.Forms.DockStyle.Fill;
this.output.Location = new System.Drawing.Point(275, 315);
this.output.Multiline = true;
this.output.Name = "output";
this.output.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.output.Size = new System.Drawing.Size(653, 291);
this.output.TabIndex = 6;
this.output.Text = "";
//
// FormMain
//
this.AccessibleRole = System.Windows.Forms.AccessibleRole.Application;
this.AutoScaleBaseSize = new System.Drawing.Size(8, 18);
this.BackColor = System.Drawing.SystemColors.Info;
this.ClientSize = new System.Drawing.Size(928, 606);
this.Controls.Add(this.output);
this.Controls.Add(this.splitter2);
this.Controls.Add(this.panel1);
this.Controls.Add(this.splitter1);
this.Controls.Add(this.panel2);
this.Menu = this.mainMenu;
this.Name = "FormMain";
this.Text = "录井解释专家系统";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Resize += new System.EventHandler(this.FormMain_Resize);
this.Closing += new System.ComponentModel.CancelEventHandler(this.FormMain_Closing);
this.Load += new System.EventHandler(this.FormMain_Load);
this.panel2.ResumeLayout(false);
this.tabControl1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
try
{
int i=0;
Application.Run(new FormMain());
i++;
}
catch(System.Configuration.ConfigurationException e)
{
throw e;
}
catch(Exception e)
{
throw e;
}
}
private void FormMain_Load(object sender, System.EventArgs e)
{
myControl = new ProbControl();
myControl.Dock = System.Windows.Forms.DockStyle.Fill;
panel1.Controls.Add(myControl);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -