⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nodeproperties.cs

📁 基于BP算法的贝叶斯网络参数学习
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace bs
{
	/// <summary>
	/// NodeProperties 的摘要说明。
	/// </summary>
	public class NodeProperties : System.Windows.Forms.Form
	{
		private System.Windows.Forms.FontDialog fontDialog1;
		private System.Windows.Forms.TabPage tabPage1;
		private System.Windows.Forms.GroupBox groupBox2;
		private System.Windows.Forms.Label label9;
		public System.Windows.Forms.TextBox textBox2;
		public System.Windows.Forms.TextBox textBox1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Splitter splitter1;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.TabPage tabPage2;
		private System.Windows.Forms.TabControl tabControl1;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.Button button2;
		public Font font;
		private System.Windows.Forms.Button button3;
		private System.Windows.Forms.Button button4;
		private System.Windows.Forms.ColorDialog colorDialog1;
		public Color color;
		public ArrayList strState=new ArrayList();
		TextBox[] txt=new TextBox[100];
		public ArrayList txtList=new ArrayList();
		//public ArrayList s=new ArrayList();
		Label[] lbl=new Label[100];
		public bool increaseState=false;
		//private readonly Doc HostForm;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public NodeProperties( ArrayList property)
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			for(int i=0;i<property.Count;i++)
				//strState[i]=property[i].ToString();
				strState.Add(property[i].ToString());
			//textbox控件数组
		//	TextBox[] txt=new TextBox[property.Count+1];
			for(int i=0;i<strState.Count;i++)
			{
				txt[i] = new System.Windows.Forms.TextBox();

				txt[i].Text=property[i].ToString();
				txt[i].Location=new System.Drawing.Point(3,106+22*i);
				txt[i].Size=new System.Drawing.Size(209, 22);
				txt[i].AllowDrop = true;
				txt[i].Name="State"+i.ToString();
				txt[i].BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
				//txt.TabIndex = 4+i;
				//txt.Dock = System.Windows.Forms.DockStyle.Top;
		        txt[i].TextChanged+=new System.EventHandler(txttextBox_TextChanged);
               
				txtList.Add(txt);
				this.groupBox2.Controls.Add(txt[i]);
			}
			txt[property.Count] = new System.Windows.Forms.TextBox();
			txt[property.Count].Text="unassign";
			txt[property.Count].Location=new System.Drawing.Point(3,106+22*property.Count);
			txt[property.Count].Size=new System.Drawing.Size(209, 22);
			txt[property.Count].AllowDrop = true;
			//untxt.Name=
			txt[property.Count].BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			//untxt.TabIndex = 4+property.Count;
			//untxt.Dock = System.Windows.Forms.DockStyle.Top;
			txt[property.Count].TextChanged+=new System.EventHandler(untextBox_TextChanged);
          txtList.Add(txt);
			this.groupBox2.Controls.Add(txt[property.Count]);
			//MessageBox.Show(txtList.Count.ToString());
			

		/*	for(int i=0;i<property.Count;i++)
			{
				TextBox txt= new System.Windows.Forms.TextBox();
				//string ss=new string();

				txt.Text=property[i].ToString();
				txt.Location=new System.Drawing.Point(3,106+22*i);
				txt.Size=new System.Drawing.Size(209, 22);
				txt.AllowDrop = true;
				txt.Name="State"+i.ToString();
				txt.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
				//txt.TabIndex = 4+i;
				//txt.Dock = System.Windows.Forms.DockStyle.Top;
				txt.TextChanged+=new System.EventHandler(txttextBox_TextChanged);
               txtList.Add(txt);
				//ss=txt.Text;
				//s.Add(txt.Text);
			   //MessageBox.Show(txt.Text);
               
				
				this.groupBox2.Controls.Add(txt);
			}
			//for(int i=0;i<s.Count;i++)
				//MessageBox.Show(s[i].ToString());
			//for(int i=0;i<txtList.Count;i++)
				//txtList[i].
		

			TextBox utxt = new System.Windows.Forms.TextBox();
			utxt.Text="unassign";
			utxt.Location=new System.Drawing.Point(3,106+22*property.Count);
			utxt.Size=new System.Drawing.Size(209, 22);
			utxt.AllowDrop = true;
			//untxt.Name=
			utxt.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			//untxt.TabIndex = 4+property.Count;
			//untxt.Dock = System.Windows.Forms.DockStyle.Top;
			txtList.Add(utxt);

			this.groupBox2.Controls.Add(utxt);
*/
           //lable控件数组
		//	Label[] lbl=new Label[property.Count+1];
		    for(int i=1;i<=property.Count;i++)
			{   lbl[i-1]=new Label();
				//Label lbl=new Label();
				 lbl[i-1].Text="State"+i.ToString();
				 lbl[i-1].Location=new System.Drawing.Point(3,106+22*(i-1));
				 lbl[i-1].Size=new System.Drawing.Size(98, 22);
				 lbl[i-1].AllowDrop = true;
				 lbl[i-1].BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
				//txt.TabIndex = 4+i;
				//txt.Dock = System.Windows.Forms.DockStyle.Top;
				
				this.groupBox1.Controls.Add( lbl[i-1]);
			}
			//Label unlbl=new Label();
			int m=property.Count+1;
			lbl[m-1]=new Label();
			lbl[m-1].Text="State"+m.ToString();
			//unlbl.Text="State"+m.ToString();
			lbl[m-1].Location=new System.Drawing.Point(3,106+22*property.Count);
			lbl[m-1].Size=new System.Drawing.Size(98, 22);
			lbl[m-1].AllowDrop = true;
			lbl[m-1].BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			//untxt.TabIndex = 4+property.Count;
			//untxt.Dock = System.Windows.Forms.DockStyle.Top;
			this.groupBox1.Controls.Add(lbl[m-1]);

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
			
		}
		
		public void txttextBox_TextChanged(object sender,System.EventArgs e)
		{
			for(int i=0;i<strState.Count;i++)
			{
                strState[i] = txt[i].Text;
				//strState[i]=txt[i].Text;
				//MessageBox.Show(strState[i].ToString());
			}
		}

		public void untextBox_TextChanged(object sender,System.EventArgs e)	
		{
              increaseState=true;
			//txt[txtList.Count]=new TextBox();
			//txt[txtList.Count].Text="unassign";
			//txt[txtList.Count].Location=new System.Drawing.Point(3,106+22*(txtList.Count));
			//txt[txtList.Count].Size=new System.Drawing.Size(209, 22);
			//txt[txtList.Count].AllowDrop = true;
			//untxt.Name=
			//txt[txtList.Count].BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
		
			//strState.Add(txt.
		//strState.Add(txt[strState.Count].Text);
			//for(int i=0;i<strState.Count;i++)
			//{
			//	strState[i]=txt[i].Text;
				//MessageBox.Show(strState[i].ToString());
			//}
			//////////////////////////////////////////////////////////////////续昨天!!!!!!!!
			txt[strState.Count+1]=new TextBox();
			txtList.Add(txt[strState.Count+1]);
			//this.groupBox2.Controls.Add(txt[strState.Count+1]);
			strState.Add(txt[strState.Count].Text);
			//strState[strState.Count-1]=txt[strState.Count-1].Text;
			//strState.Add(txt[strState.Count].Text);
			//this.Refresh();
		/*	foreach(BNode1 node in HostForm.myNodeArray)
			{
				if(node.BackColor==Color.DarkGreen)
				{

					for(int i=0;i<HostForm.AssessNumRows(HostForm.Parent(node.name));i++)
						for(int j=0;j<node.State.Count;j++)
						{
							node.CPT[i,j]=0.500;
							//MessageBox.Show(node.CPT[i,j].ToString());
						}
				}
			}
			*/
			//strState[strState.Count]=txt[strState.Count].Text;
				//txtList.Add(txt);
		//	MessageBox.Show(txtList.Count.ToString());
			//this.groupBox2.Controls.Add(txt[txtList.Count]);
			//MessageBox.Show(strState[strState.Count-1].ToString());
		}
			
		
		
		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
            this.fontDialog1 = new System.Windows.Forms.FontDialog();
            this.tabPage1 = new System.Windows.Forms.TabPage();
            this.groupBox2 = new System.Windows.Forms.GroupBox();
            this.label9 = new System.Windows.Forms.Label();
            this.textBox2 = new System.Windows.Forms.TextBox();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.label2 = new System.Windows.Forms.Label();
            this.splitter1 = new System.Windows.Forms.Splitter();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.label5 = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.tabPage2 = new System.Windows.Forms.TabPage();
            this.button2 = new System.Windows.Forms.Button();
            this.button1 = new System.Windows.Forms.Button();
            this.tabControl1 = new System.Windows.Forms.TabControl();
            this.button3 = new System.Windows.Forms.Button();
            this.button4 = new System.Windows.Forms.Button();
            this.colorDialog1 = new System.Windows.Forms.ColorDialog();
            this.tabPage1.SuspendLayout();
            this.groupBox2.SuspendLayout();
            this.groupBox1.SuspendLayout();
            this.tabPage2.SuspendLayout();
            this.tabControl1.SuspendLayout();
            this.SuspendLayout();
            // 
            // tabPage1
            // 
            this.tabPage1.Controls.Add(this.groupBox2);
            this.tabPage1.Controls.Add(this.splitter1);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -