public ucDataSplitConfig(string waterMarkText, string checkText) { this.Font = App.Font; txt_SkipLine = new TextBoxCustom() { Dock = DockStyle.Left, Width = 60, Text = "0", WaterMark = "Skip line", BorderStyle = BorderStyle.FixedSingle, TextAlign = HorizontalAlignment.Center }; txt_SkipLine.KeyPress += (se, ev) => { if (!char.IsControl(ev.KeyChar) && !char.IsDigit(ev.KeyChar)) { ev.Handled = true; } }; txt_Text = new TextBoxCustom() { Dock = DockStyle.Fill, WaterMark = waterMarkText, BorderStyle = BorderStyle.FixedSingle, TextAlign = HorizontalAlignment.Center }; this.Controls.AddRange(new Control[] { txt_SkipLine, txt_Text }); txt_Text.BringToFront(); }
public ucModelFieldAdd(int index, IDataFile db) { if (index != 0 && index % 2 == 0) { BackColor = Color.Gray; } string[] models = db.GetListDB(); #region [ === UI === ] txt_Name = new TextBoxCustom() { Left = 4, Top = _top, Width = 80, Name = "name" + index.ToString(), WaterMark = "Name ...", BorderStyle = BorderStyle.FixedSingle, TextAlign = HorizontalAlignment.Center }; cbo_Type = new ComboBox() { Left = 88, Top = _top, Width = 60, Name = "type" + index.ToString(), DropDownStyle = ComboBoxStyle.DropDownList, }; chk_Auto = new CheckBox() { Left = 164, Top = _top, Width = 22, Name = "auto" + index.ToString() }; for (int k = 0; k < dbType.Types.Length; k++) { cbo_Type.Items.Add(dbType.Types[k]); } cbo_Type.SelectedIndex = 0; cbo_Kit = new ComboBox() { Left = 192, Top = _top, Width = 80, Name = "kit" + index.ToString(), DropDownStyle = ComboBoxStyle.DropDownList, }; foreach (ControlKit kit in Kits) { cbo_Kit.Items.Add(new ComboboxItem() { Text = kit.ToString().ToUpper(), Value = ((int)kit) }); } cbo_Kit.SelectedIndex = 0; cbo_LinkType = new ComboBox() { Left = 276, Top = _top, Width = 84, Name = "link_type" + index.ToString(), DropDownStyle = ComboBoxStyle.DropDownList }; foreach (JoinType ti in JoinTypes) { cbo_LinkType.Items.Add(new ComboboxItem() { Text = ti.ToString().ToUpper(), Value = ((int)ti) }); } cbo_LinkType.SelectedIndex = 0; txt_ValueDefault = new TextBoxCustom() { Left = 363, Top = _top, Width = 200, Name = "value_default" + index.ToString(), WaterMark = "Default value: v1|v2|...", BorderStyle = BorderStyle.FixedSingle }; cbo_LinkModel = new ComboBox() { Visible = false, Left = 363, Top = _top, Width = 100, Name = "link_model" + index.ToString(), DropDownStyle = ComboBoxStyle.DropDownList, }; cbo_LinkField = new ComboBox() { Visible = false, Left = 465, Top = _top, Width = 100, Name = "link_field" + index.ToString(), DropDownStyle = ComboBoxStyle.DropDownList, }; cbo_LinkModel.Items.Add(new ComboboxItem() { Text = "", Value = "" }); for (int k = 0; k < models.Length; k++) { cbo_LinkModel.Items.Add(new ComboboxItem() { Text = models[k].ToUpper(), Value = models[k] }); } cbo_LinkModel.SelectedIndex = 0; txt_Caption = new TextBoxCustom() { Left = 568, Top = _top, Width = 100, Name = "caption" + index.ToString(), WaterMark = "Caption title ...", BorderStyle = BorderStyle.FixedSingle, TextAlign = HorizontalAlignment.Center }; chk_Index = new CheckBox() { Left = 684, Top = _top, Width = 20, Name = "index" + index.ToString(), Checked = false }; chk_Null = new CheckBox() { Left = 720, Top = _top, Width = 15, Name = "null" + index.ToString(), Checked = true }; /////////////////////////////////////////////////////////////////////////////////////////////// btn_Ext = new Button() { Text = "+", Left = 744, Top = _top, Width = 20 }; int hiBox = 30; txt_CaptionShort = new TextBoxCustom() { Left = 4, Top = _top + 30, Width = 100, Name = "caption_short" + index.ToString(), WaterMark = "Caption short ...", BorderStyle = BorderStyle.FixedSingle }; txt_Des = new TextBoxCustom() { Left = 112, Top = _top + 30, Width = 150, Name = "des" + index.ToString(), WaterMark = "Description ...", BorderStyle = BorderStyle.FixedSingle, TextAlign = HorizontalAlignment.Center }; chk_MobiShow = new CheckBox() { Left = 268, Top = _top + 30, Name = "mobi" + index.ToString(), Text = "Show Mobi", Width = 90, Checked = true }; chk_TabletShow = new CheckBox() { Left = 358, Top = _top + 30, Name = "tablet" + index.ToString(), Text = "Show Tablet", Width = 100, Checked = true }; chk_Duplicate = new CheckBox() { Left = 460, Top = _top + 30, Name = "duplicate" + index.ToString(), Text = "Duplicate", Width = 100, Checked = true }; chk_Encrypt = new CheckBox() { Left = 560, Top = _top + 30, Name = "encrypt" + index.ToString(), Text = "Encrypt", Width = 100, Checked = false }; btn_Remove = new Button() { Text = "Remove", Left = 704, Top = _top + 30, Width = 60 }; btn_Remove.Click += (se, ev) => remove_Field(index); btn_Ext.Click += (se, ev) => { if (btn_Ext.Text == "-") { btn_Ext.Text = "+"; this.Height = this.Height - hiBox; } else { btn_Ext.Text = "-"; this.Height = this.Height + hiBox; } }; this.Controls.AddRange(new Control[] { txt_Name, cbo_Type, chk_Auto, cbo_Kit, cbo_LinkType, txt_ValueDefault, cbo_LinkModel, cbo_LinkField, txt_Caption, chk_Index, chk_Null, btn_Ext, txt_CaptionShort, txt_Des, chk_MobiShow, chk_TabletShow, chk_Duplicate, chk_Encrypt, btn_Remove }); #endregion /////////////////////////////////////////////////////////////////////////////////////////////// #region [ === EVENT === ] cbo_LinkModel.Visible = false; cbo_LinkField.Visible = false; int ijt = JoinTypes.FindIndex(x => x == JoinType.DEF_VALUE); cbo_LinkType.SelectedIndex = ijt; cbo_Type.SelectedIndexChanged += (se, ev) => { string type = dbType.Types[cbo_Type.SelectedIndex]; if (type == typeof(Boolean).Name) { chk_Auto.Checked = false; chk_Auto.Visible = false; int iKit = Kits.FindIndex(x => x == ControlKit.CHECK); cbo_Kit.SelectedIndex = iKit; cbo_Kit.Enabled = false; cbo_LinkType.Visible = false; return; } else { chk_Auto.Visible = true; cbo_Kit.Enabled = true; cbo_Kit.SelectedIndex = 0; cbo_LinkType.Visible = true; return; } if (type == typeof(DateTime).Name) { int iKit = Kits.FindIndex(x => x == ControlKit.TEXT_DATETIME); cbo_Kit.SelectedIndex = iKit; cbo_Kit.Enabled = false; return; } else { cbo_Kit.Enabled = true; cbo_Kit.SelectedIndex = 0; return; } }; cbo_Kit.SelectedIndexChanged += (se, ev) => kit_Change(); cbo_LinkType.SelectedIndexChanged += (se, ev) => { JoinType ji = JoinTypes[cbo_LinkType.SelectedIndex]; switch (ji) { case JoinType.NONE: cbo_LinkType.SelectedIndex = 1; break; case JoinType.DEF_VALUE: txt_ValueDefault.Visible = true; cbo_LinkModel.Visible = false; cbo_LinkField.Visible = false; break; case JoinType.JOIN_MODEL: txt_ValueDefault.Visible = false; cbo_LinkModel.Visible = true; cbo_LinkField.Visible = true; break; } }; cbo_LinkModel.SelectedIndexChanged += (se, ev) => { cbo_LinkField.Items.Clear(); if (cbo_LinkModel.SelectedIndex > 0) { string m = models[cbo_LinkModel.SelectedIndex - 1]; if (!string.IsNullOrEmpty(m)) { var fs = db.GetFields(m).ToArray(); if (fs.Length > 0) { for (int k = 0; k < fs.Length; k++) { cbo_LinkField.Items.Add(new ComboboxItem() { Text = fs[k].Name.ToUpper() + " - " + fs[k].Type.Name, Value = fs[k].Name }); } cbo_LinkField.SelectedIndex = 0; } } } }; chk_Auto.CheckedChanged += (se, ev) => { kit_Change(); if (chk_Auto.Checked) { // FIELD KEY AUTO chk_Null.Checked = false; chk_Null.Visible = false; cbo_Kit.Visible = false; cbo_LinkType.Visible = false; txt_ValueDefault.Visible = false; cbo_LinkModel.Visible = false; cbo_LinkField.Visible = false; } else { // FIELD DATA chk_Null.Visible = true; cbo_Kit.Visible = true; cbo_LinkType.Visible = true; txt_ValueDefault.Visible = true; } }; #endregion /////////////////////////////////////////////////////////////////////////////////////////////// }
public FormModelAdd(IDataFile _db) : base("Model Add", true) { db = _db; ClientSize = new Size(fWidth, fHeight); countField = 0; #region [ === CONTROLS UI === ] Panel boi_DbName = new Panel() { Dock = DockStyle.Top, Height = 62, }; boi_DbName.MouseDown += FormMove_MouseDown; Label lbl_Name = new Label() { Left = 4, Width = 120, Top = 7, Text = "Model name", AutoSize = false, Height = 20, BackColor = Color.Gray, ForeColor = Color.Black, TextAlign = ContentAlignment.MiddleCenter }; TextBoxCustom txt_Name = new TextBoxCustom() { Left = 124, Top = 7, Width = 120, WaterMark = "Model name ...", BorderStyle = BorderStyle.FixedSingle, TextAlign = HorizontalAlignment.Center }; Label lbl_Caption = new Label() { Left = 252, Top = 7, Width = 120, Text = "Model caption", AutoSize = false, Height = 20, BackColor = Color.Gray, ForeColor = Color.Black, TextAlign = ContentAlignment.MiddleCenter }; TextBoxCustom txt_Caption = new TextBoxCustom() { Left = 372, Top = 7, Width = 120, WaterMark = "Model caption ...", BorderStyle = BorderStyle.FixedSingle, TextAlign = HorizontalAlignment.Center }; boi_DbName.Controls.AddRange(new Control[] { lbl_Name, lbl_Caption, txt_Name, txt_Caption, new ucModelTitle() { Left = 4, Top = 39, Height = 25, Width = fWidth - (SystemInformation.VerticalScrollBarWidth + 20) } }); FlowLayoutPanel boi_Filter = new FlowLayoutPanel() { Dock = DockStyle.Fill, AutoScroll = true, WrapContents = false, Padding = new Padding(0), BackColor = Color.WhiteSmoke, FlowDirection = FlowDirection.TopDown, }; boi_Filter.MouseDown += FormMove_MouseDown; form_Add(boi_Filter); form_Add(boi_Filter); Panel boi_Action = new Panel() { Dock = DockStyle.Bottom, Height = 25 }; Button btn_Add = new Button() { Dock = DockStyle.Right, Text = "ADD", BackColor = Color.WhiteSmoke, Width = 60, TextAlign = ContentAlignment.MiddleCenter }; //Button btn_Remove = new Button() { Dock = DockStyle.Right, Text = "REMOVE", BackColor = Color.WhiteSmoke, Width = 70, TextAlign = ContentAlignment.MiddleCenter }; Button btn_Submit = new Button() { Dock = DockStyle.Right, Text = "SUBMIT", BackColor = Color.WhiteSmoke, Width = 60, TextAlign = ContentAlignment.MiddleCenter }; boi_Action.Controls.AddRange(new Control[] { btn_Add, btn_Submit }); this.Controls.AddRange(new Control[] { boi_DbName, boi_Filter, boi_Action }); boi_DbName.BringToFront(); boi_Action.BringToFront(); boi_Filter.BringToFront(); btn_Submit.Focus(); btn_Add.Click += (se, ev) => form_Add(boi_Filter); //btn_Remove.Click += (se, ev) => form_Remove(boi_Filter); #endregion btn_Submit.Click += (se, ev) => form_Submit(txt_Name.Text, txt_Caption.Text, boi_Filter); HideScrollBar(boi_Filter.Handle, ScrollBarHide.SB_HORZ); }//end function init()
public ucModelFielEdit(int index, IDataFile _db, FieldInfo field) { db = _db; Field = field; if (index != 0 && index % 2 == 0) { BackColor = Color.Gray; } else { BackColor = SystemColors.ControlLight; } DbName = db.GetListDB(); #region [ === UI === ] ////////////////////////////////////////////////////////////////////// // LINE 1: txt_Name = new TextBoxCustom() { Left = 4, Top = _topLine1 + 4, Width = 80, Name = "name" + index.ToString(), Text = field.NAME, WaterMark = "Name ...", ForeColor = Color.Red, BorderStyle = BorderStyle.None, TextAlign = HorizontalAlignment.Center, BackColor = this.BackColor }; cbo_Type = new ComboBox() { Left = 88, Top = _topLine1, Width = 60, Name = "type" + index.ToString(), DropDownStyle = ComboBoxStyle.DropDownList }; chk_Auto = new CheckBox() { Left = 164, Top = _topLine1, Width = 22, Name = "auto" + index.ToString() }; for (int k = 0; k < dbType.Types.Length; k++) { cbo_Type.Items.Add(dbType.Types[k]); } cbo_Type.SelectedIndex = 0; cbo_Kit = new ComboBox() { Left = 192, Top = _topLine1, Width = 80, Name = "kit" + index.ToString(), DropDownStyle = ComboBoxStyle.DropDownList, }; foreach (ControlKit kit in Kits) { cbo_Kit.Items.Add(new ComboboxItem() { Text = kit.ToString().ToUpper(), Value = ((int)kit) }); } cbo_Kit.SelectedIndex = 0; cbo_LinkType = new ComboBox() { Left = 276, Top = _topLine1, Width = 84, Name = "link_type" + index.ToString(), DropDownStyle = ComboBoxStyle.DropDownList }; foreach (JoinType ti in JoinTypes) { cbo_LinkType.Items.Add(new ComboboxItem() { Text = ti.ToString().ToUpper(), Value = ((int)ti) }); } cbo_LinkType.SelectedIndex = 0; txt_ValueDefault = new TextBoxCustom() { Left = 363, Top = _topLine1, Width = 307, Name = "value_default" + index.ToString(), WaterMark = "Default value: v1|v2|...", BorderStyle = BorderStyle.FixedSingle }; cbo_LinkModel = new ComboBox() { Visible = false, Left = 363, Top = _topLine1, Width = 100, Name = "link_model" + index.ToString(), DropDownStyle = ComboBoxStyle.DropDownList, }; cbo_LinkField = new ComboBox() { Visible = false, Left = 465, Top = _topLine1, Width = 100, Name = "link_field" + index.ToString(), DropDownStyle = ComboBoxStyle.DropDownList, }; cbo_LinkModel.Items.Add(new ComboboxItem() { Text = "", Value = "" }); for (int k = 0; k < DbName.Length; k++) { cbo_LinkModel.Items.Add(new ComboboxItem() { Text = DbName[k].ToUpper(), Value = DbName[k] }); } cbo_LinkModel.SelectedIndex = 0; cbo_LinkView = new ComboBox() { Visible = false, Left = 568, Top = _topLine1, Width = 100, Name = "link_view" + index.ToString(), DropDownStyle = ComboBoxStyle.DropDownList, }; chk_Index = new CheckBox() { Left = 684, Top = _topLine1, Width = 20, Name = "index" + index.ToString(), Checked = false }; chk_Null = new CheckBox() { Left = 720, Top = _topLine1, Width = 15, Name = "null" + index.ToString(), Checked = true }; ////////////////////////////////////////////////////////////////////// // LINE 2 txt_Caption = new ucTextBoxH(100) { Left = 4, Top = _topLine2, Name = "caption" + index.ToString(), Title = "Caption" }; txt_CaptionShort = new ucTextBoxH(100) { Left = 112, Top = _topLine2, Name = "caption_short" + index.ToString(), Title = "Caption short" }; txt_Des = new ucTextBoxH(130) { Left = 216, Top = _topLine2, Name = "des" + index.ToString(), Title = "Description" }; chk_MobiShow = new CheckBox() { Left = 358, Top = _topLine1 + 30, Name = "mobi" + index.ToString(), Text = "Show Mobi", Width = 80, Checked = true }; chk_TabletShow = new CheckBox() { Left = 440, Top = _topLine1 + 30, Name = "tablet" + index.ToString(), Text = "Show Tablet", Width = 90, Checked = true }; chk_Duplicate = new CheckBox() { Left = 530, Top = _topLine1 + 30, Name = "duplicate" + index.ToString(), Text = "Duplicate", Width = 77, Checked = true }; chk_Encrypt = new CheckBox() { Left = 607, Top = _topLine1 + 30, Name = "encrypt" + index.ToString(), Text = "Encrypt", Width = 66, Checked = false }; txt_FieldChange = new TextBox() { Visible = false, Name = "field_change" + index.ToString(), Text = ((int)dbFieldChange.UPDATE).ToString() }; btn_Ext = new Button() { Text = "+", Left = 744, Top = _topLine1, Width = 20, BackColor = SystemColors.Control }; btn_Remove = new Button() { Left = 704, Top = _topLine1 + 30, Width = 60, Text = "Remove", BackColor = SystemColors.Control }; btn_Remove.Click += (se, ev) => remove_Field(txt_FieldChange); btn_Ext.Click += (se, ev) => { if (btn_Ext.Text == "-") { btn_Ext.Text = "+"; this.Height = this.Height - hiBox; } else { btn_Ext.Text = "-"; this.Height = this.Height + hiBox; } }; txt_OrderByEdit = new ucTextBoxH(100) { Left = 4, Top = _topLine3, Name = "order_edit" + index.ToString(), Text = "99", Title = "Order on form", TextAlign = HorizontalAlignment.Center, OnlyInputNumber0To9 = true }; txt_OrderByView = new ucTextBoxH(100) { Left = 112, Top = _topLine3, Name = "order_view" + index.ToString(), Text = "99", Title = "Order on grid", TextAlign = HorizontalAlignment.Center, OnlyInputNumber0To9 = true }; //txt_Des = new TextBoxCustom() { Left = 216, Top = _top + 30, Width = 130, Name = "des" + index.ToString(), WaterMark = "Description ...", BorderStyle = BorderStyle.FixedSingle, TextAlign = HorizontalAlignment.Center }; ////////////////////////////////////////////////////////////////////// // LINE 3 cbo_FuncValidate = new CustomComboBox() { Left = 358, Top = _topLine3, Width = 300, Name = "func_edit" + index.ToString(), Text = dbFunc.title_FUNC_VALIDATE_ON_FORM, }; string[] afunc = dbFunc.GetFuncValidate(); int index_VALIDATE_EMPTY = afunc.FindIndex(x => x == dbFunc.VALIDATE_EMPTY); CheckedListBox list_FuncValidate = new CheckedListBox() { BorderStyle = BorderStyle.None, Width = 300, }; foreach (string fi in afunc) { list_FuncValidate.Items.Add(new ComboboxItem() { Text = fi, Value = fi }); } cbo_FuncValidate.KeyPress += (se, ev) => { ev.Handled = true; }; cbo_FuncValidate.DropDownControl = list_FuncValidate; cbo_FuncValidate.DropDown += (se, ev) => { }; cbo_FuncValidate.DropDownClosed += (se, ev) => { }; list_FuncValidate.ItemCheck += (se, ev) => { List <string> li = new List <string>(); foreach (var o in list_FuncValidate.CheckedItems) { li.Add(o.ToString()); } string it = afunc[ev.Index]; CheckState val = ev.NewValue; if (val == CheckState.Checked) { li.Add(it); } else { li.Remove(it); } if (li.Count > 2) { cbo_FuncValidate.Text = "(" + li.Count.ToString() + ") Func validate on form"; } else { cbo_FuncValidate.Text = string.Join(",", li.Distinct().ToArray()); } }; ////////////////////////////////////////////////////////////////// cbo_FuncBeforeUpdate = new CustomComboBox() { Left = 358, Top = _topLine4, Width = 300, Name = "func_before_update" + index.ToString(), Text = dbFunc.title_FUNC_BEFORE_ADD_OR_UPDATE, }; string[] afuncUpdate = dbFunc.GetFuncBeforeAddOrUpdate(); CheckedListBox list_FuncUpdate = new CheckedListBox() { BorderStyle = BorderStyle.None, Width = 300, }; foreach (string fi in afuncUpdate) { list_FuncUpdate.Items.Add(new ComboboxItem() { Text = fi, Value = fi }); } cbo_FuncBeforeUpdate.KeyPress += (se, ev) => { ev.Handled = true; }; cbo_FuncBeforeUpdate.DropDownControl = list_FuncUpdate; cbo_FuncBeforeUpdate.DropDown += (se, ev) => { }; cbo_FuncBeforeUpdate.DropDownClosed += (se, ev) => { }; list_FuncUpdate.ItemCheck += (se, ev) => { List <string> li = new List <string>(); foreach (var o in list_FuncUpdate.CheckedItems) { li.Add(o.ToString()); } string it = afuncUpdate[ev.Index]; CheckState val = ev.NewValue; if (val == CheckState.Checked) { li.Add(it); } else { li.Remove(it); } if (li.Count > 2) { cbo_FuncBeforeUpdate.Text = "(" + li.Count.ToString() + ") Func validate on form"; } else { cbo_FuncBeforeUpdate.Text = string.Join(",", li.Distinct().ToArray()); } }; txt_KeyUri = new ucTextBoxH() { Left = 4, Top = _topLine4, Width = 100, Name = "key_url" + index.ToString(), Title = "Position Key url", OnlyInputNumber0To9 = true, TextAlign = HorizontalAlignment.Center, }; ////////////////////////////////////////////////////////////////////// // LINE 5 chk_ShowInGrid = new CheckBox() { Text = "Show only query detail", Left = 4, Top = _topLine5, Name = "show_in_grid" + index.ToString(), Width = 150, }; chk_IsFullTextSearch = new CheckBox() { Text = "Is full text search", Left = 160, Top = _topLine5, Name = "full_text_search" + index.ToString(), Width = 120, }; chk_IsKeySync = new CheckBox() { Text = "Is key for sync or edit", Left = 320, Top = _topLine5, Name = "key_for_sync" + index.ToString(), Width = 150, }; ////////////////////////////////////////////////////////////////////// this.Controls.AddRange(new Control[] { txt_Name, cbo_Type, chk_Auto, cbo_Kit, cbo_LinkType, txt_ValueDefault, cbo_LinkModel, cbo_LinkField, cbo_LinkView, chk_Index, chk_Null, btn_Ext, txt_Caption, txt_CaptionShort, txt_Des, chk_MobiShow, chk_TabletShow, chk_Duplicate, chk_Encrypt, txt_OrderByView, txt_OrderByEdit, cbo_FuncValidate, cbo_FuncBeforeUpdate, txt_KeyUri, btn_Remove, txt_FieldChange, chk_ShowInGrid, chk_IsFullTextSearch, chk_IsKeySync }); #endregion /////////////////////////////////////////////////////////////////////////////////////////////// #region [ === EVENT === ] cbo_LinkModel.Visible = false; cbo_LinkField.Visible = false; cbo_LinkView.Visible = false; int ijt = JoinTypes.FindIndex(x => x == JoinType.DEF_VALUE); cbo_LinkType.SelectedIndex = ijt; cbo_Type.SelectedIndexChanged += (se, ev) => type_Change(); cbo_Kit.SelectedIndexChanged += (se, ev) => kit_Change(); cbo_LinkType.SelectedIndexChanged += (se, ev) => joinType_Change(); cbo_LinkModel.SelectedIndexChanged += (se, ev) => joinModel_Change(); chk_Auto.CheckedChanged += (se, ev) => auto_Change(); #endregion /////////////////////////////////////////////////////////////////////////////////////////////// #region [ === SET VALUE === ] chk_IsKeySync.Checked = field.IS_KEY_SYNC_EDIT; chk_IsFullTextSearch.Checked = field.IS_FULL_TEXT_SEARCH; chk_ShowInGrid.Checked = field.ONLY_SHOW_IN_DETAIL; chk_Null.Checked = field.IS_ALLOW_NULL; chk_MobiShow.Checked = field.MOBI; chk_TabletShow.Checked = field.TABLET; chk_Duplicate.Checked = field.IS_NOT_DUPLICATE; chk_Encrypt.Checked = field.IS_ENCRYPT; txt_Caption.Text = field.CAPTION; txt_CaptionShort.Text = field.CAPTION_SHORT; txt_Des.Text = field.DESCRIPTION; txt_Name.Text = field.NAME; cbo_Type.SelectedIndex = dbType.Types.FindIndex(x => x == field.TYPE_NAME); txt_Name.ReadOnly = true; cbo_Type.Enabled = false; chk_Auto.Checked = field.IS_KEY_AUTO; auto_Change(); cbo_Kit.SelectedIndex = Kits.FindIndex(x => x == field.KIT); kit_Change(); cbo_LinkType.SelectedIndex = JoinTypes.FindIndex(x => x == field.JOIN_TYPE); joinType_Change(); txt_ValueDefault.Text = field.VALUE_DEFAULT == null ? "" : string.Join("|", field.VALUE_DEFAULT); if (!string.IsNullOrEmpty(field.JOIN_MODEL)) { isFirstLoad = true; int k1 = cbo_LinkModel.Items.Cast <ComboboxItem>().FindIndex(x => x.Text == field.JOIN_MODEL); cbo_LinkModel.SelectedIndex = k1; } txt_OrderByEdit.Text = field.ORDER_EDIT.ToString(); txt_OrderByView.Text = field.ORDER_VIEW.ToString(); cbo_FuncValidate.Text = field.FUNC_EDIT; List <string> list = new List <string>(); if (!string.IsNullOrEmpty(field.FUNC_EDIT)) { list = field.FUNC_EDIT.Split(',').ToList(); int ci = 0; foreach (var it in afunc) { if (list.IndexOf(it) != -1) { list_FuncValidate.SetItemCheckState(ci, CheckState.Checked); } ci++; } } cbo_FuncBeforeUpdate.Text = field.FUNC_BEFORE_UPDATE; List <string> listBU = new List <string>(); if (!string.IsNullOrEmpty(field.FUNC_EDIT)) { listBU = field.FUNC_BEFORE_UPDATE.Split(',').ToList(); int ci = 0; foreach (var it in afunc) { if (listBU.IndexOf(it) != -1) { list_FuncUpdate.SetItemCheckState(ci, CheckState.Checked); } ci++; } } txt_KeyUri.Text = field.ORDER_KEY_URL.ToString(); #endregion /////////////////////////////////////////////////////////////////////////////////////////////// }
public ucModelFieldAdd(int index, IDataFile db) { if (index != 0 && index % 2 == 0) { BackColor = Color.Gray; } string[] models = db.GetListDB(); #region [ === UI === ] ////////////////////////////////////////////////////////////////////// // LINE 1: txt_Name = new TextBoxCustom() { Left = 4, Top = _topLine1, Width = 80, Name = "name" + index.ToString(), WaterMark = "Name ...", BorderStyle = BorderStyle.FixedSingle, TextAlign = HorizontalAlignment.Center }; cbo_Type = new ComboBox() { Left = 88, Top = _topLine1, Width = 60, Name = "type" + index.ToString(), DropDownStyle = ComboBoxStyle.DropDownList, }; chk_Auto = new CheckBox() { Left = 164, Top = _topLine1, Width = 22, Name = "auto" + index.ToString() }; for (int k = 0; k < dbType.Types.Length; k++) { cbo_Type.Items.Add(dbType.Types[k]); } cbo_Type.SelectedIndex = 0; cbo_Kit = new ComboBox() { Left = 192, Top = _topLine1, Width = 80, Name = "kit" + index.ToString(), DropDownStyle = ComboBoxStyle.DropDownList, }; foreach (ControlKit kit in Kits) { cbo_Kit.Items.Add(new ComboboxItem() { Text = kit.ToString().ToUpper(), Value = ((int)kit) }); } cbo_Kit.SelectedIndex = 0; cbo_LinkType = new ComboBox() { Left = 276, Top = _topLine1, Width = 84, Name = "link_type" + index.ToString(), DropDownStyle = ComboBoxStyle.DropDownList }; foreach (JoinType ti in JoinTypes) { cbo_LinkType.Items.Add(new ComboboxItem() { Text = ti.ToString().ToUpper(), Value = ((int)ti) }); } cbo_LinkType.SelectedIndex = 0; txt_ValueDefault = new TextBoxCustom() { Left = 363, Top = _topLine1, Width = 307, Name = "value_default" + index.ToString(), WaterMark = "Default value: v1|v2|...", BorderStyle = BorderStyle.FixedSingle }; cbo_LinkModel = new ComboBox() { Visible = false, Left = 363, Top = _topLine1, Width = 100, Name = "link_model" + index.ToString(), DropDownStyle = ComboBoxStyle.DropDownList, }; cbo_LinkField = new ComboBox() { Visible = false, Left = 465, Top = _topLine1, Width = 100, Name = "link_field" + index.ToString(), DropDownStyle = ComboBoxStyle.DropDownList, }; cbo_LinkModel.Items.Add(new ComboboxItem() { Text = "", Value = "" }); for (int k = 0; k < models.Length; k++) { cbo_LinkModel.Items.Add(new ComboboxItem() { Text = models[k].ToUpper(), Value = models[k] }); } cbo_LinkModel.SelectedIndex = 0; cbo_LinkView = new ComboBox() { Visible = false, Left = 568, Top = _topLine1, Width = 100, Name = "link_view" + index.ToString(), DropDownStyle = ComboBoxStyle.DropDownList, }; chk_Index = new CheckBox() { Left = 684, Top = _topLine1, Width = 20, Name = "index" + index.ToString(), Checked = false }; chk_Null = new CheckBox() { Left = 720, Top = _topLine1, Width = 15, Name = "null" + index.ToString(), Checked = true }; ////////////////////////////////////////////////////////////////////// // LINE 2: txt_Caption = new ucTextBoxH(100) { Left = 4, Top = _topLine2, Name = "caption" + index.ToString(), Title = "Caption" }; txt_CaptionShort = new ucTextBoxH(100) { Left = 112, Top = _topLine2, Name = "caption_short" + index.ToString(), Title = "Caption short" }; txt_Des = new ucTextBoxH(130) { Left = 216, Top = _topLine2, Name = "des" + index.ToString(), Title = "Description" }; chk_MobiShow = new CheckBox() { Left = 358, Top = _topLine1 + 30, Name = "mobi" + index.ToString(), Text = "Show Mobi", Width = 80, Checked = true }; chk_TabletShow = new CheckBox() { Left = 440, Top = _topLine1 + 30, Name = "tablet" + index.ToString(), Text = "Show Tablet", Width = 90, Checked = true }; chk_Duplicate = new CheckBox() { Left = 530, Top = _topLine1 + 30, Name = "duplicate" + index.ToString(), Text = "Duplicate", Width = 75, Checked = true }; chk_Encrypt = new CheckBox() { Left = 607, Top = _topLine1 + 30, Name = "encrypt" + index.ToString(), Text = "Encrypt", Width = 66, Checked = false }; txt_FieldChange = new TextBox() { Visible = false, Name = "field_change" + index.ToString(), Text = ((int)dbFieldChange.ADD).ToString() }; btn_Ext = new Button() { Text = "+", Left = 744, Top = _topLine1, Width = 20, BackColor = SystemColors.Control }; btn_Remove = new Button() { Text = "Remove", Left = 704, Top = _topLine1 + 30, Width = 60, BackColor = SystemColors.Control }; btn_Remove.Click += (se, ev) => remove_Field(txt_FieldChange); btn_Ext.Click += (se, ev) => { if (btn_Ext.Text == "-") { btn_Ext.Text = "+"; this.Height = this.Height - hiBox; } else { btn_Ext.Text = "-"; this.Height = this.Height + hiBox; } }; ////////////////////////////////////////////////////////////////////// // LINE 3: txt_OrderByEdit = new ucTextBoxH(100) { Left = 4, Top = _topLine3, Name = "order_edit" + index.ToString(), Text = "99", Title = "Order on form", TextAlign = HorizontalAlignment.Center, OnlyInputNumber0To9 = true }; txt_OrderByView = new ucTextBoxH(100) { Left = 112, Top = _topLine3, Name = "order_view" + index.ToString(), Text = "99", Title = "Order on grid", TextAlign = HorizontalAlignment.Center, OnlyInputNumber0To9 = true }; //txt_Des = new TextBoxCustom() { Left = 216, Top = _top + 30, Width = 130, Name = "des" + index.ToString(), WaterMark = "Description ...", BorderStyle = BorderStyle.FixedSingle, TextAlign = HorizontalAlignment.Center }; ////////////////////////////////////////////////////////////////// cbo_FuncValidate = new CustomComboBox() { Left = 358, Top = _topLine3, Width = 300, Name = "func_edit" + index.ToString(), Text = dbFunc.title_FUNC_VALIDATE_ON_FORM, }; string[] afunc = dbFunc.GetFuncValidate(); int index_VALIDATE_EMPTY = afunc.FindIndex(x => x == dbFunc.VALIDATE_EMPTY); CheckedListBox list_FuncValidate = new CheckedListBox() { BorderStyle = BorderStyle.None, Width = 300, }; foreach (string fi in afunc) { list_FuncValidate.Items.Add(new ComboboxItem() { Text = fi, Value = fi }); } if (index_VALIDATE_EMPTY != -1) { list_FuncValidate.SetItemChecked(index_VALIDATE_EMPTY, true); cbo_FuncValidate.Text = dbFunc.VALIDATE_EMPTY; } cbo_FuncValidate.KeyPress += (se, ev) => { ev.Handled = true; }; cbo_FuncValidate.DropDownControl = list_FuncValidate; //cbo_FuncValidate.DropDownWidth = 200; cbo_FuncValidate.DropDown += (se, ev) => { }; cbo_FuncValidate.DropDownClosed += (se, ev) => { }; list_FuncValidate.ItemCheck += (se, ev) => { List <string> li = new List <string>(); foreach (var o in list_FuncValidate.CheckedItems) { li.Add(o.ToString()); } string it = afunc[ev.Index]; CheckState val = ev.NewValue; if (val == CheckState.Checked) { li.Add(it); } else { li.Remove(it); } if (li.Count > 2) { cbo_FuncValidate.Text = "(" + li.Count.ToString() + ") Func validate on form"; } else { cbo_FuncValidate.Text = string.Join(",", li.Distinct().ToArray()); } }; ////////////////////////////////////////////////////////////////////// // LINE 4 cbo_FuncBeforeUpdate = new CustomComboBox() { Left = 358, Top = _topLine4, Width = 300, Name = "func_before_update" + index.ToString(), Text = dbFunc.title_FUNC_BEFORE_ADD_OR_UPDATE, }; string[] afuncUpdate = dbFunc.GetFuncBeforeAddOrUpdate(); CheckedListBox list_FuncUpdate = new CheckedListBox() { BorderStyle = BorderStyle.None, Width = 300, }; foreach (string fi in afuncUpdate) { list_FuncUpdate.Items.Add(new ComboboxItem() { Text = fi, Value = fi }); } cbo_FuncBeforeUpdate.KeyPress += (se, ev) => { ev.Handled = true; }; cbo_FuncBeforeUpdate.DropDownControl = list_FuncUpdate; //cbo_FuncBeforeUpdate.DropDownWidth = 200; cbo_FuncBeforeUpdate.DropDown += (se, ev) => { }; cbo_FuncBeforeUpdate.DropDownClosed += (se, ev) => { }; list_FuncUpdate.ItemCheck += (se, ev) => { List <string> li = new List <string>(); foreach (var o in list_FuncUpdate.CheckedItems) { li.Add(o.ToString()); } string it = afuncUpdate[ev.Index]; CheckState val = ev.NewValue; if (val == CheckState.Checked) { li.Add(it); } else { li.Remove(it); } if (li.Count > 2) { list_FuncUpdate.Text = "(" + li.Count.ToString() + ") Func validate on form"; } else { cbo_FuncBeforeUpdate.Text = string.Join(",", li.Distinct().ToArray()); } }; txt_KeyUri = new ucTextBoxH(100) { Left = 4, Top = _topLine4, Name = "key_url" + index.ToString(), Title = "Position key url", TextAlign = HorizontalAlignment.Center, OnlyInputNumber0To9 = true }; ////////////////////////////////////////////////////////////////////// // LINE 5 chk_ShowInGrid = new CheckBox() { Text = "Show only query detail", Left = 4, Top = _topLine5, Name = "show_in_grid" + index.ToString(), Width = 150, }; chk_IsFullTextSearch = new CheckBox() { Text = "Is full text search", Left = 160, Top = _topLine5, Name = "full_text_search" + index.ToString(), Width = 120, }; chk_IsKeySync = new CheckBox() { Text = "Is key for sync or edit", Left = 320, Top = _topLine5, Name = "key_for_sync" + index.ToString(), Width = 150, }; ////////////////////////////////////////////////////////////////// this.Controls.AddRange(new Control[] { txt_Name, cbo_Type, chk_Auto, cbo_Kit, cbo_LinkType, txt_ValueDefault, cbo_LinkModel, cbo_LinkField, cbo_LinkView, chk_Index, chk_Null, btn_Ext, txt_Caption, txt_CaptionShort, txt_Des, chk_MobiShow, chk_TabletShow, chk_Duplicate, chk_Encrypt, txt_OrderByView, txt_OrderByEdit, cbo_FuncValidate, cbo_FuncBeforeUpdate, txt_KeyUri, btn_Remove, txt_FieldChange, chk_ShowInGrid, chk_IsFullTextSearch, chk_IsKeySync }); #endregion /////////////////////////////////////////////////////////////////////////////////////////////// #region [ === EVENT === ] cbo_LinkModel.Visible = false; cbo_LinkField.Visible = false; cbo_LinkView.Visible = false; int ijt = JoinTypes.FindIndex(x => x == JoinType.DEF_VALUE); cbo_LinkType.SelectedIndex = ijt; cbo_Type.SelectedIndexChanged += (se, ev) => { string type = dbType.Types[cbo_Type.SelectedIndex]; if (type == typeof(Boolean).Name) { chk_Auto.Checked = false; chk_Auto.Visible = false; int iKit = Kits.FindIndex(x => x == ControlKit.CHECK); cbo_Kit.SelectedIndex = iKit; cbo_Kit.Enabled = false; cbo_LinkType.Visible = false; //return; } else { chk_Auto.Visible = true; cbo_Kit.Enabled = true; cbo_Kit.SelectedIndex = 0; cbo_LinkType.Visible = true; //return; } if (type == typeof(DateTime).Name) { int iKit = Kits.FindIndex(x => x == ControlKit.TEXT_DATETIME); cbo_Kit.SelectedIndex = iKit; cbo_Kit.Enabled = false; //return; } else { cbo_Kit.Enabled = true; cbo_Kit.SelectedIndex = 0; //return; } }; cbo_Kit.SelectedIndexChanged += (se, ev) => kit_Change(); cbo_LinkType.SelectedIndexChanged += (se, ev) => { JoinType ji = JoinTypes[cbo_LinkType.SelectedIndex]; switch (ji) { case JoinType.NONE: cbo_LinkType.SelectedIndex = 1; break; case JoinType.DEF_VALUE: txt_ValueDefault.Visible = true; cbo_LinkModel.Visible = false; cbo_LinkField.Visible = false; cbo_LinkView.Visible = false; break; case JoinType.JOIN_MODEL: txt_ValueDefault.Visible = false; cbo_LinkModel.Visible = true; cbo_LinkField.Visible = true; cbo_LinkView.Visible = true; ControlKit kit = Kits[cbo_Kit.SelectedIndex]; if (kit != ControlKit.SELECT && kit != ControlKit.LOOKUP) { int _ix = Kits.FindIndex(x => x == ControlKit.SELECT); if (_ix != -1) { cbo_Kit.SelectedIndex = _ix; } } break; } }; cbo_LinkModel.SelectedIndexChanged += (se, ev) => { cbo_LinkField.Items.Clear(); cbo_LinkView.Items.Clear(); if (cbo_LinkModel.SelectedIndex > 0) { string m = models[cbo_LinkModel.SelectedIndex - 1]; if (!string.IsNullOrEmpty(m)) { var fs = db.GetFields(m).ToArray(); if (fs.Length > 0) { for (int k = 0; k < fs.Length; k++) { cbo_LinkField.Items.Add(new ComboboxItem() { Text = fs[k].NAME.ToUpper() + " - " + fs[k].Type.Name, Value = fs[k].NAME }); cbo_LinkView.Items.Add(new ComboboxItem() { Text = fs[k].NAME.ToUpper() + " - " + fs[k].Type.Name, Value = fs[k].NAME }); } cbo_LinkField.SelectedIndex = 0; cbo_LinkView.SelectedIndex = 0; } } } }; chk_Auto.CheckedChanged += (se, ev) => { kit_Change(); if (chk_Auto.Checked) { // FIELD KEY AUTO chk_Null.Checked = false; chk_Null.Visible = false; cbo_Kit.Visible = false; cbo_LinkType.Visible = false; txt_ValueDefault.Visible = false; cbo_LinkModel.Visible = false; cbo_LinkField.Visible = false; cbo_LinkView.Visible = false; } else { // FIELD DATA chk_Null.Visible = true; cbo_Kit.Visible = true; cbo_LinkType.Visible = true; txt_ValueDefault.Visible = true; } }; #endregion /////////////////////////////////////////////////////////////////////////////////////////////// }
public FormDataSplitConfig(IDataFile _db, string url, string content_ = "") : base("CONFIG", true) { db = _db; Domain = url.getDomainFromURL(); if (content_ != "") { Content = content_; } else { Content = url.getContentTextFromURL(); } ClientSize = new System.Drawing.Size(fWidth, fHeight); #region [ === UI === ] Panel main = new Panel() { BackColor = Color.WhiteSmoke, Dock = DockStyle.Fill, Padding = new Padding(10) }; Panel box_Domain = new Panel() { Height = 30, Dock = DockStyle.Top, Padding = new Padding(0, 5, 0, 5) }; Label lbl_Domain = new Label() { Width = 100, Dock = DockStyle.Left, Text = "Domain", TextAlign = ContentAlignment.MiddleRight, Padding = new Padding(0, 0, 10, 0) }; txt_Domain = new TextBoxCustom() { Text = url.getDomainFromURL(), Dock = DockStyle.Fill, BorderStyle = BorderStyle.FixedSingle }; box_Domain.Controls.AddRange(new Control[] { lbl_Domain, txt_Domain }); txt_Domain.BringToFront(); Panel box_URL = new Panel() { Height = 30, Dock = DockStyle.Top, Padding = new Padding(0, 5, 0, 5) }; Label lbl_URL = new Label() { Width = 100, Dock = DockStyle.Left, Text = "URL", TextAlign = ContentAlignment.MiddleRight, Padding = new Padding(0, 0, 10, 0) }; txt_URL = new TextBoxCustom() { Text = url, Dock = DockStyle.Fill, BorderStyle = BorderStyle.FixedSingle }; box_URL.Controls.AddRange(new Control[] { txt_URL, lbl_URL }); Panel box_Content = new Panel() { Height = 300, Dock = DockStyle.Fill, Padding = new Padding(0, 5, 0, 5) }; Label lbl_Content = new Label() { Width = 100, Dock = DockStyle.Left, Text = "Content", TextAlign = ContentAlignment.TopRight, Padding = new Padding(0, 0, 10, 0) }; txt_Content = new TextBoxCustom() { Text = Content, Tag = Content, Dock = DockStyle.Fill, Multiline = true, ScrollBars = ScrollBars.Both, WordWrap = true, BorderStyle = BorderStyle.FixedSingle }; box_Content.Controls.AddRange(new Control[] { txt_Content, lbl_Content }); Panel box_Text = new Panel() { Dock = DockStyle.Bottom, Height = 120 }; Panel box_TextFirst = new Panel() { Dock = DockStyle.Right, Width = fWidth / 2 - 200 }; txt_TextFirst = new ucDataSplitConfig("___ Text First ___", "Title") { Dock = DockStyle.Top, Height = 20 }; list_TextFirst = new ListBox() { Dock = DockStyle.Fill, BorderStyle = BorderStyle.FixedSingle, }; box_TextFirst.Controls.AddRange(new Control[] { list_TextFirst, txt_TextFirst }); Panel box_TextLast = new Panel() { Dock = DockStyle.Right, Width = fWidth / 2 - 200 }; txt_TextLast = new ucDataSplitConfig("___ Text Last ___", "Signature") { Dock = DockStyle.Top, Height = 20 }; list_TextLast = new ListBox() { Dock = DockStyle.Fill, BorderStyle = BorderStyle.FixedSingle, }; box_TextLast.Controls.AddRange(new Control[] { list_TextLast, txt_TextLast }); Button btn_TextFirst_Add = new Button() { Text = "Add Config", Dock = DockStyle.Right, Width = 50 }; Button btn_TextFirst_Remove = new Button() { Text = "Remove Config", Dock = DockStyle.Right, Width = 60 }; Button btn_TextTestConfig = new Button() { Text = "Test Config", Dock = DockStyle.Right, Width = 60 }; Button btn_TextResetContent = new Button() { Text = "Reset Content", Dock = DockStyle.Right, Width = 60 }; box_Text.Controls.AddRange(new Control[] { btn_TextTestConfig, new Label() { Dock = DockStyle.Right, AutoSize = false, Width = 10, Height = 40 }, btn_TextResetContent, new Label() { Dock = DockStyle.Right, AutoSize = false, Width = 10, Height = 40 }, box_TextFirst, new Label() { Dock = DockStyle.Right, AutoSize = false, Width = 10, Height = 40 }, box_TextLast, new Label() { Dock = DockStyle.Right, AutoSize = false, Width = 10, Height = 40 }, btn_TextFirst_Add, new Label() { Dock = DockStyle.Right, AutoSize = false, Width = 10, Height = 10 }, btn_TextFirst_Remove, }); Panel box_Footer = new Panel() { Height = 30, Dock = DockStyle.Bottom, Padding = new Padding(0, 10, 0, 0) }; Button btn_Submit = new Button() { Dock = DockStyle.Right, Text = "SUBMIT" }; box_Footer.Controls.AddRange(new Control[] { btn_Submit }); main.Controls.AddRange(new Control[] { box_Footer, box_Text, box_Content, box_URL, box_Domain }); this.Controls.Add(main); box_Footer.SendToBack(); box_Content.BringToFront(); this.PanelHeader_SendToBack(); #endregion list_TextFirst.Format += listBox_Format; list_TextLast.Format += listBox_Format; SearchResult rs = db.FindItemByContainFieldValue(new CNSPLIT() { SITE = Domain }, "SITE", 1000, 1); if (rs != null && rs.Status && rs.Total > 0) { var a = ((IList)rs.Message).Convert <CNSPLIT>(); var af = a.Select(x => x.SKIP_LINE_TOP.ToString() + " | " + x.TEXT_FIRST).ToArray(); var al = a.Select(x => x.SKIP_LINE_BOTTOM.ToString() + " | " + x.TEXT_LAST).ToArray(); var lks = a.AsQueryable().Select <long>(rs.FieldSyncEdit).Cast <long>().ToArray(); for (int i = 0; i < lks.Length; i++) { list_TextFirst.Items.Add(new ComboboxItem() { Text = af[i], Value = lks[i] }); list_TextLast.Items.Add(new ComboboxItem() { Text = al[i], Value = lks[i] }); } //list_TextFirst.Items.AddRange(af); //list_TextLast.Items.AddRange(al); } #region [ === EVENT === ] list_TextFirst.SelectedIndexChanged += (se, ev) => list_Split_Choose(list_TextFirst.SelectedIndex); list_TextLast.SelectedIndexChanged += (se, ev) => list_Split_Choose(list_TextLast.SelectedIndex); btn_TextFirst_Add.Click += (se, ev) => config_Add(); btn_TextFirst_Remove.Click += (se, ev) => config_Remove(); btn_TextResetContent.Click += (se, ev) => { txt_Content.Text = txt_Content.Tag as string; }; btn_TextTestConfig.Click += (se, ev) => config_Test(); btn_Submit.Click += (se, ev) => submit(); #endregion }
public FormELSearch(IDataFile _db) { db = _db; Control.CheckForIllegalCrossThreadCalls = false; ShowInTaskbar = false; btnChrome = new Button() { Text = "chrome", Top = 0, Left = 160, Width = 55, Height = 19, ForeColor = Color.Black, BackColor = SystemColors.Control, }; ///////////////////////////////////////////////////// // CUSTOM RESIZE HANDLE IN BORDER-LESS FORM this.DoubleBuffered = true; this.ResizeRedraw = true; ///////////////////////////////////////////////////// // FORM PROPERTIES this.TopMost = true; this.FormBorderStyle = FormBorderStyle.None; this.ClientSize = new Size(_form_Width, _form_Height); this.Padding = _form_Padding; this.BackColor = App.ColorBg; ///////////////////////////////////////////////////// // UI: MENU CONTEXT ContextMenu menuMain = new ContextMenu(build_menuItem()); ///////////////////////////////////////////////////// // UI: HEADER SEARCH Panel boxHeader = new Panel() { Left = 1, Top = 1, BackColor = _header_BgColor, Height = _header_Height }; txtSearch = new TextBoxCustom() { Left = 7, Top = 2, Height = _header_Height - 2, Multiline = true, ForeColor = Color.OrangeRed, BackColor = _header_BgColor, WaterMark = "Search ... ", BorderStyle = BorderStyle.None, }; boxHeader.Controls.AddRange(new Control[] { txtSearch }); ///////////////////////////////////////////////////// // UI: PANEL MAIN boxMain = new Panel() { Left = 1, Top = _header_Height + 2, Width = _form_Width - 2, Height = _form_Height - (_header_Height + 17 + 2 + 3), BackColor = _main_BgColor }; boxMain.MouseDown += FormMove_MouseDown; boxMain.ContextMenu = menuMain; boxMain.AllowDrop = true; boxMain.DragEnter += new DragEventHandler(boxMain_DragEnter); boxMain.DragDrop += new DragEventHandler(boxMain_DragDrop); ///////////////////////////////////////////////////// // FOOTER boxFooter = new Panel() { Dock = DockStyle.Bottom, Height = 17 }; boxFooter.MouseMove += FormMove_MouseDown; radWORD = new RadioButton() { Text = "Word", Top = 0, Left = 10, Width = 50, Height = 17, Checked = true, ForeColor = Color.White }; radGRAM = new RadioButton() { Text = "Gram", Top = 0, Left = 62, Width = 50, Height = 17, ForeColor = Color.White }; radDOC = new RadioButton() { Text = "Doc", Top = 0, Left = 114, Width = 44, Height = 17, ForeColor = Color.White }; btnChrome.Click += (se, ev) => chrome_Extract(); boxFooter.Controls.AddRange(new Control[] { radWORD, radGRAM, radDOC, btnChrome, }); ///////////////////////////////////////////////////// // EVENT this.Controls.AddRange(new Control[] { boxHeader, boxMain, boxFooter, }); this.Shown += (se, ve) => { this.Left = 0; this.Top = Screen.PrimaryScreen.WorkingArea.Height - _form_Height; boxHeader.Width = _form_Width - _resize_Width; boxHeader.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right; txtSearch.Width = _form_Width - txtSearch.Left; txtSearch.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right; boxMain.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right; }; txtSearch.KeyPress += (se, ev) => { }; }