Beispiel #1
0
        private void showdtp(DataGridViewCellEventArgs e)
        {
            //dtp1.Visible = false;
            fill.AllowUserToResizeColumns   = false;
            fill.AllowUserToResizeRows      = false;
            getsel.AllowUserToResizeColumns = false;
            getsel.AllowUserToResizeRows    = false;

            if (0 == functions.SelectedIndex)
            {
                dtp1.Size    = fill.CurrentCell.Size;
                dtp1.Top     = fill.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, true).Top;
                dtp1.Left    = fill.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, true).Left;
                dtp1.Visible = true;
                dtp1.BringToFront();
                fill.Controls.Add(dtp1);
            }
            else if (1 == functions.SelectedIndex)
            {
                dtp1.Size    = getsel.CurrentCell.Size;
                dtp1.Top     = getsel.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, true).Top;
                dtp1.Left    = getsel.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, true).Left;
                dtp1.Visible = true;
                dtp1.BringToFront();
                getsel.Controls.Add(dtp1);
            }

            dtp1.ValueChanged += new EventHandler(dtp1_ValueChanged);
        }
Beispiel #2
0
        private void ShowDateTimePicker(DateTimePicker dtp, ListViewItem.ListViewSubItem subItem)
        {
            Rectangle rect = subItem.Bounds;

            dtp.Bounds = new Rectangle(rect.Left + 1, rect.Top, rect.Width - 1, rect.Height - 1);

            dtp.Tag = subItem;

            DateTime time;

            if (DateTime.TryParse(subItem.Text, out time))
            {
                dtp.Value = time;
            }
            else
            {
                dtp.Value = DateTime.Now;
            }

            dtp.Visible = true;
            dtp.BringToFront();
            dtp.Focus();

            _curEditCtrl = dtp;
        }
        private void showdtp(DataGridViewCellEventArgs e)
        {
            dtp.Size = dataGridView1.CurrentCell.Size;
            //dtp.Top = dataGridView1.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, true).Top + dataGridView1.Top;
            //dtp.Left = dataGridView1.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, true).Left + dataGridView1.Left;
            dtp.Top  = dataGridView1.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, true).Top;
            dtp.Left = dataGridView1.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, true).Left;
            dtp.BringToFront();
            dtp.Visible = true;
            if (!(object.Equals(Convert.ToString(dataGridView1.CurrentCell.Value), "")))
            {
                dtp.Value = Convert.ToDateTime(dataGridView1.CurrentCell.Value);
            }

            dtp.Visible = true;
            this.Controls.Add(dtp);
            dataGridView1.Controls.Add(dtp);
            //dtp.Show();

            //DateTimePicker dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
            //dateTimePicker1.Location = new System.Drawing.Point(0,0);
            //dateTimePicker1.Name = "dateTimePicker1";
            //dateTimePicker1.Size = dataGridView1.CurrentCell.Size;
            //dateTimePicker1.TabIndex = 24;
            //dateTimePicker1.BringToFront();
            //this.Controls.Add(dateTimePicker1);

            dtp.ValueChanged += new EventHandler(dtp_ValueChanged);
        }
 private void dgv_Wedstrijden_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dgv_Wedstrijden.CurrentCell.ColumnIndex == 0 && e.RowIndex != -1 && e.ColumnIndex != -1)
     {
         dtp.Location = dgv_Wedstrijden.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false).Location;
         dtp.Width    = dgv_Wedstrijden.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false).Width;
         dtp.Visible  = true;
         dtp.BringToFront();
         DateTime date = (DateTime)dgv_Wedstrijden.CurrentCell.Value;
         dtp.Value = date;
     }
     else
     {
         dtp.Visible = false;
     }
 }
Beispiel #5
0
        private void DgvAddRec_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex > -1)
            {
                if (oDateTimePicker != null)
                {
                    oDateTimePicker.Visible = false;
                }
                if (oComboBox != null)
                {
                    oComboBox.Visible = false;
                }
                if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
                {
                    // If any cell is clicked which is our date Column
                    if (dtColumn.Rows[e.ColumnIndex]["TYPE"].ToString().ToUpper() == "DATE" || dtColumn.Rows[e.ColumnIndex]["TYPE"].ToString().ToUpper() == "DATETIME")
                    {
                        oDateTimePicker = new DateTimePicker();
                        dgvAddRec.Controls.Add(oDateTimePicker);
                        oDateTimePicker.Visible      = false;
                        oDateTimePicker.Format       = DateTimePickerFormat.Short;
                        oDateTimePicker.TextChanged += new EventHandler(DateTimePicker_OnTextChange);
                        oDateTimePicker.Visible      = true;
                        oDateTimePicker.BringToFront();
                        //It returns the retangular area that represents the Display area for a cell
                        Rectangle oRectangle = dgvAddRec.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, true);
                        oDateTimePicker.Size     = new Size(oRectangle.Width - 82, oRectangle.Height);
                        oDateTimePicker.Location = new Point(oRectangle.X + 82, oRectangle.Y);
                        oDateTimePicker.CloseUp += new EventHandler(DateTimePicker_CloseUp);
                    }
                    if (dtColumn.Rows[e.ColumnIndex]["TYPE"].ToString().ToUpper() == "LOGICAL" || dtColumn.Rows[e.ColumnIndex]["TYPE"].ToString().ToUpper() == "BOOLEAN")
                    {
                        dgvAddRec.Columns[e.ColumnIndex].ReadOnly = true;
                        string[] dataSource = { "FALSE", "TRUE" };
                        oComboBox = new ComboBox
                        {
                            DropDownStyle = ComboBoxStyle.DropDownList,
                            DataSource    = dataSource.ToList()
                        };

                        dgvAddRec.Controls.Add(oComboBox);
                        oComboBox.Visible = false;
                        oComboBox.SelectedIndexChanged += new EventHandler(ComboBox_SelectedIndexChanged);
                        oComboBox.Visible       = true;
                        oComboBox.SelectedIndex = 0;
                        //It returns the retangular area that represents the Display area for a cell
                        System.Drawing.Rectangle oRectangle = dgvAddRec.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, true);
                        oComboBox.Size            = new Size(oRectangle.Width, oRectangle.Height);
                        oComboBox.Location        = new Point(oRectangle.X, oRectangle.Y);
                        oComboBox.DropDownClosed += new EventHandler(ComboBox_DropDownClosed);
                    }
                }
            }
        }
Beispiel #6
0
 /// <summary>
 /// 根据时间过滤
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btn_SortByTime_Click(object sender, EventArgs e)
 {
     if (IsDatePickerFocused)
     {
         IsDatePickerFocused = false;
     }
     else
     {
         var btnLocation = btn_SortByDate.Location;
         DatePicker.Location = new System.Drawing.Point(btnLocation.X - (DatePicker.Width - btn_SortByDate.Width) / 2, btnLocation.Y + 24);
         DatePicker.Show();
         DatePicker.BringToFront();
         DatePicker.Focus();
         IsDatePickerFocused = true;
     }
 }
Beispiel #7
0
        private void OnCellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
        {
            if (e.ColumnIndex == 0)
            {
                Point location = dataGrid.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false).Location;
                location.Offset(dataGrid.Location);
                datePicker.Location = location;
                datePicker.Size     = dataGrid.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false).Size;
                datePicker.Value    = dataGrid.CurrentCell.Value != null?Convert.ToDateTime(dataGrid.CurrentCell.Value) : DateTime.Now;

                datePicker.Visible = true;
                datePicker.Select();
                datePicker.BringToFront();
                e.Cancel = true;
            }
        }
