public static void triggerParse(List <DesignerItem> triggerList) { try { codePath += "\\" + "monster_ai_data.py"; FileStream fs = new FileStream(codePath, FileMode.Append, FileAccess.Write); StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.UTF8); for (int i = 0; i < triggerList.Count; ++i) { string triggerString = "\'trigger\':[" + "\'" + triggerList[i].IDName + "\'], "; sw.Write(triggerString); for (int j = 0; j < triggerList[i].outputValue.Count; ++j) { MyTextBox tempTextBox = triggerList[i].outputValue[j]; string triggerOutputValueString = "'" + tempTextBox.Property + "'" + ":" + tempTextBox.propertyValue + ", "; sw.Write(triggerOutputValueString); } } sw.Close(); fs.Close(); MessageBox.Show("保存成功"); } catch (Exception e) { MessageBox.Show("保存失败:" + e.Message); } }
public Form1() { this.Size = new Size(750, 500); this.FormClosing += Form1_FormClosing; { TXB = new MyTextBox(false); TXB.Multiline = false; TXB.KeyDown += Txb_KeyDown; this.Controls.Add(TXB); } Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); socket.Connect(new IPEndPoint(GetMyIpAddress(), port)); stream = new NetworkStream(socket); reader = new StreamReader(stream); writer = new StreamWriter(stream); Thread thread = new Thread(() => { while (true) { string s = reader.ReadLine(); if (s.Length > 0) { MessageBox.Show(s); } } }); thread.IsBackground = true; thread.Start(); }
private async void GetCoinsAndCurrencies() { DataFetcher rdf = new DataFetcher(); string result = await rdf.GetThings(); MyTextBox.AppendText(result); }
void t_GotFocus(object sender, RoutedEventArgs e) { if (t != null) { MyTextBox.Focus(); } }
public StateViewModel() { action = "create"; nextIndex = 0; CreateCommand = new Command(ChangeActionToCreate, CanChangeAction); DeleteCommand = new Command(ChangeActionToDelete, CanChangeAction); SelectCommand = new Command(ChangeActionToSelect, CanChangeAction); ConnectCommand = new Command(ChangeActionToConnect, CanChangeAction); UndoCommand = new Command(Undo, CanUndo); RedoCommand = new Command(Redo, CanRedo); MouseDownAddCommand = new Command(AddStateOnCanvas, CanAddStateOnCanvas); MouseDownConnectCommand = new Command(SelectFirstStateToConnectOnCanvas, CanConnectStatesOnCanvas); MouseUpConnectCommand = new Command(SelectSecondStateToConnectOnCanvas, CanConnectStatesOnCanvas); MyCanvas = new Canvas(); MyCanvas.MouseDown += MyCanvas_MouseDown; MyCanvas.MouseMove += MyCanvas_MouseMove; MyCanvas.MouseUp += MyCanvas_MouseUp; movingGrid = null; nextIndex = 0; Txt = new MyTextBox(); state1 = null; state2 = null; movingState = null; arrow = new Arrow(); _isMoving = false; line = null; }
public static void Fp_dzd_DoubleClick(object sender, EventArgs e) { if (sender is MyTextBox) { MyTextBox box_dzd = sender as MyTextBox; if (box_dzd.SelectedDataValue == null) { ArchiveDetailForm form = box_dzd.FindForm() as ArchiveDetailForm; decimal money = Convert.ToDecimal(((form.DisplayManager.DataControls["金额"] as IWindowControl).Control as MyCurrencyTextBox).SelectedDataValue); string xgr = ((form.DisplayManager.DataControls["相关人编号"] as IWindowControl).Control as MyComboBox).SelectedDataValue.ToString(); using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <对账单>()) { IList <对账单> list = (rep as Feng.NH.INHibernateRepository).List <对账单>(NHibernate.Criterion.DetachedCriteria.For <对账单>() .Add(NHibernate.Criterion.Expression.Eq("金额", money)) .Add(NHibernate.Criterion.Expression.Eq("相关人编号", xgr)) .AddOrder(NHibernate.Criterion.Order.Desc("关账日期")).SetMaxResults(1)); if (list == null || list.Count == 0) { MessageForm.ShowWarning("找不到有效的对账单!"); return; } box_dzd.SelectedDataValue = list[0].编号; } } } }
//back space button private void Button_Click_2(object sender, RoutedEventArgs e) { string text = MyTextBox.Text; MyTextBox.Text = text.Substring(0, text.Length - 1); MyTextBox.Focus(); }
//XAMLのほうでも設定しているけど、それを上書きする //違うところは1箇所だけで、ConverterParameterに自身を渡しているところ //これはTextBoxに数値以外が入力されたときに使う private void SetMultiBinding() { var mb = new MultiBinding(); mb.Converter = new MyConverterMulti(); mb.ConverterParameter = this;//ここをXAMLでの書き方が分かれば、このメソッドは必要ない var b = new Binding(); b.Source = this; b.Path = new PropertyPath(MyValueProperty); b.Mode = BindingMode.TwoWay; mb.Bindings.Add(b); b = new Binding(); b.Source = this; b.Path = new PropertyPath(MyKetaIntProperty); b.Mode = BindingMode.TwoWay; mb.Bindings.Add(b); b = new Binding(); b.Source = this; b.Path = new PropertyPath(MyKetaDecimalProperty); b.Mode = BindingMode.TwoWay; mb.Bindings.Add(b); MyTextBox.SetBinding(TextBox.TextProperty, mb); }
///////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Handles and re-raises the KeyDown event. /// </summary> /// protected override void OnKeyDown(KeyEventArgs e) { Control active = this.ActiveControl; MyComboBox combo = active as MyComboBox; MyTextBox textBox = active as MyTextBox; if (active != null && e.Modifiers == 0) { switch (e.KeyCode) { case Keys.Escape: this.Unload(); e.Handled = true; break; case Keys.Scroll: this.DumpTabIndexes(); break; case Keys.Enter: if (!(active is MyButton)) { goto case Keys.Down; } break; case Keys.Up: case Keys.Down: if (active is MyButton || active is MyCheckBox || active is MyTextBox && !textBox.Multiline || combo != null && (combo.ReadOnly || !combo.DroppedDown) ) { goto case Keys.Tab; } break; case Keys.Tab: bool forward = e.KeyCode != Keys.Up; // forward if not key Up this.SelectNextControl(active, forward, /*tabStopOnly*/ true, /*nested*/ true, /*wrap*/ true); combo = ActiveChild as MyComboBox; if (combo != null && !combo.ReadOnly && !combo.DroppedDown) { combo.DroppedDown = true; } e.Handled = true; break; } } base.OnKeyDown(e); }
public MyDialogWindow(Window owner) { InitializeComponent(); this.Owner = owner; MyTextBox.Focus(); MyTextBox.KeyDown += MyTextBox_KeyDown; }
public UserControl2() { InitializeComponent(); //MyValueとTextBoxのTextとのBinding var mb = new MultiBinding(); mb.Converter = new MyStringConverter(); // //mb.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; Binding b; //Value用のBinding b = new Binding(); b.Source = this; b.Path = new PropertyPath(MyValueProperty); b.Mode = BindingMode.TwoWay; mb.Bindings.Add(b); //StringFormat用のBinding b = new Binding(); b.Source = this; b.Path = new PropertyPath(MyStringFormatProperty); b.Mode = BindingMode.OneWay;//重要、TextBoxの値からはStringFormatを変換しないので渡さない //b.Mode = BindingMode.TwoWay; mb.Bindings.Add(b); MyTextBox.SetBinding(TextBox.TextProperty, mb); }
public static void addNewOrder(MyTextBox locationTextbox, ComboBox paymentMethod, DateTimePicker orderDatePicker, ComboBox customerIdsComboBox, BindingNavigator bindingNavigatorOrders, NewOrder newOrderForm) { if (!validateFields(locationTextbox, paymentMethod, customerIdsComboBox)) { return; } try { int last_page = bindingNavigatorOrders.BindingSource.Count; NewOrderDAO.addNewOrder(locationTextbox.Text, paymentMethod.GetItemText(paymentMethod.SelectedItem), orderDatePicker.Value.Date, customerIdsComboBox.GetItemText(customerIdsComboBox.SelectedItem)); foreach (KeyValuePair <string, Label> entry in App.GetOrderLabels()) { entry.Value.DataBindings.Clear(); } db.BindOrderData(App.GetOrderLabels(), bindingNavigatorOrders); bindingNavigatorOrders.BindingSource.Position = last_page; // Added! newOrderForm.Close(); } catch (SqlException e) { ViewMessages.ExceptionOccured(e); } }
public Window1() : base() { MessageBox.Show("Selamat Datang Di Program Bejjo"); InitializeComponent(); //sub-class our textBox DisplayBox = new MyTextBox(); Grid.SetRow(DisplayBox, 0); Grid.SetColumn(DisplayBox, 0); Grid.SetColumnSpan(DisplayBox, 9); DisplayBox.Height = 30; MyGrid.Children.Add(DisplayBox); //sub-class our paper trail textBox PaperBox = new MyTextBox(); Grid.SetRow(PaperBox, 1); Grid.SetColumn(PaperBox, 0); Grid.SetColumnSpan(PaperBox, 3); Grid.SetRowSpan(PaperBox, 5); PaperBox.IsReadOnly = true; PaperBox.VerticalScrollBarVisibility = ScrollBarVisibility.Visible; PaperBox.Margin = new Thickness(3.0, 1.0, 1.0, 1.0); PaperBox.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto; Paper = new PaperTrail(); MyGrid.Children.Add(PaperBox); ProcessKey('0'); EraseDisplay = true; }
public TextPage(string text, string content) : base(text) { { TXB = new MyTextBox(true, content); this.Controls.Add(TXB); } }
public LogPage() : base("Log") { { TXBlog = new MyTextBox(true); this.Controls.Add(TXBlog); } }
public static bool ControlsCom(Control c, Dictionary <string, object> dic) { foreach (Control con in c.Controls) { if (con is TextBox) { TextBox txt = con as TextBox; if (dic.ContainsKey(txt.Name) && !dic[txt.Name].Equals(txt.Text)) { return(false); } } else if (con is MyTextBox) { MyTextBox txt = con as MyTextBox; if (dic.ContainsKey(txt.Name) && !dic[txt.Name].Equals(txt.Text)) { return(false); } } else if (con is EditGrid) { EditGrid dgv = con as EditGrid; if (!dic.ContainsKey(dgv.Name)) { continue; } DataTable ord_tb = dic[dgv.Name] as DataTable; if (ord_tb.Rows.Count != dgv.DataSource.Rows.Count) { return(false); } for (int i = 0; i < ord_tb.Rows.Count; i++) { for (int j = 0; j < ord_tb.Columns.Count; j++) { if (!ord_tb.Rows[i][j].Equals(dgv.DataSource.Rows[i][j])) { return(false); } } } } if (con.Controls != null && !(con is EditGrid)) { if (!ControlsCom(con, dic)) { return(false); } } } return(true); }
public void GetIsInputMethodEnabled_TextBox () { TextBox tb = new TextBox (); Assert.IsTrue (InputMethod.GetIsInputMethodEnabled (tb), "TextBox"); MyTextBox mtb = new MyTextBox (); Assert.IsTrue (InputMethod.GetIsInputMethodEnabled (mtb), "MyTextBox"); }
private void TextMaker_Load(object sender, EventArgs e) { tabControlMain.TabPages.Clear(); MyTextBox.Clear(); DefinedItems = LoadDefinedItems(@"FixedDefinitionXML.xml"); MyTextDataAdapter = new TextDataAdapter(DefinedItems); MakeControls(DefinedItems); }
private static void Monster_Data(DesignerItem monster, int aiID) { var ipy = Python.CreateRuntime(); dynamic test = ipy.UseFile("Code\\monster_data.py"); IronPython.Runtime.PythonDictionary data = test.data; IronPython.Runtime.PythonDictionary unit = null; IronPython.Runtime.PythonTuple tuple = null; List <int> aiIDList = new List <int>(); aiIDList.Add(aiID); int monsterID = -1; for (int i = 0; i < monster.outputValue.Count; ++i) { MyTextBox tempTextBox = monster.outputValue[i]; if (tempTextBox.Property.Equals("ID")) { try { monsterID = Convert.ToInt32(tempTextBox.propertyValue); } catch (Exception e) { var ex = new Exception("缺少怪物ID"); throw ex; } } } if (data.ContainsKey(monsterID)) { unit = data[monsterID] as IronPython.Runtime.PythonDictionary; if (unit["monsterAI"] != null) { tuple = unit["monsterAI"] as IronPython.Runtime.PythonTuple; for (int i = 0; i < tuple.Count; ++i) { int exitAIID = Convert.ToInt32(tuple[i]); if (!aiIDList.Contains(exitAIID)) { aiIDList.Add(exitAIID); } } } } else { unit = new IronPython.Runtime.PythonDictionary(); } unit["monsterAI"] = new IronPython.Runtime.PythonTuple(aiIDList); for (int i = 0; i < monster.outputValue.Count; ++i) { MyTextBox tempTextBox = monster.outputValue[i]; if (!tempTextBox.Property.Equals(tempTextBox.propertyValue) && tempTextBox.propertyValue != null && !tempTextBox.Property.Equals("ID")) { unit[tempTextBox.Property] = tempTextBox.propertyValue; } } data[monsterID] = unit; exportCode(data, "monster_data.py"); }
/// <summary> /// Faz a pesquisa em um webservice do cep. /// Retorna cidade, bairro, logradouro e tipo de logradouro modificadas. /// Utiliza os sites republicavirtual.com.br e viacep.com.br /// </summary> /// <param name="cep">O CEP a ser pesquisado</param> /// <param name="bairro"></param> /// <param name="logradouro"></param> /// <param name="tipologradouro"></param> public void buscadorAlternativo(string cep, MyComboBox bairro, MyTextBox logradouro, MyComboBox tipologradouro) { try { //alternativo http://cep.republicavirtual.com.br/web_cep.php?cep=32604170cep&formato=xml //ourtro alternativo https://api.postmon.com.br/v1/cep/32605100?format=xml //https://viacep.com.br/ws/32605100/json/ WebRequest request = WebRequest.Create("https://viacep.com.br/ws/@cep/xml/".Replace("@cep", cep)); request.Timeout = 20000; using (WebResponse response = request.GetResponse()) { using (Stream stream = response.GetResponseStream()) { XDocument document = XDocument.Load(new StreamReader(stream ?? throw new InvalidOperationException("Strema não é válido!"))); try { XElement xElementlogradouro = document.Descendants("logradouro").First(); XElement xElementbairro = document.Descendants("bairro").First(); XElement xElementLocalidade = document.Descendants("localidade").First(); if (xElementLocalidade.Value != "Betim") { throw new Exception($"CEP {cep} não foi encontrado ou não pertence a Betim!\nPor favor digite o endereço."); } bairro.Text = xElementbairro.Value.ToUpper(); logradouro.Text = xElementlogradouro.Value.ToUpper(); var tipo = logradouro.Text.Split(' '); tipologradouro.Text = tipo[0]; var pos = logradouro.Text.IndexOf(' ') + 1; logradouro.Text = logradouro.Text.Substring(pos, logradouro.Text.Length - pos); } catch (Exception e) { throw new Exception($"Cep {cep} não foi encontrado!\nPor favor digite o endereço.\n{e.Message}"); } } } } catch (WebException erro) { throw new WebException("Não foi possível acessar o WebService!\n" + erro.Message + "\nVerifique sua conexão de rede."); } catch (XmlException erro) { throw new XmlException(erro.Message); } }
private void Watermark_myTextBox_Enter(object sender, EventArgs e) { MyTextBox mTextBox = (MyTextBox)sender; if (mTextBox.Text == "0") { mTextBox.Text = ""; } }
private void Watermark_myTextBox_Leave(object sender, EventArgs e) { MyTextBox mTextBox = (MyTextBox)sender; if (mTextBox.Text.Length == 0) { mTextBox.Text = "0"; } }
private void Watermark_myTextBox_KeyPress(object sender, KeyPressEventArgs e) { MyTextBox myTextBox = (MyTextBox)sender; if (myTextBox.Text.Length <= 1 && e.KeyChar == (char)Keys.Back) e.Handled = true; if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar)) e.Handled = true; }
/// <summary> /// 绑定显示数据 /// </summary> public void DataBind() { if (this.DataSource != null) { txtTitle.Text = this.DataSource.Table.Name + " " + DataSource.Table.caption; gridColumns.RowDefinitions.Clear(); gridColumns.Children.Clear(); for (int i = 0; i < DataSource.Columns.Length; i++) { RowDefinition rowdef = new RowDefinition(); rowdef.Height = GridLength.Auto; gridColumns.RowDefinitions.Add(rowdef); EJ.DBColumn Column = DataSource.Columns[i]; TextBox t1 = new MyTextBox(); t1.Tag = Column.id.GetValueOrDefault(); if (Column.caption != null && Column.caption.Contains(",")) { t1.Text = Column.caption.Substring(0, Column.caption.IndexOf(",")); } else if (Column.caption != null && Column.caption.Contains(",")) { t1.Text = Column.caption.Substring(0, Column.caption.IndexOf(",")); } else { t1.Text = Column.caption; } setTextBoxStyle(t1, 0); Grid.SetRow(t1, i); gridColumns.Children.Add(t1); TextBox t2 = new MyTextBox(); t2.Text = Column.Name; setTextBoxStyle(t2, 1); Grid.SetRow(t2, i); gridColumns.Children.Add(t2); TextBox t3 = new MyTextBox(); t3.Text = Column.dbType; setTextBoxStyle(t3, 2); Grid.SetRow(t3, i); gridColumns.Children.Add(t3); TextBox t4 = new MyTextBox(); t4.Text = Column.length; setTextBoxStyle(t4, 3); Grid.SetRow(t4, i); gridColumns.Children.Add(t4); } } }
private void StackPanel_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { MyTextBox textBox = new MyTextBox(); textBox.Name = GetControlsName("TB"); textBox.MouseDoubleClick += TextBox_MouseDown; textBox.btn.Margin = new Thickness(20, 20, 5, 5); grid.Children.Add(textBox); }
private void Button_Click_1(object sender, RoutedEventArgs e) { MyTextBox textBox = new MyTextBox(); textBox.Name = GetControlsName("TB"); textBox.MouseDoubleClick += TextBox_MouseDown; textBox.btn.Margin = new Thickness(15, 5, 5, 5); grid.Children.Add(textBox); }
private void ButtonAdd_Click(object sender, RoutedEventArgs e) { string userInput = MyTextBox.Text; _bm.Add(userInput); MyTextBox.Clear(); ListBoxBlogs.ItemsSource = _bm.ReadBlog(); //ListBoxPosts.ItemsSource = _bm.ReadPost(); }
public static Dictionary <string, object> ControlsAdds(Control c, Dictionary <string, object> dic) { if (dic == null) { dic = new Dictionary <string, object>(); } object value; foreach (Control con in c.Controls) { if (con is TextBox) { TextBox txt = con as TextBox; if (dic.TryGetValue(txt.Name, out value)) { dic[txt.Name] = txt.Text; } else { dic.Add(txt.Name, txt.Text); } } else if (con is MyTextBox) { MyTextBox txt = con as MyTextBox; if (dic.TryGetValue(txt.Name, out value)) { dic[txt.Name] = txt.Text; } else { dic.Add(txt.Name, txt.Text); } } else if (con is EditGrid) { EditGrid dgv = con as EditGrid; if (dic.TryGetValue(dgv.Name, out value)) { dic[dgv.Name] = dgv.DataSource.Copy(); } else { dic.Add(dgv.Name, dgv.DataSource.Copy()); } } if (con.Controls != null && !(con is EditGrid)) { ControlsAdds(con, dic); } } return(dic); }
private void ReadFromTxt() { // The easiest way is to just replace the whole text MyTextBox.Text = ""; string[] lines = System.IO.File.ReadAllLines(@"D:\Log.txt"); foreach (string line in lines) { MyTextBox.AppendText(line + Environment.NewLine); } }
private void Watermark_myTextBox_Enter(object sender, EventArgs e) { MyTextBox mTextBox = (MyTextBox)sender; if (mTextBox.Text == "Required!") { mTextBox.Text = ""; mTextBox.ForeColor = Color.DimGray; } }
private void Watermark_myTextBox_Leave(object sender, EventArgs e) { MyTextBox mTextBox = (MyTextBox)sender; if (mTextBox.Text.Length == 0) { mTextBox.Text = "Required!"; mTextBox.ForeColor = Color.Red; } }
public void GetValue () { ConcreteDependencyObject cdo = new ConcreteDependencyObject (); Assert.Throws<Exception> (delegate { cdo.GetValue (InputMethod.IsInputMethodEnabledProperty); }, "GetValue"); TextBox tb = new TextBox (); Assert.IsTrue ((bool) tb.GetValue (InputMethod.IsInputMethodEnabledProperty), "TextBox"); MyTextBox mtb = new MyTextBox (); Assert.IsTrue ((bool) mtb.GetValue (InputMethod.IsInputMethodEnabledProperty), "MyTextBox"); }
public void SetValue () { ConcreteDependencyObject cdo = new ConcreteDependencyObject (); Assert.Throws<Exception> (delegate { cdo.SetValue (InputMethod.IsInputMethodEnabledProperty, true); }, "SetValue"); TextBox tb = new TextBox (); tb.SetValue (InputMethod.IsInputMethodEnabledProperty, false); Assert.IsFalse (InputMethod.GetIsInputMethodEnabled (tb), "TextBox"); MyTextBox mtb = new MyTextBox (); mtb.SetValue (InputMethod.IsInputMethodEnabledProperty, false); Assert.IsFalse (InputMethod.GetIsInputMethodEnabled (mtb), "MyTextBox"); }
public void SetIsInputMethodEnabled_TextBox () { TextBox tb = new TextBox (); Assert.IsTrue (InputMethod.GetIsInputMethodEnabled (tb), "TextBox-1"); InputMethod.SetIsInputMethodEnabled (tb, false); Assert.IsFalse (InputMethod.GetIsInputMethodEnabled (tb), "TextBox-2"); InputMethod.SetIsInputMethodEnabled (tb, true); Assert.IsTrue (InputMethod.GetIsInputMethodEnabled (tb), "TextBox-3"); MyTextBox mtb = new MyTextBox (); Assert.IsTrue (InputMethod.GetIsInputMethodEnabled (mtb), "MyTextBox-1"); InputMethod.SetIsInputMethodEnabled (mtb, false); Assert.IsFalse (InputMethod.GetIsInputMethodEnabled (mtb), "MyTextBox-2"); InputMethod.SetIsInputMethodEnabled (mtb, true); Assert.IsTrue (InputMethod.GetIsInputMethodEnabled (mtb), "MyTextBox-3"); }
private void FormatParameterGrid() { DataSet ds_Parameters = new DataSet(); ds_Parameters.Tables.Add(); ds_Parameters.Tables[0].Columns.Add(); ds_Parameters.Tables[0].Columns.Add(); ds_Parameters.Tables[0].Columns.Add(); ds_Parameters.Tables[0].Rows.Clear(); for (int I = 0; I < ParaList.Count; I++) { m_Arr1 = ParaList[I].Split(';'); ds_Parameters.Tables[0].Rows.Add(); ds_Parameters.Tables[0].Rows[I][0] = m_Arr1[0]; ds_Parameters.Tables[0].Rows[I][1] = m_Arr1[1]; } this.ResumeLayout(); c1_grd.DataSource = ds_Parameters.Tables[0]; c1_grd.Refresh(); //*********************************** Set Height of the form c1_grd.Height = (c1_grd.RowCount) * (c1_grd.RowHeight + 1); this.Height = c1_grd.Height + lblReportName.Height + tsMain.Height + 45; Int16 tempVar = (short)(c1_grd.Splits[0].DisplayColumns.Count); for (I = 0; I < tempVar; I++) { c1_grd.Splits[0].DisplayColumns[I].Style.Font = new Font("Arial", 8F, FontStyle.Regular, GraphicsUnit.Point); c1_grd.Splits[0].DisplayColumns[I].Style.VerticalAlignment = C1.Win.C1TrueDBGrid.AlignVertEnum.Center; c1_grd.Splits[0].DisplayColumns[I].Style.HorizontalAlignment = C1.Win.C1TrueDBGrid.AlignHorzEnum.General; c1_grd.Splits[0].DisplayColumns[I].Style.Borders.BorderType = C1.Win.C1TrueDBGrid.BorderTypeEnum.None; c1_grd.Splits[0].DisplayColumns[I].Locked = true; } c1_grd.Splits[0].DisplayColumns[0].Width = 137; c1_grd.Splits[0].DisplayColumns[1].Width = 176; c1_grd.Splits[0].DisplayColumns[2].Width = 300; c1_grd.Enabled = false; TextBoxes = new frmParameterNew.MyTextBox[(ParaList.Count * 2) + 1]; cntCount = 0; for (int I = 0; I < ParaList.Count; I++) { m_Arr1 = ParaList[I].ToString().Split(';'); TextBoxes[cntCount] = new MyTextBox(); TextBoxes[cntCount].Name = "MTB" + (I).ToString(); TextBoxes[cntCount].Font = new Font("Courier New", 8F, FontStyle.Regular, GraphicsUnit.Point); if (m_Arr1[2].IndexOf(',') > 0) { TextBoxes[cntCount].Mask = m_Arr1[2]; TextBoxes[cntCount].Tag = m_Arr1[2].Length; } else { m_Arr2 = m_Arr1[2].Split(','); TextBoxes[cntCount].Mask = m_Arr2[0]; } TextBoxes[cntCount].Left = 327; TextBoxes[cntCount].Top = 39 + (29 * I); TextBoxes[cntCount].Width = TextBoxes[cntCount].Mask.Length * ((TextBoxes[cntCount].Mask.Length <= 3) ? 10 : 8); TextBoxes[cntCount].Visible = true; TextBoxes[cntCount].BringToFront(); TextBoxes[cntCount].Tag = m_Arr1[4] + ";" + m_Arr1[2] + ";" + m_Arr1[5]; if (m_Arr1.Length > 6) { TextBoxes[cntCount].Tag = TextBoxes[cntCount].Tag.ToString() + ";" + m_Arr1[6] + ";" + m_Arr1[7]; } if (TextBoxes[cntCount].Mask == "##/##/####" && m_Arr1[0] == "Date Range") { if (!string.IsNullOrEmpty(GlobalVar.g_WorkDate)) { DateTime dDate; if (DateTime.TryParseExact(GlobalVar.g_WorkDate, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out dDate)) { TextBoxes[cntCount].Text = DateTime.Parse(GlobalVar.g_WorkDate).ToString("dd/MM/yyyy"); } else { TextBoxes[cntCount].Text = "01/01/1900"; } } else { TextBoxes[cntCount].Text = "01/01/1900"; } } this.Controls.AddRange(new Control[] { TextBoxes[cntCount] }); TextBoxes[cntCount].TabIndex = cntCount; cntCount = (Int16)(cntCount + 1); //************** For Duplicate Items if (m_Arr1[3].ToUpper() == "TRUE") { TextBoxes[cntCount] = new MyTextBox(); TextBoxes[cntCount].Name = "MTB" + (I).ToString(); TextBoxes[cntCount].Font = new Font("Courier New", 8F, FontStyle.Regular, GraphicsUnit.Point); if (!(m_Arr1[2].IndexOf(",") + 1 > 0)) { TextBoxes[cntCount].Mask = m_Arr1[2]; TextBoxes[cntCount].Tag = m_Arr1[2].Length; } else { m_Arr2 = m_Arr1[2].Split(','); TextBoxes[cntCount].Mask = m_Arr2[0]; } TextBoxes[cntCount].Top = 39 + (29 * I); TextBoxes[cntCount].Width = TextBoxes[cntCount].Mask.Length * ((TextBoxes[cntCount].Mask.Length <= 3) ? 10 : 8); TextBoxes[cntCount].Left = 327 + TextBoxes[cntCount].Width + 10; TextBoxes[cntCount].Visible = true; TextBoxes[cntCount].BringToFront(); TextBoxes[cntCount].Tag = m_Arr1[4] + ";" + m_Arr1[2] + ";" + m_Arr1[5]; if (m_Arr1.Length > 6) { TextBoxes[cntCount].Tag = TextBoxes[cntCount].Tag.ToString() + ";" + m_Arr1[6] + ";" + m_Arr1[7]; } if (TextBoxes[cntCount].Mask == "##/##/####" && m_Arr1[0] == "Date Range") { if (!string.IsNullOrEmpty(GlobalVar.g_WorkDate)) { DateTime dDate; if (DateTime.TryParseExact(GlobalVar.g_WorkDate, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out dDate)) { TextBoxes[cntCount].Text = DateTime.Parse(GlobalVar.g_WorkDate).ToString("dd/MM/yyyy"); } else { TextBoxes[cntCount].Text = "01/01/1900"; } } else { TextBoxes[cntCount].Text = "01/01/1900"; } } this.Controls.AddRange(new System.Windows.Forms.Control[] { TextBoxes[cntCount] }); TextBoxes[cntCount].TabIndex = cntCount; cntCount = (Int16)(cntCount + 1); } } c1_grd.SendToBack(); btnpreview.TabIndex = cntCount + 1; //TextBoxes[0].TabIndex = 0; //TextBoxes[0].Focus(); //this.Size = new Size(550, this.Height); }