using System; using System.Collections; using System.Windows.Forms; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using CoreFS.CA06; namespace Core.StlMes.Client.LgCommon { public partial class ucResPlan : ucResBase { public ucResPlan() { InitializeComponent(); ClsControlPack.SetUltraGridStyle(ultraGrid1, 2); //设置样式 } private void ultraGrid1_KeyPress(object sender, KeyPressEventArgs e) { string strKey = this.ultraGrid1.ActiveCell.Column.ToString(); if (strKey == "POTNO" || strKey == "POTAGE") { if (!(Char.IsNumber(e.KeyChar) && ultraGrid1.ActiveRow.Cells[strKey].Value.ToString().Length <= 3) && e.KeyChar != '\b') { e.Handled = true; } } } protected override void ultraGrid1_ClickCellButton(object sender, CellEventArgs e) { base.ultraGrid1_ClickCellButton(sender, e); try { if (!e.Cell.Column.Hidden && e.Cell.Column.CellActivation == Activation.AllowEdit) { if (e.Cell.Column.DataType != typeof(DateTime)) { frmInputDecimal frm = new frmInputDecimal(Convert.ToString(e.Cell.Text)); frm.Location = ClsControlPack.GetChildWindowLocation(frm.Size); if (frm.ShowDialog() == DialogResult.OK) { if (!frm.ValueChanged) return; e.Cell.Value = frm.Value; ultraGrid1.UpdateData(); } } } } catch { } } } }