Beispiel #8
0
        /// <summary>
        /// Timers the image_ click.
        /// </summary>
        /// <param name="textControl">The text control.</param>
        /// <param name="timePickerControl">The time picker control.</param>
        private void TimerImage_Click(TextBox textControl, DateTimePicker timePickerControl)
        {
            this.ParentForm.AcceptButton = null;
            try
            {
                timePickerControl.BringToFront();
                if (!string.IsNullOrEmpty(textControl.Text.Trim()))
                {
                    timePickerControl.Value = Convert.ToDateTime(textControl.Text);
                }
                else
                {
                    timePickerControl.Value = DateTime.Today;
                }

                SendKeys.Send(SharedFunctions.GetResourceString("F4"));
                timePickerControl.Focus();
            }
            catch (Exception ex)
            {
                ExceptionManager.ManageException(ex, ExceptionManager.ActionType.Display, this.ParentForm);
            }
        }
Beispiel #9
0
 /// <summary>
 /// Timers the image_ click.
 /// </summary>
 /// <param name="textControl">The text control.</param>
 /// <param name="timePickerControl">The time picker control.</param>
 private void TimerImage_Click(TextBox textControl, DateTimePicker timePickerControl)
 {
     try
     {
         timePickerControl.BringToFront();
         ////to set Datetimepicker control
         if (!string.IsNullOrEmpty(textControl.Text.Trim()))
         {
             timePickerControl.Value = Convert.ToDateTime(textControl.Text);
         }
         else
         {
             timePickerControl.Value = DateTime.Today;
         }
         timePickerControl.Visible = true;
         this.SaveButton.Enabled   = true;
         SendKeys.Send(SharedFunctions.GetResourceString("F4"));
         timePickerControl.Focus();
     }
     catch (Exception ex)
     {
         ExceptionManager.ManageException(ex, ExceptionManager.ActionType.Display, this.ParentForm);
     }
 }
Beispiel #10
0
 private void PlanDgv_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex == -1)
     {
         return;
     }
     else
     {
         int    count     = this.PlanDgv.Rows.Count;
         string sqlString = "select count(*)  from project_tree_tab where  PROJECTID = '" + this.ProjectTreeView.Nodes[0].Text.ToString() + "'";
         object obj       = User.GetScalar(sqlString, DataAccess.OIDSConnStr);
         if (Convert.ToInt16(obj.ToString()) == count)
         {
             return;
         }
         else
         {
             if (this.PlanDgv.CurrentCell.ColumnIndex == 1 || this.PlanDgv.CurrentCell.ColumnIndex == 2 || this.PlanDgv.CurrentCell.ColumnIndex == 3 || this.PlanDgv.CurrentCell.ColumnIndex == 4)
             {
                 this.PlanDgv.Controls.Add(dtp);
                 Rectangle rect = this.PlanDgv.GetCellDisplayRectangle(this.PlanDgv.CurrentCell.ColumnIndex, this.PlanDgv.CurrentCell.RowIndex, false);
                 dtp.Left   = rect.Left;
                 dtp.Top    = rect.Top;
                 dtp.Width  = rect.Width;
                 dtp.Height = rect.Height;
                 dtp.BringToFront();
                 dtp.Visible       = true;
                 dtp.ValueChanged += new EventHandler(dtp_ValueChanged);
             }
             else if (this.PlanDgv.CurrentCell.ColumnIndex != 1 && this.PlanDgv.CurrentCell.ColumnIndex != 2 && this.PlanDgv.CurrentCell.ColumnIndex != 3 && this.PlanDgv.CurrentCell.ColumnIndex != 4)
             {
                 ClearDateTimePicker();
             }
         }
     }
 }
Beispiel #11
0
        private void comboBoxDocumentType_SelectedIndexChanged(object sender, EventArgs e)
        {
            panelAttributes.Controls.Clear();

            // Get selected Entity name from UI
            string selectedEntityName = ((KeyValuePair <string, string>)comboBoxDocumentType.SelectedItem).Key;

            // Get Entity by name
            Entity entity = DocumentTypeManager.Instance.GetSingleEntityByName(selectedEntityName);

            int step    = 23;
            int counter = -1;

            foreach (Attr attr in entity.attrs.attr)
            {
                counter++;

                Label          label = new Label();
                TextBox        textBox;
                DateTimePicker dateTimePicker;
                ComboBox       comboBox;

                label.Text     = attr.desc;
                label.Name     = "label_" + attr.name;
                label.Top      = step * (counter++);
                label.Left     = 29;
                label.AutoSize = true;
                label.Font     = new Font("Calibri", (float)9.75);
                label.Height   = 17;

                // add required flag
                if (bool.TryParse(attr.required, out bool requiredValue))
                {
                    label.Text += requiredValue ? " *" : "";
                }

                panelAttributes.Controls.Add(label);

                switch (attr.type)
                {
                case "7":
                case "8":
                case "9":
                    dateTimePicker       = new DateTimePicker();
                    dateTimePicker.Name  = "attributeControl_" + attr.name;
                    dateTimePicker.Top   = step * (counter++);
                    dateTimePicker.Left  = 29;
                    dateTimePicker.Font  = new Font("Calibri", (float)9.75);
                    dateTimePicker.Width = 240;
                    dateTimePicker.Value = DateTime.Now;

                    // Set date format
                    switch (attr.type)
                    {
                    // Date
                    case "7":
                        dateTimePicker.Format = DateTimePickerFormat.Long;
                        break;

                    // time
                    case "8":
                        dateTimePicker.Format = DateTimePickerFormat.Time;
                        break;

                    // Time Stamp
                    case "9":
                        dateTimePicker.Format       = DateTimePickerFormat.Custom;
                        dateTimePicker.CustomFormat = "dd.MM.yyyy HH:mm:ss";
                        break;

                    default:
                        dateTimePicker.Format = DateTimePickerFormat.Long;
                        break;
                    }

                    panelAttributes.Controls.Add(dateTimePicker);
                    dateTimePicker.BringToFront();

                    break;

                case "1":
                case "3":
                case "4":
                case "6":
                case "10":
                case "20":
                    // If it is values set - show as combobox
                    if (attr.valueset != null && attr.valueset.value.Count > 0)
                    {
                        comboBox               = new ComboBox();;
                        comboBox.Name          = "attributeControl_" + attr.name;
                        comboBox.Top           = step * (counter++);
                        comboBox.Left          = 29;
                        comboBox.Font          = new Font("Calibri", (float)9.75);
                        comboBox.Width         = 240;
                        comboBox.DropDownStyle = ComboBoxStyle.DropDownList;

                        Dictionary <string, string> values = new Dictionary <string, string>();

                        foreach (Value value in attr.valueset.value)
                        {
                            values.Add(value.name, value.desc);
                        }

                        comboBox.DataSource    = new BindingSource(values, null);
                        comboBox.DisplayMember = "Value";
                        comboBox.ValueMember   = "Key";

                        panelAttributes.Controls.Add(comboBox);

                        // default
                        comboBox.SelectedIndex = 0;

                        comboBox.BringToFront();
                    }
                    // else - textbox
                    else
                    {
                        textBox       = new TextBox();
                        textBox.Name  = "attributeControl_" + attr.name;
                        textBox.Top   = step * (counter++);
                        textBox.Left  = 29;
                        textBox.Font  = new Font("Calibri", (float)9.75);
                        textBox.Width = 240;

                        // Size property is NOT zero only for Type 1
                        // Otherwise - use length of maximun value
                        if (attr.type == "1")
                        {
                            textBox.MaxLength = Convert.ToInt32(attr.size);
                        }
                        else
                        {
                            textBox.MaxLength = attr.max.Length;
                        }

                        // Fill in Division value
                        if (attr.name == "M3_DIVI")
                        {
                            var value = entity.name.Substring(entity.name.Length - 3, 3);

                            if (int.TryParse(value, out var result))
                            {
                                textBox.Text = value;
                            }
                        }

                        textBox.AllowDrop  = true;
                        textBox.DragEnter += TextBox_DragEnter;
                        textBox.DragDrop  += TextBox_DragDrop;

                        // add event for validation
                        textBox.TextChanged += TextBox_TextChanged;

                        panelAttributes.Controls.Add(textBox);
                        textBox.BringToFront();
                    }

                    break;

                default:
                    // Do nothing
                    break;
                }

                // Add error label

                Label labelError = new Label();
                labelError.Text      = "";
                labelError.Name      = "label_error_" + attr.name;
                labelError.Top       = step * (counter) + 2;
                labelError.Left      = 29;
                labelError.AutoSize  = true;
                labelError.Font      = new Font("Calibri", (float)8.75);
                labelError.ForeColor = Color.Red;
                labelError.Height    = 17;
                labelError.Visible   = false;

                panelAttributes.Controls.Add(labelError);
            }
        }
