private void text_Changed(object sender, EventArgs e) { FocusedTextBox.FocusedTextBox Temp = default(FocusedTextBox.FocusedTextBox); Temp = (FocusedTextBox.FocusedTextBox)sender; // συγκεντρώνω όλα τα textbox που ενημερώθηκαν nfFieldNames++; fFieldNames[nfFieldNames] = Temp.Tag.ToString(); fValues[nfFieldNames] = Temp.Text.ToString(); // value }
private void ADD_LABELTEXT(int Y, string C, int N, int LEFTLOC, int STHLH) { //FIRSTCOL =1 ΠΡΩΤΗ ΣΤΗΛΗ //// STHLH=2 ΔΕΥΤΕΡΗ ΣΤΗΛΗ Label L1 = new Label(); //LEFTLOC =160 //ΕΠΩΝΥΜΟ EPO C" L1.Text = (C.Substring(0, 200).Trim()); L1.Name = "L1"; L1.Location = new Point(LEFTLOC, Y); L1.Size = new Size(64, 14); Panel1.Controls.Add(L1); t1[N, STHLH] = new FocusedTextBox.FocusedTextBox(); t1[N, STHLH].Text = ""; t1[N, STHLH].EnterFocusColor = Color.Yellow; t1[N, STHLH].Name = (C.Substring(201, 20).Trim()); t1[N, STHLH].Location = new Point(LEFTLOC + 130, Y - 3); t1[N, STHLH].Size = new Size(200, 350); Panel1.Controls.Add(t1[N, STHLH]); }
private void editing_Load(object sender, EventArgs e) { // σχεδίαση φόρμας εισαγωγής/διόρθωσης εγγραφής // editing.ActiveForm.Visible = false; DataTable dt = functions.ExecuteSQLQuery("select * from " + f_TableName + " WHERE ID=" + f_ID.ToString()); if (dt.Rows.Count == 0) { return; } // Table.CellBorderStyle = TableLayoutPanelCellBorderStyle.None; TableLayoutPanel Table = new TableLayoutPanel(); Table.Location = new Point(10, 40); Table.Size = new Size(620, 100); Table.AutoSize = true; // You should write the code to set Anchor property programmatically only in the Form_Load event Table.Anchor = (AnchorStyles.Top | AnchorStyles.Left); Table.Name = "Desk"; Table.ColumnCount = 6; Table.RowCount = 0; Table.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; Table.GrowStyle = System.Windows.Forms.TableLayoutPanelGrowStyle.AddRows; this.Controls.Add(Table); // ΧΡΕΙΑΖΕΤΑΙ ΑΝ ΔΗΜΙΟΥΡΓΕΙΤΑΙ ΜΕ ΤΗΝ TableLayoutPanel Table = new TableLayoutPanel(); //Table.Visible = false; int row = 0; // SELECT TOP 1000 [ID] //,[TABLENAME] //,[FIELDNAME] //,[FIELDDESCRIPTION] //,[SUMES] //,[FIELDTYPE] //,[COMBOQUERY] //FROM [emp].[dbo].[TABLEFIELDS] // FocusedTextBox.FocusedTextBox[] FtextBox = new FocusedTextBox.FocusedTextBox[100]; DataTable tf = functions.ExecuteSQLQuery("select top 30 * from TABLEFIELDS WHERE (not FIELDDESCRIPTION IS NULL) AND TABLENAME='" + f_TableName + "'"); int ncol = 0; int nrow = 0; for (int k = 0; k <= tf.Rows.Count - 1; k++) { Table.Controls.Add(new Label() { Text = tf.Rows[k]["FIELDDESCRIPTION"].ToString(), Anchor = AnchorStyles.Left, AutoSize = true }, ncol, nrow); string mFieldName = tf.Rows[k]["FIELDNAME"].ToString(); string ctype = tf.Rows[k]["FIELDTYPE"].ToString(); int n = 10 * dt.Rows[0][mFieldName].ToString().Length; string mQuery = tf.Rows[k]["COMBOQUERY"].ToString(); if (ctype == "B") { tCombo[k] = new FocusedCombo.FocusedCombo(); tCombo[k].Width = n; tCombo[k].Text = dt.Rows[0][mFieldName].ToString(); tCombo[k].EnterFocusColor = Color.Yellow; tCombo[k].Dock = DockStyle.Fill; functions.FillComboBox(mQuery, tCombo[k]); Table.Controls.Add(tCombo[k], ncol + 1, nrow); tCombo[k].SelectedIndexChanged += Combo_Changed; tCombo[k].Tag = (k.ToString() + " ").Substring(0, 3) + (mFieldName + " ").Substring(0, 20) + ctype; //20 kena } else // κείμενο ή αριθμητικό { if (n <= 100) { n = 100; } t1[k] = new FocusedTextBox.FocusedTextBox(); t1[k].Width = n; t1[k].Text = dt.Rows[0][mFieldName].ToString(); t1[k].EnterFocusColor = Color.Yellow; t1[k].Dock = DockStyle.Fill; Table.Controls.Add(t1[k], ncol + 1, nrow); t1[k].TextChanged += text_Changed; // αποθηκεύω στο tag τον αριθμό κ του πίνακα και το όνομα του πεδίου και τον τύπο του t1[k].Tag = (k.ToString() + " ").Substring(0, 3) + (mFieldName + " ").Substring(0, 20) + ctype; //20 kena } ncol++; ncol++; if (ncol > 5) { ncol = 0; nrow++; } } Table.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single; //Single; //editing.ActiveForm.Visible = true ; }
//private void Button1_ContextMenuStripChanged(object sender, System.EventArgs e) //{ // int a = 0; // a = 1; //} public void ADD_COMBOBOX(int Y, string C, int N, int LEFTLOC, int STHLH, string comboQuery) { //FIRSTCOL =1 ΠΡΩΤΗ ΣΤΗΛΗ //// STHLH=2 ΔΕΥΤΕΡΗ ΣΤΗΛΗ //TextBox() 232,56 W227,H20 //BUT() 459,55 W13,21 //ListBox() 232,80 W227,94 Label L1 = new Label(); //LEFTLOC =160 //ΕΠΩΝΥΜΟ EPO C" L1.Text = C.Substring(1, 200).Trim(); L1.Name = "L1"; L1.Location = new Point(LEFTLOC, Y); //64, 13) 'controlLocation.X + 50, controlLocation.Y) L1.Size = new Size(64, 13); Panel1.Controls.Add(L1); t1[N, STHLH] = new FocusedTextBox.FocusedTextBox(); //TextBox t1[N, STHLH].Text = ""; //+ Str(controlCount) t1[N, STHLH].Name = (C.Substring(201, 20).Trim()); //"T1" t1[N, STHLH].Location = new Point(LEFTLOC + 130, Y - 3); //controlLocation.X + 350, controlLocation.Y) t1[N, STHLH].Size = new Size(200, 20); //T1.Height) // Add the TextBox to the controls collection. Panel1.Controls.Add(t1[N, STHLH]); B1[N] = new Button(); B1[N].Text = N.ToString(); B1[N].Name = ("L" + C).Substring(201, 20).Trim(); B1[N].Location = new Point(LEFTLOC + 330, Y - 3); //controlLocation.X + 350, controlLocation.Y) B1[N].Size = new Size(13, 21); //T1.Height) B1[N].Tag = N.ToString(); // Add the TextBox to the controls collection. Panel1.Controls.Add(B1[N]); //If F_FIRST = 1 Then // Me.Controls.Add(btn(k)) B1[N].Click += AllButtons_Click; // AddHandler btn(k).MouseMove, AddressOf AllButtons_mousemove //End If //LEFTLOC = 400 C1[N, STHLH] = new CheckedListBox(); C1[N, STHLH].Text = ""; //+ Str(controlCount) C1[N, STHLH].Name = (("L" + C).Substring(201, 20).Trim()); //"T1" C1[N, STHLH].Location = new Point(LEFTLOC + 130, 24 + Y - 3); //controlLocation.X + 350, controlLocation.Y) C1[N, STHLH].Size = new Size(200, 94); //T1.Height) // Add the TextBox to the controls collection. Panel1.Controls.Add(C1[N, STHLH]); //"SELECT PERIGRAFH,ID FROM PINAKES" functions.FillCheckedListBox(comboQuery, C1[N, STHLH]); C1[N, STHLH].Visible = false; }