| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using Core.Mes.Client.Comm.Format;
- namespace Core.StlMes
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- DataRow dr = null;
- for (int i = 0; i < 5; i++)
- {
- dr = dataTable1.NewRow();
- for (int j = 0; j < 5; j++)
- {
- dr[j] = (i+1).ToString()+"\r\n" + "afafdasdfasdf";
- }
- dataTable1.Rows.Add(dr);
- }
- for (int i = 0; i < 5; i++)
- {
- dr = dataTable2.NewRow();
- for (int j = 0; j < 5; j++)
- {
- dr[j] = (i + 1).ToString();
- }
- //dataTable2.Rows.Add(dr);
- }
- for (int i = 0; i < ultraGrid1.DisplayLayout.Bands.Count; i++)
- {
- if (i == 0)
- {
- ultraGrid1.DisplayLayout.Bands[i].Override.FilterUIType = Infragistics.Win.UltraWinGrid.FilterUIType.FilterRow;
- }
- else
- {
- ultraGrid1.DisplayLayout.Bands[i].Override.FilterUIType = Infragistics.Win.UltraWinGrid.FilterUIType.HeaderIcons;
- }
- }
- }
- private void button1_Click(object sender, EventArgs e)
- {
- MessageBox.Show(JSONFormat.Format(new User()));
- //ultraGrid1.Rows[2].Activation= Infragistics.Win.UltraWinGrid.Activation.NoEdit;
- //ultraGrid1.Rows[2].Cells[3].Activation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
- for (int i = 0; i < ultraGrid1.Rows.Count; i++)
- {
- for (int j = 1; j < ultraGrid1.Rows[i].Cells.Count; j++)
- {
- ultraGrid1.Rows[i].Cells[j].Activation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
- }
- }
- try
- {
- //MessageBox.Show("001 " +Core.Mes.Client.Comm.Tool.StringUtil.SequenceIncrease("001"));
- //MessageBox.Show("A005 "+Core.Mes.Client.Comm.Tool.StringUtil.SequenceIncrease("A005"));
- //MessageBox.Show("SS030 "+Core.Mes.Client.Comm.Tool.StringUtil.SequenceIncrease("SS030"));
- //MessageBox.Show("AL08912 "+Core.Mes.Client.Comm.Tool.StringUtil.SequenceIncrease("AL08912"));
- ////MessageBox.Show("A284A "+Core.Mes.Client.Comm.Tool.StringUtil.SequenceIncrease("A284A"));
- //MessageBox.Show("99 " + Core.Mes.Client.Comm.Tool.StringUtil.SequenceIncrease("99"));
- //MessageBox.Show("ABC999 " + Core.Mes.Client.Comm.Tool.StringUtil.SequenceIncrease("ABC999"));
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- //MessageBox.Show(dataTable1.Compute("max(Column1)", "").ToString());
- }
- private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
- {
- ultraGrid1.UpdateData();
- if (e.Cell.Column.Key.Equals(ultraGrid1.DisplayLayout.Bands[0].Columns[0].Key))
- {
- if (e.Cell.Value != null && !string.IsNullOrEmpty(e.Cell.Value.ToString()))
- {
- for (int i = 1; i < e.Cell.Row.Cells.Count; i++)
- {
- if (i != 2 && i != 3)
- {
- e.Cell.Row.Cells[i].Activation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
- }
- }
- }
- else
- {
- for (int i = 1; i < e.Cell.Row.Cells.Count; i++)
- {
- e.Cell.Row.Cells[i].Activation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
- }
- }
- }
- }
- }
- class User
- {
- private string name = "Tom";
- public string Name
- {
- get { return name; }
- set { name = value; }
- }
- private string sex = "Male";
- public string Sex
- {
- get { return sex; }
- set { sex = value; }
- }
- private string address = "Changsha, \\<\"Hunan\r\nChina";
- public string Address
- {
- get { return address; }
- set { address = value; }
- }
- }
- }
|