Beispiel #12
0
        private void of_Init()
        {
            //解析根节点
            Regex reg = new Regex(@"\(((?<Open>\()|(?<-Open>\))|[^()])*(?(Open)(?!))\)");

            Tools.MatchString(is_source, reg, RootNode);
            Tools.MatchStringTable(is_source, reg, TableNode);


            #region table内部的数据列
            foreach (string node in TableNode)
            {
                if (!node.StartsWith("column=("))
                {
                    continue;
                }
                string source = string.Empty;
                source = node.Substring(8);
                source = source.Substring(0, source.Length - 1);
                string[] args = source.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);

                Hashtable htable = new Hashtable();
                htable.Add("nodename", node.Substring(0, node.IndexOf("(") - 1));
                foreach (string arg in args)
                {
                    string[] nodes = arg.Split('=');
                    if (nodes.Length == 2)
                    {
                        if (htable.Contains(nodes[0]))
                        {
                            continue;
                        }
                        htable.Add(nodes[0], nodes[1].Replace("\"", ""));
                    }
                }
                if (htable.Contains("name"))
                {
                    if (!columnTable.ContainsKey(htable["name"].ToString()))
                    {
                        columnTable.Add(htable["name"].ToString(), htable);
                    }
                }
            }
            #endregion

            #region 分析控件
            foreach (string node in RootNode)
            {
                if (node.StartsWith("compute(") || node.StartsWith("column(") || node.StartsWith("text("))
                {
                    string source = string.Empty;
                    if (node.StartsWith("compute("))
                    {
                        source = node.Substring(8);
                    }
                    if (node.StartsWith("column("))
                    {
                        source = node.Substring(7);
                    }
                    if (node.StartsWith("text("))
                    {
                        source = node.Substring(5);
                    }
                    source = source.Substring(0, source.Length - 1);
                    string[] args = source.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
                    //防止值内部有空格
                    Hashtable htable = new Hashtable();
                    htable.Add("nodename", node.Substring(0, node.IndexOf("(")));
                    for (int i = 0; i < args.Length; i++)
                    {
                        string   arg   = args[i];
                        string[] nodes = arg.Split('=');
                        if (nodes.Length == 2)
                        {
                            if (htable.Contains(nodes[0]))
                            {
                                continue;
                            }
                            if (nodes[1] == "\"")//内容带括号
                            {
                                if (i < args.Length)
                                {
                                    nodes[1] = args[i + 1];
                                }
                            }
                            htable.Add(nodes[0], nodes[1].Replace("\"", ""));
                        }
                    }
                    if (htable.Contains("x") && node.StartsWith("text("))
                    {
                        Point p = new Point(int.Parse(htable["x"].ToString()), int.Parse(htable["y"].ToString()));
                        columnText.Add(p, htable);
                    }
                    else if (htable.Contains("x"))
                    {
                        if (htable["nodename"].ToString() == "column")//数据列 加上table内的列数据
                        {
                            string    columnName = htable["name"].ToString();
                            Hashtable table      = columnTable[columnName];
                            columnTable.Remove(columnName);
                            foreach (string key in table.Keys)
                            {
                                if (!htable.Contains(key))
                                {
                                    htable.Add(key, table[key]);
                                }
                            }
                        }
                        Point p = new Point(int.Parse(htable["x"].ToString()), int.Parse(htable["y"].ToString()));
                        columnData.Add(p, htable);
                    }
                }
            }
            #endregion

            #region  X、Y轴排序
            List <KeyValuePair <Point, Hashtable> > lst = new List <KeyValuePair <Point, Hashtable> >(columnText);
            //进行排序 目前是顺序 当Y轴相同时 进行X轴排序
            lst.Sort(delegate(KeyValuePair <Point, Hashtable> s1, KeyValuePair <Point, Hashtable> s2)
            {
                if (s1.Key.Y != s2.Key.Y)
                {
                    return(s1.Key.Y.CompareTo(s2.Key.Y));
                }
                else
                {
                    return(s1.Key.X.CompareTo(s2.Key.X));
                }
            });
            columnText.Clear();
            foreach (KeyValuePair <Point, Hashtable> s in lst)
            {
                columnText.Add(s.Key, s.Value);
            }
            List <KeyValuePair <Point, Hashtable> > lst1 = new List <KeyValuePair <Point, Hashtable> >(columnData);
            //进行排序 目前是顺序 当Y轴相同时 进行X轴排序
            lst1.Sort(delegate(KeyValuePair <Point, Hashtable> s1, KeyValuePair <Point, Hashtable> s2)
            {
                if (s1.Key.Y != s2.Key.Y)
                {
                    return(s1.Key.Y.CompareTo(s2.Key.Y));
                }
                else
                {
                    return(s1.Key.X.CompareTo(s2.Key.X));
                }
            });
            columnData.Clear();
            foreach (KeyValuePair <Point, Hashtable> s in lst1)
            {
                columnData.Add(s.Key, s.Value);
            }

            #endregion

            #region 开始绘制
            int totalWidth  = 0;
            int totalHeight = 0;

            #region Label
            foreach (Point p in columnText.Keys)
            {
                Hashtable hashTable = columnText[p];
                decimal   x         = int.Parse(hashTable["x"] as string) / (decimal)4.2;
                decimal   y         = int.Parse(hashTable["y"] as string) / (decimal)4;
                decimal   width     = int.Parse(hashTable["width"] as string) / (decimal)4;
                decimal   height    = int.Parse(hashTable["height"] as string) / (decimal)3.3;
                string    text      = hashTable["text"] as string;
                string    fontface  = hashTable["font.face"] as string;
                Label     label     = new Label();
                label.Text      = text;
                label.Location  = new Point((int)x + 5, (int)y + 18);
                label.Width     = (int)width;
                label.Height    = 25;
                label.TextAlign = ContentAlignment.MiddleCenter;
                label.Margin    = new Padding(0);
                if (text.Length == 2 && label.Width < 39)
                {
                    label.Width    = 39;
                    label.Location = new Point(label.Location.X - 2, label.Location.Y);
                }
                if (text.Length > 5 && label.Width < 60)
                {
                    label.Location = new Point(label.Location.X, label.Location.Y + 5);
                }
                //ParentControl.Controls.Add(label);
                overlayer.DrawControl(label);
                label.BringToFront();
            }
            #endregion

            #region TextBox
            DddwName = new Dictionary <string, string>();
            foreach (Point p in columnData.Keys)
            {
                Hashtable hashTable         = columnData[p];
                decimal   x                 = int.Parse(hashTable["x"] as string) / (decimal)4.2;
                decimal   y                 = int.Parse(hashTable["y"] as string) / (decimal)4;
                decimal   width             = int.Parse(hashTable["width"] as string) / (decimal)4.2;
                decimal   height            = int.Parse(hashTable["height"] as string) / (decimal)3.3;
                string    name              = hashTable["name"] as string;
                string    dbname            = hashTable["dbname"] as string;
                string    format            = hashTable["format"] as string;
                string    dddwallowedit     = hashTable["dddw.allowedit"] as string;
                string    dddwdatacolumn    = hashTable["dddw.datacolumn"] as string;
                string    dddwdisplaycolumn = hashTable["dddw.displaycolumn"] as string;
                string    dddwname          = hashTable["dddw.name"] as string;
                #region 日期控件DateTimePicker
                if (format == "yyyy-mm-dd")
                {
                    DateTimePicker dateTimePicker = new DateTimePicker();
                    dateTimePicker.Format       = DateTimePickerFormat.Custom;
                    dateTimePicker.CustomFormat = "yyyy-MM-dd";
                    dateTimePicker.Name         = name;
                    dateTimePicker.Tag          = dbname;
                    dateTimePicker.Location     = new Point((int)x + 5, (int)y + 20);
                    dateTimePicker.Width        = (int)width;
                    dateTimePicker.Height       = 25;
                    dateTimePicker.Value        = DateTime.Now;
                    //ParentControl.Controls.Add(dateTimePicker);
                    overlayer.DrawControl(dateTimePicker);
                    dateTimePicker.BringToFront();
                    dgv_control.Add(name, dateTimePicker);
                }
                #endregion
                else
                {
                    //contextMenuStrip.Show(MousePosition.X, MousePosition.Y);
                    FormDesinger.UserControls.MyTextBox textBox = new FormDesinger.UserControls.MyTextBox();
                    textBox.Name            = name;
                    textBox.Tag             = dbname;
                    textBox.Location        = new Point((int)x + 5, (int)y + 20);
                    textBox.Width           = (int)width;
                    textBox.Height          = 25;
                    textBox.Margin          = new Padding(3, 0, 0, 0);
                    textBox.BackColor       = Color.FromArgb(252, 252, 252);
                    textBox.DBName          = dbname;
                    textBox.DwName          = dddwname;
                    textBox.DwDataColumn    = dddwdatacolumn;
                    textBox.DwDisplayColumn = dddwdisplaycolumn;
                    //ParentControl.Controls.Add(textBox);
                    overlayer.DrawControl(textBox);
                    textBox.BringToFront();
                    dgv_control.Add(name, textBox);
                }
                if (totalWidth < x + width + 20)
                {
                    totalWidth = (int)(x + width + 20);
                }
                if (totalHeight < y + 25 + 10)
                {
                    totalHeight = (int)(y + 25 + 30);
                }
            }
            #endregion
            #endregion

            overlayer.DesingerForm.SQL = Tools.GetSQLbyDwText(is_source);
            overlayer.DesingerFormSize = new Point(totalWidth + 24, totalHeight + 50);
        }
Beispiel #13
0
        private void loadShanuLabelDesign()
        {
            try
            {
                switch (gParam[0])
                {
                case "System.Windows.Forms.DataGridView":     //현재화면 사용가능여부 조회
                {
                    System.Drawing.Color myBackColor = new System.Drawing.Color();
                    myBackColor = System.Drawing.ColorTranslator.FromHtml(gParam[8]);

                    System.Drawing.Color RowsBackColor = new System.Drawing.Color();
                    RowsBackColor = System.Drawing.ColorTranslator.FromHtml(gParam[12]);

                    System.Drawing.Color AlternatebackColor = new System.Drawing.Color();
                    AlternatebackColor = System.Drawing.ColorTranslator.FromHtml(gParam[13]);

                    System.Drawing.Color HeaderColor = new System.Drawing.Color();
                    HeaderColor = System.Drawing.ColorTranslator.FromHtml(gParam[14]);

                    DataGridView ctrl = new DataGridView();
                    //ctrl.Image = global::DragObject.Properties.Resources.Sunset;
                    ctrl.BackColor         = myBackColor;
                    ctrl.Name              = gParam[10];
                    ctrl.Location          = new Point(System.Convert.ToInt32(gParam[1]), System.Convert.ToInt32(gParam[2]));
                    ctrl.Size              = new System.Drawing.Size(System.Convert.ToInt32(gParam[3]), System.Convert.ToInt32(gParam[4]));
                    ctrl.RowHeadersVisible = false;
                    ctrl.RowsDefaultCellStyle.BackColor = RowsBackColor;
                    ////ctrl.BackgroundColor = RowsBackColor;
                    //////GridColumnStylesCollection Alternate Rows Backcolr
                    ////ctrl.AlternatingRowsDefaultCellStyle.BackColor = AlternatebackColor;
                    ////ctrl.RowsDefaultCellStyle.BackColor = RowsBackColor;
                    //////Column Header back Color
                    ////ctrl.ColumnHeadersDefaultCellStyle.BackColor = HeaderColor;

                    ctrl.BackgroundColor = myBackColor;

                    ctrl.RowsDefaultCellStyle.BackColor = Color.White;

                    //GridColumnStylesCollection Alternate Rows Backcolr
                    ctrl.AlternatingRowsDefaultCellStyle.BackColor = AlternatebackColor;

                    //Column Header back Color
                    ctrl.ColumnHeadersDefaultCellStyle.BackColor = HeaderColor;
                    ctrl.ColumnHeadersHeight = 30;

                    //////ctrl.AutoGenerateColumns = false;
                    ctrl.EnableHeadersVisualStyles = false;

                    // Enable the row header
                    ctrl.RowHeadersVisible = false;

                    // to Hide the Last Empty row here we use false.
                    ctrl.AllowUserToAddRows = false;
                    pnlMain.Controls.Add(ctrl);
                    //  ComboControlNames.Items.Add(gParam[10]);
                }
                break;

                case "System.Windows.Forms.Label":     //현재화면 사용가능여부 조회
                {
                    var cvt = new FontConverter();
                    //string s = cvt.ConvertToString(this.Font);
                    Font f = StringToFont(gParam[6]);        // cvt.ConvertFromString(gParam[6]) as Font;
                    System.Drawing.Color myBackColor = new System.Drawing.Color();
                    myBackColor = System.Drawing.ColorTranslator.FromHtml(gParam[8]);
                    System.Drawing.Color myForeColorColor = new System.Drawing.Color();
                    myForeColorColor = System.Drawing.ColorTranslator.FromHtml(gParam[9]);
                    Label ctrl = new Label();
                    ctrl.Name      = gParam[10];
                    ctrl.Location  = new Point(System.Convert.ToInt32(gParam[1]), System.Convert.ToInt32(gParam[2]));
                    ctrl.Text      = gParam[5];
                    ctrl.Font      = f;
                    ctrl.BackColor = myBackColor;
                    ctrl.ForeColor = myForeColorColor;
                    ctrl.Size      = new System.Drawing.Size(System.Convert.ToInt32(gParam[3]), System.Convert.ToInt32(gParam[4]));
                    if (gParam[11] == "Front")
                    {
                        ctrl.BringToFront();
                    }
                    else
                    {
                        ctrl.SendToBack();
                    }
                    pnlMain.Controls.Add(ctrl);
                    //  ComboControlNames.Items.Add(gParam[10]);
                }
                break;

                case "System.Windows.Forms.Button":
                {
                    System.Drawing.Color myBackColor = new System.Drawing.Color();
                    myBackColor = System.Drawing.ColorTranslator.FromHtml(gParam[8]);
                    Button ctrl = new Button();
                    //ctrl.Image = global::DragObject.Properties.Resources.Sunset;
                    ctrl.BackColor = myBackColor;
                    ctrl.Name      = gParam[10];
                    ctrl.Location  = new Point(System.Convert.ToInt32(gParam[1]), System.Convert.ToInt32(gParam[2]));
                    ctrl.Text      = gParam[5];
                    ctrl.Size      = new System.Drawing.Size(System.Convert.ToInt32(gParam[3]), System.Convert.ToInt32(gParam[4]));
                    if (gParam[11] == "Front")
                    {
                        ctrl.BringToFront();
                    }
                    else
                    {
                        ctrl.SendToBack();
                    }
                    ctrl.Click += new EventHandler(control_Click);
                    pnlMain.Controls.Add(ctrl);
                    //  ComboControlNames.Items.Add(gParam[10]);
                }
                break;

                case "System.Windows.Forms.ComboBox":     //현재화면 사용가능여부 조회
                {
                    var cvt = new FontConverter();
                    //string s = cvt.ConvertToString(this.Font);
                    Font f = StringToFont(gParam[6]);        // cvt.ConvertFromString(gParam[6]) as Font;
                    System.Drawing.Color myBackColor = new System.Drawing.Color();
                    myBackColor = System.Drawing.ColorTranslator.FromHtml(gParam[8]);
                    System.Drawing.Color myForeColorColor = new System.Drawing.Color();
                    myForeColorColor = System.Drawing.ColorTranslator.FromHtml(gParam[9]);
                    ComboBox ctrl = new ComboBox();
                    ctrl.Name      = gParam[10];
                    ctrl.Location  = new Point(System.Convert.ToInt32(gParam[1]), System.Convert.ToInt32(gParam[2]));
                    ctrl.Text      = gParam[5];
                    ctrl.Font      = f;
                    ctrl.BackColor = myBackColor;
                    ctrl.ForeColor = myForeColorColor;
                    ctrl.Size      = new System.Drawing.Size(System.Convert.ToInt32(gParam[3]), System.Convert.ToInt32(gParam[4]));
                    if (gParam[11] == "Front")
                    {
                        ctrl.BringToFront();
                    }
                    else
                    {
                        ctrl.SendToBack();
                    }
                    pnlMain.Controls.Add(ctrl);
                    // ComboControlNames.Items.Add(gParam[10]);
                }
                break;

                case "System.Windows.Forms.ListBox":     //현재화면 사용가능여부 조회
                {
                    var cvt = new FontConverter();
                    //string s = cvt.ConvertToString(this.Font);
                    Font f = StringToFont(gParam[6]);        // cvt.ConvertFromString(gParam[6]) as Font;
                    System.Drawing.Color myBackColor = new System.Drawing.Color();
                    myBackColor = System.Drawing.ColorTranslator.FromHtml(gParam[8]);
                    System.Drawing.Color myForeColorColor = new System.Drawing.Color();
                    myForeColorColor = System.Drawing.ColorTranslator.FromHtml(gParam[9]);
                    ListBox ctrl = new ListBox();
                    ctrl.Name      = gParam[10];
                    ctrl.Location  = new Point(System.Convert.ToInt32(gParam[1]), System.Convert.ToInt32(gParam[2]));
                    ctrl.Text      = gParam[5];
                    ctrl.Font      = f;
                    ctrl.BackColor = myBackColor;
                    ctrl.ForeColor = myForeColorColor;
                    ctrl.Size      = new System.Drawing.Size(System.Convert.ToInt32(gParam[3]), System.Convert.ToInt32(gParam[4]));
                    if (gParam[11] == "Front")
                    {
                        ctrl.BringToFront();
                    }
                    else
                    {
                        ctrl.SendToBack();
                    }
                    pnlMain.Controls.Add(ctrl);
                    // ComboControlNames.Items.Add(gParam[10]);
                }
                break;

                case "System.Windows.Forms.Panel":     //현재화면 사용가능여부 조회
                {
                    var cvt = new FontConverter();
                    //string s = cvt.ConvertToString(this.Font);
                    Font f = StringToFont(gParam[6]);        // cvt.ConvertFromString(gParam[6]) as Font;
                    System.Drawing.Color myBackColor = new System.Drawing.Color();
                    myBackColor = System.Drawing.ColorTranslator.FromHtml(gParam[8]);
                    System.Drawing.Color myForeColorColor = new System.Drawing.Color();
                    myForeColorColor = System.Drawing.ColorTranslator.FromHtml(gParam[9]);

                    Panel ctrl = new Panel();
                    ctrl.Name      = gParam[10];
                    ctrl.Location  = new Point(System.Convert.ToInt32(gParam[1]), System.Convert.ToInt32(gParam[2]));
                    ctrl.Text      = gParam[5];
                    ctrl.Font      = f;
                    ctrl.BackColor = myBackColor;
                    ctrl.ForeColor = myForeColorColor;
                    ctrl.Size      = new System.Drawing.Size(System.Convert.ToInt32(gParam[3]), System.Convert.ToInt32(gParam[4]));
                    if (gParam[11] == "Front")
                    {
                        ctrl.BringToFront();
                    }
                    else
                    {
                        ctrl.SendToBack();
                    }
                    ctrl.SendToBack();
                    pnlMain.Controls.Add(ctrl);
                    //    ComboControlNames.Items.Add(gParam[10]);
                }
                break;

                case "System.Windows.Forms.NumericUpDown":     //현재화면 사용가능여부 조회
                {
                    var cvt = new FontConverter();
                    //string s = cvt.ConvertToString(this.Font);
                    Font f = StringToFont(gParam[6]);        // cvt.ConvertFromString(gParam[6]) as Font;
                    System.Drawing.Color myBackColor = new System.Drawing.Color();
                    myBackColor = System.Drawing.ColorTranslator.FromHtml(gParam[8]);
                    System.Drawing.Color myForeColorColor = new System.Drawing.Color();
                    myForeColorColor = System.Drawing.ColorTranslator.FromHtml(gParam[9]);

                    NumericUpDown ctrl = new NumericUpDown();
                    ctrl.Name      = gParam[10];
                    ctrl.Location  = new Point(System.Convert.ToInt32(gParam[1]), System.Convert.ToInt32(gParam[2]));
                    ctrl.Text      = gParam[5];
                    ctrl.Font      = f;
                    ctrl.BackColor = myBackColor;
                    ctrl.ForeColor = myForeColorColor;
                    ctrl.Size      = new System.Drawing.Size(System.Convert.ToInt32(gParam[3]), System.Convert.ToInt32(gParam[4]));
                    if (gParam[11] == "Front")
                    {
                        ctrl.BringToFront();
                    }
                    else
                    {
                        ctrl.SendToBack();
                    }
                    pnlMain.Controls.Add(ctrl);
                    // ComboControlNames.Items.Add(gParam[10]);
                }
                break;

                case "System.Windows.Forms.TreeView":     //현재화면 사용가능여부 조회
                {
                    var cvt = new FontConverter();
                    //string s = cvt.ConvertToString(this.Font);
                    Font f = StringToFont(gParam[6]);        // cvt.ConvertFromString(gParam[6]) as Font;
                    System.Drawing.Color myBackColor = new System.Drawing.Color();
                    myBackColor = System.Drawing.ColorTranslator.FromHtml(gParam[8]);
                    System.Drawing.Color myForeColorColor = new System.Drawing.Color();
                    myForeColorColor = System.Drawing.ColorTranslator.FromHtml(gParam[9]);

                    TreeView ctrl = new TreeView();
                    ctrl.Name      = gParam[10];
                    ctrl.Location  = new Point(System.Convert.ToInt32(gParam[1]), System.Convert.ToInt32(gParam[2]));
                    ctrl.Text      = gParam[5];
                    ctrl.Font      = f;
                    ctrl.BackColor = myBackColor;
                    ctrl.ForeColor = myForeColorColor;
                    ctrl.Size      = new System.Drawing.Size(System.Convert.ToInt32(gParam[3]), System.Convert.ToInt32(gParam[4]));
                    if (gParam[11] == "Front")
                    {
                        ctrl.BringToFront();
                    }
                    else
                    {
                        ctrl.SendToBack();
                    }
                    pnlMain.Controls.Add(ctrl);
                    //  ComboControlNames.Items.Add(gParam[10]);
                }
                break;

                case "System.Windows.Forms.DateTimePicker":     //현재화면 사용가능여부 조회
                {
                    var cvt = new FontConverter();
                    //string s = cvt.ConvertToString(this.Font);
                    Font f = StringToFont(gParam[6]);        // cvt.ConvertFromString(gParam[6]) as Font;
                    System.Drawing.Color myBackColor = new System.Drawing.Color();
                    myBackColor = System.Drawing.ColorTranslator.FromHtml(gParam[8]);
                    System.Drawing.Color myForeColorColor = new System.Drawing.Color();
                    myForeColorColor = System.Drawing.ColorTranslator.FromHtml(gParam[9]);

                    DateTimePicker ctrl = new DateTimePicker();
                    ctrl.Name      = gParam[10];
                    ctrl.Location  = new Point(System.Convert.ToInt32(gParam[1]), System.Convert.ToInt32(gParam[2]));
                    ctrl.Text      = gParam[5];
                    ctrl.Font      = f;
                    ctrl.BackColor = myBackColor;
                    ctrl.ForeColor = myForeColorColor;
                    ctrl.Size      = new System.Drawing.Size(System.Convert.ToInt32(gParam[3]), System.Convert.ToInt32(gParam[4]));
                    if (gParam[11] == "Front")
                    {
                        ctrl.BringToFront();
                    }
                    else
                    {
                        ctrl.SendToBack();
                    }
                    pnlMain.Controls.Add(ctrl);
                    //  ComboControlNames.Items.Add(gParam[10]);
                }
                break;

                case "System.Windows.Forms.TextBox":     //현재화면 사용가능여부 조회
                {
                    var cvt = new FontConverter();
                    //string s = cvt.ConvertToString(this.Font);
                    Font f = StringToFont(gParam[6]);        // cvt.ConvertFromString(gParam[6]) as Font;
                    System.Drawing.Color myBackColor = new System.Drawing.Color();
                    myBackColor = System.Drawing.ColorTranslator.FromHtml(gParam[8]);
                    System.Drawing.Color myForeColorColor = new System.Drawing.Color();
                    myForeColorColor = System.Drawing.ColorTranslator.FromHtml(gParam[9]);

                    TextBox ctrl = new TextBox();
                    ctrl.Name      = gParam[10];
                    ctrl.Location  = new Point(System.Convert.ToInt32(gParam[1]), System.Convert.ToInt32(gParam[2]));
                    ctrl.Text      = gParam[5];
                    ctrl.Font      = f;
                    ctrl.BackColor = myBackColor;
                    ctrl.ForeColor = myForeColorColor;
                    ctrl.Size      = new System.Drawing.Size(System.Convert.ToInt32(gParam[3]), System.Convert.ToInt32(gParam[4]));
                    if (gParam[11] == "Front")
                    {
                        ctrl.BringToFront();
                    }
                    else
                    {
                        ctrl.SendToBack();
                    }
                    pnlMain.Controls.Add(ctrl);
                    // ComboControlNames.Items.Add(gParam[10]);
                }
                break;

                case "System.Windows.Forms.RadioButton":     //현재화면 사용가능여부 조회
                {
                    var cvt = new FontConverter();
                    //string s = cvt.ConvertToString(this.Font);
                    Font f = StringToFont(gParam[6]);        // cvt.ConvertFromString(gParam[6]) as Font;
                    System.Drawing.Color myBackColor = new System.Drawing.Color();
                    myBackColor = System.Drawing.ColorTranslator.FromHtml(gParam[8]);
                    System.Drawing.Color myForeColorColor = new System.Drawing.Color();
                    myForeColorColor = System.Drawing.ColorTranslator.FromHtml(gParam[9]);

                    RadioButton ctrl = new RadioButton();
                    ctrl.Name      = gParam[10];
                    ctrl.Location  = new Point(System.Convert.ToInt32(gParam[1]), System.Convert.ToInt32(gParam[2]));
                    ctrl.Text      = gParam[5];
                    ctrl.Font      = f;
                    ctrl.BackColor = myBackColor;
                    ctrl.ForeColor = myForeColorColor;
                    ctrl.Size      = new System.Drawing.Size(System.Convert.ToInt32(gParam[3]), System.Convert.ToInt32(gParam[4]));
                    if (gParam[11] == "Front")
                    {
                        ctrl.BringToFront();
                    }
                    else
                    {
                        ctrl.SendToBack();
                    }
                    pnlMain.Controls.Add(ctrl);
                    // ComboControlNames.Items.Add(gParam[10]);
                }
                break;

                case "System.Windows.Forms.CheckBox":     //현재화면 사용가능여부 조회
                {
                    var cvt = new FontConverter();
                    //string s = cvt.ConvertToString(this.Font);
                    Font f = StringToFont(gParam[6]);        // cvt.ConvertFromString(gParam[6]) as Font;
                    System.Drawing.Color myBackColor = new System.Drawing.Color();
                    myBackColor = System.Drawing.ColorTranslator.FromHtml(gParam[8]);
                    System.Drawing.Color myForeColorColor = new System.Drawing.Color();
                    myForeColorColor = System.Drawing.ColorTranslator.FromHtml(gParam[9]);

                    CheckBox ctrl = new CheckBox();
                    ctrl.Name      = gParam[10];
                    ctrl.Location  = new Point(System.Convert.ToInt32(gParam[1]), System.Convert.ToInt32(gParam[2]));
                    ctrl.Text      = gParam[5];
                    ctrl.Font      = f;
                    ctrl.BackColor = myBackColor;
                    ctrl.ForeColor = myForeColorColor;
                    ctrl.Size      = new System.Drawing.Size(System.Convert.ToInt32(gParam[3]), System.Convert.ToInt32(gParam[4]));
                    if (gParam[11] == "Front")
                    {
                        ctrl.BringToFront();
                    }
                    else
                    {
                        ctrl.SendToBack();
                    }
                    pnlMain.Controls.Add(ctrl);
                    // ComboControlNames.Items.Add(gParam[10]);
                }
                break;

                case "System.Windows.Forms.PictureBox":     //현재화면 사용가능여부 조회
                {
                    System.Drawing.Color myBackColor = new System.Drawing.Color();
                    myBackColor = System.Drawing.ColorTranslator.FromHtml(gParam[8]);
                    PictureBox ctrl = new PictureBox();
                    //ctrl.Image = global::DragObject.Properties.Resources.Sunset;

                    ctrl.BackColor = myBackColor;
                    ctrl.Name      = gParam[10];
                    ctrl.Location  = new Point(System.Convert.ToInt32(gParam[1]), System.Convert.ToInt32(gParam[2]));
                    ctrl.SizeMode  = PictureBoxSizeMode.StretchImage;
                    ctrl.Size      = new System.Drawing.Size(System.Convert.ToInt32(gParam[3]), System.Convert.ToInt32(gParam[4]));

                    if (gParam[7] != "")
                    {
                        Bitmap bmp1 = new Bitmap(new MemoryStream(Convert.FromBase64String(gParam[7])));
                        ctrl.Image = bmp1;
                    }
                    if (gParam[11] == "Front")
                    {
                        ctrl.BringToFront();
                    }
                    else
                    {
                        ctrl.SendToBack();
                    }
                    ctrl.SendToBack();
                    pnlMain.Controls.Add(ctrl);
                    ctrl.SendToBack();
                    //  ComboControlNames.Items.Add(gParam[10]);
                }
                break;
                }
            }
            catch (Exception ex)
            {
            }
        }
Beispiel #14
0
 private void setTimePickers(DateTimePicker datePicker)
 {
     datePicker.ShowUpDown = true;
     datePicker.BringToFront();
 }
        public ucDataItemAdd(string dbName, int index, FieldInfo field, IDataFile db, IDataFieldEvent _fe)
        {
            int wi_Name = 110, wi_Max = 630, wi_ = 200;

            _Height = Height_Min;
            _Width  = wi_ + wi_Name + 8;
            string caption  = string.IsNullOrEmpty(field.CAPTION) ? field.NAME : field.CAPTION;
            Label  lbl_Name = new Label()
            {
                Dock = DockStyle.Left, Left = 4, Top = 0, Text = caption, AutoSize = false, Width = wi_Name, ForeColor = Color.Black, TextAlign = ContentAlignment.TopRight
            };

            this.Controls.Add(lbl_Name);

            if (field.TYPE_NAME == typeof(Byte).Name && field.KIT != ControlKit.CHECK)
            {
                ComboBox cbo = new ComboBox()
                {
                    Dock = DockStyle.Left, Left = wi_Name + 8, Top = 0, Width = wi_, Height = _Height, DropDownStyle = ComboBoxStyle.DropDownList, Tag = field,
                };
                for (int k = 0; k < 256; k++)
                {
                    cbo.Items.Add(k.ToString());
                }
                cbo.SelectedIndex = 0;
                this.Controls.Add(cbo);
                cbo.BringToFront();
                return;
            }

            #region

            switch (field.KIT)
            {
            case ControlKit.LABEL:
                Label lbl = new Label()
                {
                    Dock = DockStyle.Left, Left = wi_Name + 8, AutoSize = false, Width = wi_, Height = _Height - 5, BackColor = SystemColors.Control, Tag = field,
                };
                this.Controls.Add(lbl);
                lbl.BringToFront();
                break;

            case ControlKit.CHECK:
                CheckBox chk = new CheckBox()
                {
                    Dock = DockStyle.Left, Left = wi_Name + 8, Top = 0, Tag = field,
                };
                this.Controls.Add(chk);
                chk.BringToFront();
                break;

            case ControlKit.RADIO:
                RadioButton radio = new RadioButton()
                {
                    Dock = DockStyle.Left, Left = wi_Name + 8, Top = 0, Tag = field,
                };
                this.Controls.Add(radio);
                radio.BringToFront();
                break;

            case ControlKit.COLOR:
                Label lbl_Color = new Label()
                {
                    Dock = DockStyle.Left, Left = wi_Name + 8, AutoSize = false, Width = 44, Height = _Height - 5, BackColor = Color.Gray, Tag = field,
                };
                this.Controls.Add(lbl_Color);
                lbl_Color.BringToFront();
                break;

            case ControlKit.SELECT:
                ComboBox cbo = new ComboBox()
                {
                    Dock = DockStyle.Left, Left = wi_Name + 8, Top = 0, Width = wi_, Height = _Height, DropDownStyle = ComboBoxStyle.DropDownList, Tag = field,
                };
                IList lsi = db.GetComboboxItem(field);
                if (lsi != null && lsi.Count > 0)
                {
                    cbo.DisplayMember = field.JOIN_VIEW;
                    cbo.ValueMember   = field.JOIN_FIELD;
                    cbo.DataSource    = lsi;
                }
                this.Controls.Add(cbo);
                cbo.BringToFront();
                break;

            case ControlKit.TEXT_PASS:
                TextBox txt_Pass = new TextBox()
                {
                    Dock = DockStyle.Left, Left = wi_Name + 8, Top = 0, Width = wi_, Height = _Height, PasswordChar = '*', BorderStyle = BorderStyle.FixedSingle, Multiline = false, ScrollBars = ScrollBars.None, WordWrap = false, Tag = field,
                };
                this.Controls.Add(txt_Pass);
                txt_Pass.BringToFront();
                break;

            case ControlKit.TEXT_DATE:
            case ControlKit.TEXT_DATETIME:
            case ControlKit.TEXT_TIME:
                DateTimePicker dt = new DateTimePicker()
                {
                    Dock = DockStyle.Left, Left = wi_Name + 8, Top = 0, CustomFormat = "dd-MM-yyyy HH:mm:ss", Format = DateTimePickerFormat.Custom, Tag = field,
                };
                this.Controls.Add(dt);
                dt.BringToFront();
                break;

            case ControlKit.TEXT_EMAIL:
                TextBox txt_Email = new TextBox()
                {
                    Dock = DockStyle.Left, Left = wi_Name + 8, Top = 0, Width = wi_, Height = _Height, BorderStyle = BorderStyle.FixedSingle, Multiline = false, ScrollBars = ScrollBars.None, WordWrap = false, Tag = field,
                };
                this.Controls.Add(txt_Email);
                txt_Email.BringToFront();
                break;

            case ControlKit.TEXT_FILE:
                TextBox txt_File = new TextBox()
                {
                    Dock = DockStyle.Left, Left = wi_Name + 8, Top = 0, Width = wi_ - 30, Height = _Height, ReadOnly = true, BorderStyle = BorderStyle.FixedSingle, Multiline = false, ScrollBars = ScrollBars.None, WordWrap = false, Tag = field,
                };
                Button btn_Browser = new Button()
                {
                    Dock = DockStyle.Left, Left = wi_Name + 28, Top = 0, Height = 18, Width = 30, Text = "...", FlatStyle = FlatStyle.Flat
                };
                this.Controls.AddRange(new Control[] { txt_File, btn_Browser });
                txt_File.BringToFront();
                btn_Browser.BringToFront();
                btn_Browser.Click += (se, ev) => select_File(txt_File);
                break;

            case ControlKit.TEXTAREA:
                _Height = Height_Max;
                _Width  = wi_Max + wi_Name + 8;
                TextBox text_area = new TextBox()
                {
                    Dock = DockStyle.Left, Left = wi_Name + 8, Top = 0, Width = wi_Max, Height = _Height, BorderStyle = BorderStyle.FixedSingle, Multiline = true, ScrollBars = ScrollBars.Vertical, WordWrap = true, Tag = field,
                };
                this.Controls.Add(text_area);
                text_area.BringToFront();
                break;

            case ControlKit.LOOKUP:
                TextBox txt_Lookup = new TextBox()
                {
                    Dock = DockStyle.Left, Left = wi_Name + 8, Top = 0, Width = wi_, Height = _Height, ReadOnly = true, BorderStyle = BorderStyle.FixedSingle, Multiline = false, ScrollBars = ScrollBars.None, WordWrap = false, Tag = field,
                };
                this.Controls.Add(txt_Lookup);
                txt_Lookup.BringToFront();
                break;

            case ControlKit.HTML:
                _Height = Height_Full;
                _Width  = wi_Max + wi_Name + 8;
                HtmlEditor html = new HtmlEditor(db, _fe)
                {
                    Dock = DockStyle.Left, Left = wi_Name + 8, Top = 0, Width = wi_Max, Height = _Height, BorderStyle = BorderStyle.FixedSingle, Tag = field,
                };
                this.Controls.Add(html);
                html.BringToFront();
                break;

            default:     //case ControlKit.TEXT: break;
                TextBox txt = new TextBox()
                {
                    Dock = DockStyle.Left, Left = wi_Name + 8, Top = 0, Width = wi_, Height = _Height, BorderStyle = BorderStyle.FixedSingle, Multiline = false, ScrollBars = ScrollBars.None, WordWrap = false, Tag = field,
                };
                this.Controls.Add(txt);
                txt.BringToFront();
                break;
            }
            #endregion
        }
        public ucDataItemEdit(string dbName, int index, FieldInfo field, IDataFile db, IDataFieldEvent _fe)
        {
            int wi_Name = 110, wi_Max = 630, wi_ = 200;

            _Height = Height_Min;
            _Width  = wi_ + wi_Name + 8;
            string caption  = string.IsNullOrEmpty(field.CAPTION) ? field.NAME : field.CAPTION;
            Label  lbl_Name = new Label()
            {
                Dock = DockStyle.Left, Left = 4, Top = 0, Text = caption, AutoSize = false, Width = wi_Name, ForeColor = Color.Black, TextAlign = ContentAlignment.TopRight
            };

            this.Controls.Add(lbl_Name);

            if (field.TYPE_NAME == typeof(Byte).Name && field.KIT != ControlKit.CHECK)
            {
                ComboBox cbo = new ComboBox()
                {
                    Dock = DockStyle.Left, Left = wi_Name + 8, Top = 0, Width = wi_, Height = _Height, DropDownStyle = ComboBoxStyle.DropDownList, Tag = field,
                };
                for (int k = 0; k < 256; k++)
                {
                    cbo.Items.Add(k.ToString());
                }
                cbo.SelectedIndex = 0;
                this.Controls.Add(cbo);
                cbo.BringToFront();
                return;
            }

            #region

            switch (field.KIT)
            {
            case ControlKit.LABEL:
                Label lbl = new Label()
                {
                    Dock = DockStyle.Left, Left = wi_Name + 8, AutoSize = false, Width = wi_, Height = _Height - 5, BackColor = SystemColors.Control, Tag = field,
                };
                this.Controls.Add(lbl);
                if (field.Value != null)
                {
                    lbl.Text = field.Value.ToString();
                }
                lbl.BringToFront();
                break;

            case ControlKit.CHECK:
                CheckBox chk = new CheckBox()
                {
                    Dock = DockStyle.Left, Left = wi_Name + 8, Top = 0, Tag = field,
                };
                this.Controls.Add(chk);
                if (field.Value != null && field.Value.ToString() == "1")
                {
                    chk.Checked = true;
                }
                chk.BringToFront();
                break;

            case ControlKit.RADIO:
                RadioButton radio = new RadioButton()
                {
                    Dock = DockStyle.Left, Left = wi_Name + 8, Top = 0, Tag = field,
                };
                this.Controls.Add(radio);
                radio.BringToFront();
                break;

            case ControlKit.COLOR:
                Label lbl_Color = new Label()
                {
                    Dock = DockStyle.Left, Left = wi_Name + 8, AutoSize = false, Width = 44, Height = _Height - 5, BackColor = Color.Gray, Tag = field,
                };
                this.Controls.Add(lbl_Color);
                if (field.Value != null)
                {
                    lbl_Color.Text = field.Value.ToString();
                }
                lbl_Color.BringToFront();
                break;

            case ControlKit.SELECT:
                #region

                ComboBox cbo = new ComboBox()
                {
                    Dock = DockStyle.Left, Left = wi_Name + 8, Top = 0, Width = wi_, Height = _Height, DropDownStyle = ComboBoxStyle.DropDownList, Tag = field,
                };
                IList lsi = db.GetComboboxItem(field);
                if (lsi != null && lsi.Count > 0)
                {
                    List <string> lf = new List <string>();
                    foreach (object it in lsi)
                    {
                        object v = it.GetType().GetProperty(field.JOIN_FIELD).GetValue(it, null);
                        lf.Add(v == null ? "" : v.ToString());
                    }

                    List <string> lv = new List <string>();
                    foreach (object it in lsi)
                    {
                        object v = it.GetType().GetProperty(field.JOIN_VIEW).GetValue(it, null);
                        lv.Add(v == null ? "" : v.ToString());
                    }

                    for (int k = 0; k < lv.Count; k++)
                    {
                        cbo.Items.Add(new ComboboxItem()
                        {
                            Text = lv[k], Value = lf[k]
                        });
                    }
                }

                this.Controls.Add(cbo);

                if (field.Value != null)
                {
                    int kii = 0, _index = -1;
                    foreach (object myObj in lsi)
                    {
                        var lii = myObj.GetType().GetProperties().Select(pi => pi.GetValue(myObj, null)).Select(x => x == null ? "" : x.ToString()).ToList();
                        if (lii.IndexOf(field.Value.ToString()) != -1)
                        {
                            _index = kii;
                            break;
                        }
                        kii++;
                    }
                    if (_index != -1)
                    {
                        cbo.SelectedIndex = _index;
                    }
                }

                cbo.BringToFront();

                #endregion
                break;

            case ControlKit.TEXT_PASS:
                TextBox txt_Pass = new TextBox()
                {
                    Dock = DockStyle.Left, Left = wi_Name + 8, Top = 0, Width = wi_, Height = _Height, PasswordChar = '*', BorderStyle = BorderStyle.FixedSingle, Multiline = false, ScrollBars = ScrollBars.None, WordWrap = false, Tag = field,
                };
                if (field.Value != null)
                {
                    txt_Pass.Text = field.Value.ToString();
                }
                this.Controls.Add(txt_Pass);
                txt_Pass.BringToFront();
                break;

            case ControlKit.TEXT_DATE:
            case ControlKit.TEXT_DATETIME:
            case ControlKit.TEXT_TIME:
                DateTimePicker dt = new DateTimePicker()
                {
                    Dock = DockStyle.Left, Left = wi_Name + 8, Top = 0, CustomFormat = "dd-MM-yyyy HH:mm:ss", Format = DateTimePickerFormat.Custom, Tag = field,
                };
                this.Controls.Add(dt);
                dt.BringToFront();
                break;

            case ControlKit.TEXT_EMAIL:
                TextBox txt_Email = new TextBox()
                {
                    Dock = DockStyle.Left, Left = wi_Name + 8, Top = 0, Width = wi_, Height = _Height, BorderStyle = BorderStyle.FixedSingle, Multiline = false, ScrollBars = ScrollBars.None, WordWrap = false, Tag = field,
                };
                if (field.Value != null)
                {
                    txt_Email.Text = field.Value.ToString();
                }
                this.Controls.Add(txt_Email);
                txt_Email.BringToFront();
                break;

            case ControlKit.TEXT_FILE:
                TextBox txt_File = new TextBox()
                {
                    Dock = DockStyle.Left, Left = wi_Name + 8, Top = 0, Width = wi_ - 30, Height = _Height, ReadOnly = true, BorderStyle = BorderStyle.FixedSingle, Multiline = false, ScrollBars = ScrollBars.None, WordWrap = false, Tag = field,
                };
                Button btn_Browser = new Button()
                {
                    Dock = DockStyle.Left, Left = wi_Name + 28, Top = 0, Height = 18, Width = 30, Text = "...", FlatStyle = FlatStyle.Flat
                };
                this.Controls.AddRange(new Control[] { txt_File, btn_Browser });
                if (field.Value != null)
                {
                    txt_File.Text = field.Value.ToString();
                }
                txt_File.BringToFront();
                btn_Browser.BringToFront();
                btn_Browser.Click += (se, ev) => select_File(txt_File);
                break;

            case ControlKit.TEXTAREA:
                _Height = Height_Max;
                _Width  = wi_Max + wi_Name + 8;
                TextBox text_area = new TextBox()
                {
                    Dock = DockStyle.Left, Left = wi_Name + 8, Top = 0, Width = wi_Max, Height = _Height, BorderStyle = BorderStyle.FixedSingle, Multiline = true, ScrollBars = ScrollBars.Vertical, WordWrap = true, Tag = field,
                };
                this.Controls.Add(text_area);
                if (field.Value != null)
                {
                    text_area.Text = field.Value.ToString();
                }
                text_area.BringToFront();
                break;

            case ControlKit.LOOKUP:
                TextBox txt_Lookup = new TextBox()
                {
                    Dock = DockStyle.Left, Left = wi_Name + 8, Top = 0, Width = wi_, Height = _Height, ReadOnly = true, BorderStyle = BorderStyle.FixedSingle, Multiline = false, ScrollBars = ScrollBars.None, WordWrap = false, Tag = field,
                };
                this.Controls.Add(txt_Lookup);
                if (field.Value != null)
                {
                    txt_Lookup.Text = field.Value.ToString();
                }
                txt_Lookup.BringToFront();
                break;

            case ControlKit.HTML:
                _Height = Height_Full;
                _Width  = wi_Max + wi_Name + 8;
                HtmlEditor html = new HtmlEditor(db, _fe)
                {
                    Dock = DockStyle.Left, Left = wi_Name + 8, Top = 0, Width = wi_Max, Height = _Height, BorderStyle = BorderStyle.FixedSingle, Tag = field,
                };
                this.Controls.Add(html);
                if (field.Value != null)
                {
                    html.Html = field.Value.ToString();
                }
                html.BringToFront();
                break;

            default:     //case ControlKit.TEXT: break;
                TextBox txt = new TextBox()
                {
                    Dock = DockStyle.Left, Left = wi_Name + 8, Top = 0, Width = wi_, Height = _Height, BorderStyle = BorderStyle.FixedSingle, Multiline = false, ScrollBars = ScrollBars.None, WordWrap = false, Tag = field,
                };
                this.Controls.Add(txt);
                if (field.Value != null)
                {
                    txt.Text = field.Value.ToString();
                }
                txt.BringToFront();
                break;
            }
            #endregion
        }