?? assessment.cs
字號:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace bs
{
/// <summary>
/// Assessment 的摘要說明。
/// </summary>
public class Assessment : System.Windows.Forms.Form
{
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Splitter splitter1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ListView listView1;
private bs.Grid grid1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
public double[][] f=new double[100][];
public int gridrows=0;
public int gridcols=0;
public string assessNode;
/// <summary>
/// 必需的設計器變量。
/// </summary>
private System.ComponentModel.Container components = null;
//private readonly Doc HostForm;
public Assessment(ArrayList strArray, string[][] str,ArrayList AssessNode,double[][] assessValue,string assNode)
{
//
// Windows 窗體設計器支持所必需的
//
InitializeComponent();
assessNode=assNode;
//grid1的處理
string[] ss=new string[AssessNode.Count];
// MessageBox.Show(AssessNode.Count.ToString());
for(int j=0;j<AssessNode.Count;j++)
{
ss[j]=AssessNode[j].ToString();
//MessageBox.Show(ss[j].ToString());
}
grid1.SetColumnNames(ss);
for(int i=1;i<=ss.Length;i++)
{
grid1.SetColumnWidthAndIgnoreFont(i, 90);
}
//把double型數值轉換為string加以顯示
string[][] Value=new string[assessValue.Length][];
for(int i=0;i<assessValue.Length;i++)
{
Value[i]=new string[assessValue[0].Length];
for(int j=0;j<assessValue[0].Length;j++)
{
Value[i][j]=assessValue[i][j].ToString();
}
}
for(int i=1;i<=str.Length;i++)
grid1.SetFullRow(i, Value[i-1]);
gridrows=assessValue.Length;
gridcols=assessValue[0].Length;
grid1.TextChanged+=new System.EventHandler(textchanged);
grid1.KeyPress+=new System.Windows.Forms.KeyPressEventHandler(keypress);
for(int i=0;i<gridrows;i++)
{
f[i]=new double[gridcols];
for(int j=0;j<gridcols;j++)
{
f[i][j]=System.Convert.ToDouble(grid1.GetCell(i+1,j+1));
//MessageBox.Show(f[i][j].ToString());
}
}
//listview1的處理
if(strArray.Count==0)
listView1.Columns.Add(" ",2,HorizontalAlignment.Center);
else
{ //處理技巧
listView1.Columns.Add(" ",1,HorizontalAlignment.Center);
for(int i=0;i<strArray.Count;i++)
{
listView1.Columns.Add(strArray[i].ToString(),45,HorizontalAlignment.Center);
}
//listView1的賦值,注意listview1的第一列是是item的名稱,而不是listview1對應的[0][0]位置
for(int i=0;i<str.Length;i++)
{
listView1.Items.Add(str[i][0]);
for(int j=0;j<str[i].Length;j++)
//listView1.Items[aRow-1].SubItems[aColumn - 1].Text = text;
{
listView1.Items[i].SubItems.Add(str[i][j]);
}
}
}
//
// TODO: 在 InitializeComponent 調用后添加任何構造函數代碼
//
}
/// <summary>
/// 清理所有正在使用的資源。
/// </summary>
///
public double[][] Func
{
get
{
return f;
}
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
public void textchanged(object sender,System.EventArgs e)
{ MessageBox.Show("243343");
for(int i=0;i<gridrows;i++)
{
f[i]=new double[gridcols];
for(int j=0;j<gridcols;j++)
{
f[i][j]=System.Convert.ToDouble(grid1.GetCell(i+1,j+1));
//MessageBox.Show(f[i][j].ToString());
}
}
}
public void keypress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if(e.KeyChar==(char)13)
{
MessageBox.Show("fdg");
for(int i=0;i<gridrows;i++)
{
f[i]=new double[gridcols];
for(int j=0;j<gridcols;j++)
{
f[i][j]=System.Convert.ToDouble(grid1.GetCell(i+1,j+1));
//MessageBox.Show(f[i][j].ToString());
}
}
}
}
#region Windows Form Designer generated code
/// <summary>
/// 設計器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內容。
/// </summary>
private void InitializeComponent()
{
this.panel1 = new System.Windows.Forms.Panel();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.grid1 = new bs.Grid();
this.label2 = new System.Windows.Forms.Label();
this.splitter1 = new System.Windows.Forms.Splitter();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.listView1 = new System.Windows.Forms.ListView();
this.label1 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.panel1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// panel1
//
this.panel1.AllowDrop = true;
this.panel1.AutoScroll = true;
this.panel1.Controls.Add(this.groupBox2);
this.panel1.Controls.Add(this.splitter1);
this.panel1.Controls.Add(this.groupBox1);
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(464, 328);
this.panel1.TabIndex = 0;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.grid1);
this.groupBox2.Controls.Add(this.label2);
this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox2.Location = new System.Drawing.Point(211, 0);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(253, 328);
this.groupBox2.TabIndex = 2;
this.groupBox2.TabStop = false;
this.groupBox2.Enter += new System.EventHandler(this.groupBox2_Enter);
//
// grid1
//
this.grid1.Dock = System.Windows.Forms.DockStyle.Top;
this.grid1.Location = new System.Drawing.Point(3, 40);
this.grid1.Name = "grid1";
this.grid1.Size = new System.Drawing.Size(247, 184);
this.grid1.TabIndex = 1;
this.grid1.Load += new System.EventHandler(this.grid1_Load);
//
// label2
//
this.label2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.label2.Dock = System.Windows.Forms.DockStyle.Top;
this.label2.Font = new System.Drawing.Font("宋體", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(3, 17);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(247, 23);
this.label2.TabIndex = 0;
this.label2.Text = "Node";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// splitter1
//
this.splitter1.Cursor = System.Windows.Forms.Cursors.SizeWE;
this.splitter1.Location = new System.Drawing.Point(208, 0);
this.splitter1.Name = "splitter1";
this.splitter1.Size = new System.Drawing.Size(3, 328);
this.splitter1.TabIndex = 1;
this.splitter1.TabStop = false;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.listView1);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Left;
this.groupBox1.Location = new System.Drawing.Point(0, 0);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(208, 328);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
//
// listView1
//
this.listView1.AllowDrop = true;
this.listView1.Dock = System.Windows.Forms.DockStyle.Top;
this.listView1.FullRowSelect = true;
this.listView1.GridLines = true;
this.listView1.Location = new System.Drawing.Point(3, 40);
this.listView1.Name = "listView1";
this.listView1.Size = new System.Drawing.Size(202, 184);
this.listView1.TabIndex = 1;
this.listView1.UseCompatibleStateImageBehavior = false;
this.listView1.View = System.Windows.Forms.View.Details;
this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
//
// label1
//
this.label1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.label1.Dock = System.Windows.Forms.DockStyle.Top;
this.label1.Font = new System.Drawing.Font("宋體", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(3, 17);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(202, 23);
this.label1.TabIndex = 0;
this.label1.Text = "ParentNode(s)";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// button1
//
this.button1.DialogResult = System.Windows.Forms.DialogResult.OK;
this.button1.Location = new System.Drawing.Point(48, 352);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 1;
this.button1.Text = "確定";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button2.Location = new System.Drawing.Point(208, 352);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 2;
this.button2.Text = "取消";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// Assessment
//
this.AllowDrop = true;
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.AutoScroll = true;
this.ClientSize = new System.Drawing.Size(656, 397);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.panel1);
this.Name = "Assessment";
this.Text = "Assessment";
this.panel1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
public double[][] returnf()
{
double[][] func=new double[gridrows][];
for(int i=0;i<gridrows;i++)
{
func[i]=new double[gridcols];
for(int j=0;j<gridcols;j++)
func[i][j]=System.Convert.ToDouble(grid1.GetCell(i+1,j+1));
}
return func;
}
private void button1_Click(object sender, System.EventArgs e)
{
for(int i=0;i<gridrows;i++)
{
f[i]=new double[gridcols];
for(int j=0;j<gridcols;j++)
{
f[i][j]=System.Convert.ToDouble(grid1.GetCell(i+1,j+1));
// MessageBox.Show(f[i][j].ToString());
}
}
//MessageBox.Show(f.Length.ToString());
//MessageBox.Show(f[0].Length.ToString());
this.Close();
}
private void button2_Click(object sender, System.EventArgs e)
{
//foreach(BNode node in this.pmyNodeArray)
this.Close();
}
private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void groupBox2_Enter(object sender, EventArgs e)
{
}
private void grid1_Load(object sender, EventArgs e)
{
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -