public MainForm () { _checkedListBox = new CheckedListBox (); _checkedListBox.Dock = DockStyle.Top; _checkedListBox.Font = new Font (_checkedListBox.Font.FontFamily, _checkedListBox.Font.Height + 8); _checkedListBox.Height = 120; Controls.Add (_checkedListBox); // // _threeDCheckBox // _threeDCheckBox = new CheckBox (); _threeDCheckBox.Checked = _checkedListBox.ThreeDCheckBoxes; _threeDCheckBox.FlatStyle = FlatStyle.Flat; _threeDCheckBox.Location = new Point (8, 125); _threeDCheckBox.Text = "3D checkboxes"; _threeDCheckBox.CheckedChanged += new EventHandler (ThreeDCheckBox_CheckedChanged); Controls.Add (_threeDCheckBox); // // MainForm // ClientSize = new Size (300, 150); Location = new Point (250, 100); StartPosition = FormStartPosition.Manual; Text = "bug #82100"; Load += new EventHandler (MainForm_Load); }
public FrmCheckedListBox(CheckedListBox clb) { this.Clb = clb; InitializeComponent(); var locations = DgClient.CallSyncMethod("GetEmployeeDepartments", clb.EmployeeId); foreach (var location in (Dictionary<string, Dictionary<string, bool>>)locations) { lvMapping.Groups.Add(location.Key, location.Key); } foreach (var location in (Dictionary<string, Dictionary<string, bool>>)locations) { foreach (var department in location.Value) { var item = lvMapping.Items.Add(new ListViewItem() { Text = department.Key, Name = department.Key, Checked = department.Value }); item.Group = lvMapping.Groups[location.Key]; } } }
public Form1() { this.Width = 335; this.Height = 380; this.Text = "ConvertDB"; txtFileName = new TextBox { Location = new Point(10, 10), Size = new Size(270, 30), Text = "Please Input a target file name", }; btnMDBFile = new Button { Location = new Point(280, 10), Size = new Size(30, 20), Text = "...", }; clTables = new CheckedListBox { Location = new Point(10, 30), Size = new Size(300, 200), Text = "...", }; btnDBList = new Button { Location = new Point(10, 230), Size = new Size(30, 20), Text = "ls", }; txtPostgreSQL = new TextBox { Location = new Point(40, 230), Size = new Size(270, 30), Text = "Server=192.168.33.20;Port=5432;User Id=postgres;Password=vagrant;database=template1;", }; cboDatabaseList = new ComboBox { Location = new Point(10, 250), Size = new Size(300, 30), Text = "", }; btnConvert = new Button { Location = new Point(10, 270), Size = new Size(300, 50), Text = "execute", }; this.Controls.Add(txtFileName); this.Controls.Add(btnMDBFile); this.Controls.Add(clTables); this.Controls.Add(txtPostgreSQL); this.Controls.Add(btnDBList); this.Controls.Add(cboDatabaseList); this.Controls.Add(btnConvert); this.Load += new EventHandler(Form1_Load); btnMDBFile.Click += new EventHandler(btnMDBFile_Click); btnDBList.Click += new EventHandler(btnDBList_Click); btnConvert.Click += new EventHandler(btnConvert_Click); }
public MainForm () { _checkedListBox = new CheckedListBox (); _checkedListBox.Dock = DockStyle.Fill; _checkedListBox.HorizontalScrollbar = true; Controls.Add (_checkedListBox); // // MainForm // ClientSize = new Size (300, 150); Location = new Point (250, 100); StartPosition = FormStartPosition.Manual; Text = "bug #82097"; Load += new EventHandler (MainForm_Load); }
public Form1() { this.Width = 335; this.Height = 380; this.Text = "ConvertDB"; cboCategory = new ComboBox { Location = new Point(10, 10), Size = new Size(300, 30), }; cboCompany = new ComboBox { Location = new Point(10, 30), Size = new Size(300, 30), }; btnSelectView = new Button { Location = new Point(10, 50), Size = new Size(300, 30), Text = "ComboBoxの値で抽出", }; btnAllView = new Button { Location = new Point(10, 80), Size = new Size(300, 30), Text = "全て抽出", }; clTables = new CheckedListBox { Location = new Point(10, 110), Size = new Size(300, 200), Text = "...", }; this.Controls.Add(cboCategory); this.Controls.Add(cboCompany); this.Controls.Add(btnSelectView); this.Controls.Add(btnAllView); this.Controls.Add(clTables); this.Load += new EventHandler(Form1_Load); btnAllView.Click += new EventHandler(btnAllView_Click); btnSelectView.Click += new EventHandler(btnSelectView_Click); }
// Test the constructors public void TestCheckedCollections() { CheckedListBox clb = new CheckedListBox(); CheckedListBox.CheckedIndexCollection indexes = clb.CheckedIndices; CheckedListBox.CheckedItemCollection items = clb.CheckedItems; string item0 = "item 0"; string item1 = "item 1"; string item2 = "item 2"; string item3 = "item 3"; AssertEquals("Count (1)", 0, indexes.Count); AssertEquals("Count (2)", 0, items.Count); clb.Items.Add(item0, false); AssertEquals("Count (3)", 0, indexes.Count); AssertEquals("Count (4)", 0, items.Count); clb.Items.Add(item1, true); AssertEquals("Count (5)", 1, indexes.Count); AssertEquals("Count (6)", 1, items.Count); clb.Items.Add(item2, true); AssertEquals("Count (7)", 2, indexes.Count); AssertEquals("Count (8)", 2, items.Count); clb.Items.Add(item3, false); AssertEquals("Count (9)", 2, indexes.Count); AssertEquals("Count (10)", 2, items.Count); AssertEquals("Indexer (1)", 1, indexes[0]); AssertEquals("Indexer (2)", 2, indexes[1]); AssertEquals("Indexer (3)", item1, items[0]); AssertEquals("Indexer (4)", item2, items[1]); AssertEquals("Index of (1)", -1, items.IndexOf(item0)); AssertEquals("Index of (2)", 0, items.IndexOf(item1)); AssertEquals("Index of (3)", 1, items.IndexOf(item2)); AssertEquals("Index of (4)", -1, items.IndexOf(item3)); }
public ListBoxExam() { listBox1 = new ListBox(); checkedListBox1 = new CheckedListBox(); txt_info = new TextBox(); listBox1.Parent = this; listBox1.SetBounds(10, 10, 50, 100); listBox1.SelectedIndexChanged += new EventHandler(SelectedIndexChanged); checkedListBox1.Parent = this; checkedListBox1.SetBounds(70, 10, 50, 100); checkedListBox1.SelectedIndexChanged += new EventHandler(SelectedIndexChanged); txt_info.Parent = this; txt_info.SetBounds(10, 120, 300, 120); txt_info.Multiline = true; for (int i = 0; i < str1.Length; i++) listBox1.Items.Add(str1[i]); for (int j = 0; j < str2.Length; j++) checkedListBox1.Items.Add(str2[j]); }
public MainForm () { _panel = new Panel (); _panel.SuspendLayout (); SuspendLayout (); // // _splitterLeft // _splitterLeft = new Splitter (); _splitterLeft.BorderStyle = BorderStyle.Fixed3D; _splitterLeft.Location = new Point (184, 0); _splitterLeft.Size = new Size (3, 390); _splitterLeft.TabStop = false; // // _splitterRight // _splitterRight = new Splitter (); _splitterRight.BorderStyle = BorderStyle.Fixed3D; _splitterRight.Location = new Point (323, 0); _splitterRight.Size = new Size (3, 390); _splitterRight.TabStop = false; // // _propertyGrid // _propertyGrid = new PropertyGrid (); _propertyGrid.Dock = DockStyle.Left; _propertyGrid.SelectedObject = new Config (); _propertyGrid.Size = new Size (184, 390); // // _checkedListBox // _checkedListBox = new CheckedListBox (); _checkedListBox.Anchor = (((AnchorStyles.Top | AnchorStyles.Bottom) | AnchorStyles.Left) | AnchorStyles.Right); _checkedListBox.CheckOnClick = true; _checkedListBox.Size = new Size (136, 349); // // _setAllButton // _setAllButton = new Button (); _setAllButton.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left); _setAllButton.Location = new Point (72, 360); _setAllButton.Size = new Size (56, 24); _setAllButton.TabIndex = 10; _setAllButton.Text = "Set All"; // // _clearAllButton // _clearAllButton = new Button (); _clearAllButton.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left); _clearAllButton.Location = new Point(8, 360); _clearAllButton.Size = new Size(56, 24); _clearAllButton.TabIndex = 9; _clearAllButton.Text = "Clear All"; // // _panel // _panel.Controls.AddRange (new Control [] { _checkedListBox, _setAllButton, _clearAllButton }); _panel.Dock = DockStyle.Left; _panel.Location = new Point (187, 0); _panel.Size = new Size (136, 390); _panel.TabIndex = 11; // // _tabControl // _tabControl = new TabControl (); _tabControl.Dock = DockStyle.Fill; Controls.Add (_tabControl); // // _bugDescriptionText1 // _bugDescriptionText1 = new TextBox (); _bugDescriptionText1.Multiline = true; _bugDescriptionText1.Dock = DockStyle.Fill; _bugDescriptionText1.Text = string.Format (CultureInfo.InvariantCulture, "Expected result on start-up:{0}{0}" + "1. The CheckedListBox fills the width of the center panel.{0}{0}" + "2. The \"Clear All\" and \"Set All\" and buttons are displayed " + "at the bottom of the center panel in that order.", Environment.NewLine); // // _tabPage1 // _tabPage1 = new TabPage (); _tabPage1.Text = "#1"; _tabPage1.Controls.Add (_bugDescriptionText1); _tabControl.Controls.Add (_tabPage1); // // _bugDescriptionText2 // _bugDescriptionText2 = new TextBox (); _bugDescriptionText2.Multiline = true; _bugDescriptionText2.Dock = DockStyle.Fill; _bugDescriptionText2.Text = string.Format (CultureInfo.InvariantCulture, "Steps to execute:{0}{0}" + "1. Resize the height of the form from extremely small to very " + "large.{0}{0}" + "2. Repeat this several times.{0}{0}" + "Expected result:{0}{0}" + "1. The CheckedListBox continues to fill almost the full height of " + "the form, leaving room only for the two buttons.", Environment.NewLine); // // _tabPage2 // _tabPage2 = new TabPage (); _tabPage2.Text = "#2"; _tabPage2.Controls.Add (_bugDescriptionText2); _tabControl.Controls.Add (_tabPage2); // // MainForm // ClientSize = new Size (752, 390); Controls.Add (_splitterRight); Controls.Add (_panel); Controls.Add (_splitterLeft); Controls.Add (_propertyGrid); StartPosition = FormStartPosition.CenterScreen; Text = "bug #80394"; Load += new EventHandler (MainForm_Load); _panel.ResumeLayout (false); ResumeLayout (false); }
/// <summary> /// Extend this function to support reading new types of properties. /// </summary> /// <param name="aObject"></param> private void GetPropertyValueFromControl(Control aControl, PropertyInfo aInfo, T aObject) { if (aInfo.PropertyType == typeof(int)) { NumericUpDown ctrl = (NumericUpDown)aControl; aInfo.SetValue(aObject, (int)ctrl.Value); } else if (aInfo.PropertyType == typeof(float)) { NumericUpDown ctrl = (NumericUpDown)aControl; aInfo.SetValue(aObject, (float)ctrl.Value); } else if (aInfo.PropertyType.IsEnum) { // Instantiate our enum object enumValue = Activator.CreateInstance(aInfo.PropertyType); // Parse our enum from combo box enumValue = Enum.Parse(aInfo.PropertyType, ((ComboBox)aControl).SelectedItem.ToString()); //enumValue = ((ComboBox)aControl).SelectedValue; // Set enum value aInfo.SetValue(aObject, enumValue); } else if (aInfo.PropertyType == typeof(bool)) { CheckBox ctrl = (CheckBox)aControl; aInfo.SetValue(aObject, ctrl.Checked); } else if (aInfo.PropertyType == typeof(string)) { TextBox ctrl = (TextBox)aControl; aInfo.SetValue(aObject, ctrl.Text); } else if (aInfo.PropertyType == typeof(PropertyFile)) { Button ctrl = (Button)aControl; PropertyFile value = new PropertyFile { FullPath = ctrl.Text }; aInfo.SetValue(aObject, value); } else if (aInfo.PropertyType == typeof(PropertyComboBox)) { ComboBox ctrl = (ComboBox)aControl; if (ctrl.SelectedItem != null) { string currentItem = ctrl.SelectedItem.ToString(); PropertyComboBox value = (PropertyComboBox)aInfo.GetValue(aObject); value.CurrentItem = currentItem; //Not strictly needed but makes sure the set method is called aInfo.SetValue(aObject, value); // aObject.OnPropertyChanged(aInfo.Name); } } else if (aInfo.PropertyType == typeof(PropertyButton)) { Button ctrl = (Button)aControl; PropertyButton value = new PropertyButton { Text = ctrl.Text }; aInfo.SetValue(aObject, value); } else if (aInfo.PropertyType == typeof(PropertyCheckedListBox)) { CheckedListBox ctrl = (CheckedListBox)aControl; PropertyCheckedListBox value = (PropertyCheckedListBox)aInfo.GetValue(aObject); List <string> checkedItems = new List <string>(); foreach (string item in ctrl.CheckedItems) { checkedItems.Add(item); } value.CheckedItems = checkedItems; //value.CurrentItem = currentItem; //Not strictly needed but makes sure the set method is called aInfo.SetValue(aObject, value); // //aObject.OnPropertyChanged(aInfo.Name); } //TODO: add support for other types here }
/// <summary> /// Инициализация, размещения собственных элементов управления /// </summary> private void initializeComponent() { Control ctrl = null; SplitContainer stctrSignals; //Приостановить прорисовку текущей панели // ??? корректней приостановить прорисовку после создания всех дочерних элементов // ??? при этом потребуется объявить переменные для каждого из элементов управления this.SuspendLayout(); //Создать дочерние элементы управления // календарь для установки текущих даты, номера часа ctrl = new DateTimePicker(); ctrl.Name = KEY_CONTROLS.DTP_CUR_DATE.ToString(); ctrl.Dock = DockStyle.Fill; (ctrl as DateTimePicker).DropDownAlign = LeftRightAlignment.Right; (ctrl as DateTimePicker).Format = DateTimePickerFormat.Custom; (ctrl as DateTimePicker).CustomFormat = "dd MMM, yyyy"; (ctrl as DateTimePicker).Value = DateTime.Now.Date.AddDays(-1); //Добавить к текущей панели календарь this.Controls.Add(ctrl, 0, 0); this.SetColumnSpan(ctrl, 3); this.SetRowSpan(ctrl, 1); // Обработчики событий (ctrl as DateTimePicker).ValueChanged += new EventHandler(curDatetime_OnValueChanged); // список для выбора ТЭЦ ctrl = new ComboBox(); ctrl.Name = KEY_CONTROLS.CBX_TEC_LIST.ToString(); ctrl.Dock = DockStyle.Fill; (ctrl as ComboBox).DropDownStyle = ComboBoxStyle.DropDownList; //Добавить к текущей панели список выбра ТЭЦ this.Controls.Add(ctrl, 3, 0); this.SetColumnSpan(ctrl, 3); this.SetRowSpan(ctrl, 1); // Обработчики событий (ctrl as ComboBox).SelectedIndexChanged += new EventHandler(cbxTECList_OnSelectionIndexChanged); // список для часовых поясов ctrl = new ComboBox(); ctrl.Name = KEY_CONTROLS.CBX_TIMEZONE.ToString(); ctrl.Dock = DockStyle.Fill; (ctrl as ComboBox).DropDownStyle = ComboBoxStyle.DropDownList; ctrl.Enabled = false; //Добавить к текущей панели список для часовых поясов this.Controls.Add(ctrl, 0, 1); this.SetColumnSpan(ctrl, 3); this.SetRowSpan(ctrl, 1); //// Обработчики событий (ctrl as ComboBox).SelectedIndexChanged += new EventHandler(cbxTimezone_OnSelectedIndexChanged); // кнопка для инициирования экспорта ctrl = new Button(); ctrl.Name = KEY_CONTROLS.BTN_EXPORT.ToString(); ctrl.Dock = DockStyle.Fill; ctrl.Text = @"Экспорт"; //Добавить к текущей панели кнопку "Экспорт" this.Controls.Add(ctrl, 3, 1); this.SetColumnSpan(ctrl, 3); this.SetRowSpan(ctrl, 1); // Обработчики событий (ctrl as Button).Click += new EventHandler(btnExport_OnClick); // панель для управления размером списков с сигналами stctrSignals = new SplitContainer(); stctrSignals.Dock = DockStyle.Fill; stctrSignals.Orientation = Orientation.Horizontal; //stctrSignals.Panel1MinSize = -1; //stctrSignals.Panel2MinSize = -1; stctrSignals.SplitterDistance = 46; //Добавить сплитер на панель управления this.Controls.Add(stctrSignals, 0, 2); this.SetColumnSpan(stctrSignals, 6); this.SetRowSpan(stctrSignals, 22); // список сигналов АИИСКУЭ ctrl = new CheckedListBox(); ctrl.Name = KEY_CONTROLS.CLB_AIISKUE_SIGNAL.ToString(); ctrl.Dock = DockStyle.Fill; ////Добавить к текущей панели список сигналов АИИСКУЭ //this.Controls.Add(ctrl, 0, 2); //this.SetColumnSpan(ctrl, 6); //this.SetRowSpan(ctrl, 10); //Добавить с сплиттеру stctrSignals.Panel1.Controls.Add(ctrl); // Обработчики событий (ctrl as CheckedListBox).SelectedIndexChanged += new EventHandler(clbAIISKUESignal_OnSelectedIndexChanged); (ctrl as CheckedListBox).ItemCheck += new ItemCheckEventHandler(clbAIISKUESignal_OnItemChecked); // список сигналов СОТИАССО ctrl = new CheckedListBox(); ctrl.Name = KEY_CONTROLS.CLB_SOTIASSO_SIGNAL.ToString(); ctrl.Dock = DockStyle.Fill; ////Добавить к текущей панели список сигналов СОТИАССО //this.Controls.Add(ctrl, 0, 12); //this.SetColumnSpan(ctrl, 6); //this.SetRowSpan(ctrl, 12); //Добавить с сплиттеру stctrSignals.Panel2.Controls.Add(ctrl); // Обработчики событий (ctrl as CheckedListBox).SelectedIndexChanged += new EventHandler(clbSOTIASSOSignal_OnSelectedIndexChanged); (ctrl as CheckedListBox).ItemCheck += new ItemCheckEventHandler(clbSOTIASSOSignal_OnItemChecked); //Возобновить прорисовку текущей панели this.ResumeLayout(false); //Принудительное применение логики макета this.PerformLayout(); }
private void button1_Click(object sender, EventArgs e) { this.Controls.Clear(); Label lab = new Label(); lab.Location = new Point(15, 13); lab.Text = "AsMa2 L files -->"; this.Controls.Add(lab); for (int i = 0; i < h; i++) { buttonArray1[i] = new TextBox(); buttonArray1[i].Location = new Point((40 + (i * 120)), 40); buttonArray1[i].Text = buttonArray[i].Text; this.Controls.Add(buttonArray1[i]); } table_attribute = new CheckedListBox(); int y = 0; // index of tat array which contain the attributes of all tables int q = 0; // index of tat array which contain the repetition attributes of all tables for (int i = 0; i < h; i++) { DataSet readXML = new DataSet(); readXML.ReadXml(buttonArray[i].Text); z = 0; foreach (DataTable table in readXML.Tables) { table_attribute.Location = new Point(300, 250); table_attribute.Size = new Size(300, 100); table_attribute.Name = "table_attribute"; foreach (DataColumn column in table.Columns) { bool is_there = false; for (int a = 0; a < All_Xml_Files_Attribues.Length; a++) { if (All_Xml_Files_Attribues[a] == column.ColumnName) { is_there = true; Repetition_Atrributes[q] = column.ColumnName; q++; break; } else { is_there = false; } } if (is_there == false) { All_Xml_Files_Attribues[y] = column.ColumnName; y++; } table_attribute.Items.Add(column.ColumnName); z++; jj++; } this.Controls.Add(table_attribute); } arr[i] = z; } table_attribute.Click += new EventHandler(table_attribute_click); Button btn = new Button(); btn = new Button(); btn.Location = new Point(604, 259); btn.Text = "Join..!"; btn.Name = "btn"; btn.Click += new EventHandler(buttonclick); this.Controls.Add(btn); }
/// <summary> /// Overrides the method used to provide basic behaviour for selecting editor. /// Shows our custom control for editing the value. /// </summary> /// <param name = "context">The context of the editing control</param> /// <param name = "provider">A valid service provider</param> /// <param name = "value">The current value of the object to edit</param> /// <returns>The new value of the object</returns> public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context != null && context.Instance != null && provider != null) { edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { // Create a CheckedListBox and populate it with all the enum values clb = new CheckedListBox(); clb.BorderStyle = BorderStyle.FixedSingle; clb.CheckOnClick = true; clb.MouseDown += OnMouseDown; clb.MouseMove += OnMouseMoved; tooltipControl = new ToolTip(); tooltipControl.ShowAlways = true; foreach (string name in Enum.GetNames(context.PropertyDescriptor.PropertyType)) { // Get the enum value object enumVal = Enum.Parse(context.PropertyDescriptor.PropertyType, name); // Get the int value int intVal = (int)Convert.ChangeType(enumVal, typeof(int)); // Get the description attribute for this field FieldInfo fi = context.PropertyDescriptor.PropertyType.GetField(name); DescriptionAttribute[] attrs = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false); // Store the the description string tooltip = attrs.Length > 0 ? attrs[0].Description : string.Empty; // Get the int value of the current enum value (the one being edited) int intEdited = (int)Convert.ChangeType(value, typeof(int)); // Creates a clbItem that stores the name, the int value and the tooltip clbItem item = new clbItem(enumVal.ToString(), intVal, tooltip); // Get the checkstate from the value being edited //bool checkedItem = (intEdited & intVal) > 0; bool checkedItem = (intEdited & intVal) == intVal; // Add the item with the right check state clb.Items.Add(item, checkedItem); } // Show our CheckedListbox as a DropDownControl. // This methods returns only when the dropdowncontrol is closed edSvc.DropDownControl(clb); // Get the sum of all checked flags int result = 0; foreach (clbItem obj in clb.CheckedItems) { //result += obj.Value; result |= obj.Value; } // return the right enum value corresponding to the result return(Enum.ToObject(context.PropertyDescriptor.PropertyType, result)); } } return(value); }
public void CheckedListBox_Constructor() { using var box = new CheckedListBox(); Assert.NotNull(box); }
private async void btnAddGroup_Click(object sender, EventArgs e) { Form formAddGroup = new Form(); TextBox textBoxNumberGroup = new TextBox(); TextBox textBoxFaculty = new TextBox(); TextBox textBoxCourse = new TextBox(); CheckedListBox checkedListBoxDiscipline = new CheckedListBox(); Label labelHeaderText = new Label(); Label labelNumberGroup = new Label(); Label labelFaculty = new Label(); Label labelCourse = new Label(); Label labelDiscipline = new Label(); await Task.Factory.StartNew(() => { InvokeUI(() => { //блок кода, для работы с формой formAddGroup.Width = 600; formAddGroup.Height = 600; formAddGroup.BackColor = Color.FromArgb(57, 230, 57); formAddGroup.Text = "Добавить группу"; //блок формы для работы с текстБоксами textBoxNumberGroup.Location = new Point(300, 100); textBoxNumberGroup.Size = new Size(200, 50); textBoxNumberGroup.Font = new Font("Tobota", 16, FontStyle.Italic); formAddGroup.Controls.Add(textBoxNumberGroup); textBoxFaculty.Location = new Point(300, 200); textBoxFaculty.Size = new Size(200, 50); textBoxFaculty.Font = new Font("Tobota", 16, FontStyle.Italic); formAddGroup.Controls.Add(textBoxFaculty); textBoxCourse.Location = new Point(300, 300); textBoxCourse.Size = new Size(200, 50); textBoxCourse.Font = new Font("Tobota", 16, FontStyle.Italic); formAddGroup.Controls.Add(textBoxCourse); checkedListBoxDiscipline.Location = new Point(250, 370); checkedListBoxDiscipline.Size = new Size(250, 100); checkedListBoxDiscipline.Font = new Font("Microsoft Sans Serif", 12, FontStyle.Italic); foreach (var item in reposDiscipline.GetAll().AsParallel()) { checkedListBoxDiscipline.Items.Add(item.Name); } formAddGroup.Controls.Add(checkedListBoxDiscipline); //блок формы для работы с лэйблами labelHeaderText.Location = new Point(200, 0); labelHeaderText.Font = new Font("Microsoft Sans Serif", 15, FontStyle.Bold); labelHeaderText.Size = new Size(250, 50); labelHeaderText.Text = "Введите данные:"; labelNumberGroup.Location = new Point(50, 100); labelNumberGroup.Font = new Font("Microsoft Sans Serif", 10, FontStyle.Bold); labelNumberGroup.Size = new Size(200, 50); labelNumberGroup.Text = "Номер группы: "; labelFaculty.Location = new Point(50, 200); labelFaculty.Font = new Font("Microsoft Sans Serif", 10, FontStyle.Bold); labelFaculty.Size = new Size(200, 50); labelFaculty.Text = "Факультет: "; labelCourse.Location = new Point(50, 300); labelCourse.Font = new Font("Microsoft Sans Serif", 10, FontStyle.Bold); labelCourse.Size = new Size(200, 50); labelCourse.Text = "Курс: "; labelDiscipline.Location = new Point(50, 400); labelDiscipline.Font = new Font("Microsoft Sans Serif", 10, FontStyle.Bold); labelDiscipline.Size = new Size(200, 50); labelDiscipline.Text = "Список\nдисциплин: "; //Блок кода, работающий с кнопками Button btnAddGroupForFormAddGroup = new Button { Location = new Point(200, 500), Font = new Font("Microsoft Sans Serif", 10, FontStyle.Bold), Size = new Size(200, 50), Text = "Добавить группу" }; btnAddGroupForFormAddGroup.MouseClick += (send, args) => { OnBtnAddGroupForFormAddGroup?.Invoke(sender, EventArgs.Empty); }; // Кнопка в окне добавления группы OnBtnAddGroupForFormAddGroup += (send, args) => { try { List <string> listDis = new List <string>(); var reposGroup = RepositoryFactory <Group> .Create(); foreach (var item in checkedListBoxDiscipline.CheckedItems.AsParallel()) { listDis.Add(item.ToString()); } reposGroup.Add(new Group(listDis, textBoxNumberGroup.Text, Convert.ToInt32(textBoxCourse.Text), textBoxFaculty.Text)); MessageBox.Show("Группа успешно добавленна!"); formAddGroup.Close(); } catch { MessageBox.Show("Произошла ошибка во время добавления группы,\nПроверьте введенные данные!"); } }; formAddGroup.Controls.Add(btnAddGroupForFormAddGroup); formAddGroup.Controls.Add(labelHeaderText); formAddGroup.Controls.Add(labelNumberGroup); formAddGroup.Controls.Add(labelFaculty); formAddGroup.Controls.Add(labelCourse); formAddGroup.Controls.Add(labelDiscipline); }); }); formAddGroup.Show(); }
public FlagsEditor() : base() { flagListBox = new CheckedListBox(); }
private void InitializeComponent() { this.panel1 = new Panel(); this.label1 = new Label(); this.chkList = new CheckedListBox(); this.btn_OK = new Button(); this.btn_Close = new Button(); this.chkAll = new CheckBox(); this.panel1.SuspendLayout(); base.SuspendLayout(); this.panel1.Controls.Add(this.label1); this.panel1.Dock = DockStyle.Top; this.panel1.Location = new Point(0, 0); this.panel1.Name = "panel1"; this.panel1.Size = new Size(400, 0x23); this.panel1.TabIndex = 1; this.label1.AutoSize = true; this.label1.Font = new Font("宋体", 11f, FontStyle.Bold, GraphicsUnit.Point, 0x86); this.label1.Location = new Point(12, 9); this.label1.Name = "label1"; this.label1.Size = new Size(0x37, 15); this.label1.TabIndex = 0; this.label1.Text = "请勾选"; this.chkList.ColumnWidth = 2; this.chkList.Dock = DockStyle.Top; this.chkList.FormattingEnabled = true; this.chkList.HorizontalScrollbar = true; this.chkList.Location = new Point(0, 0x23); this.chkList.Name = "chkList"; this.chkList.ScrollAlwaysVisible = true; this.chkList.Size = new Size(400, 0xc4); this.chkList.TabIndex = 2; this.chkList.DoubleClick += new EventHandler(this.chkList_DoubleClick); this.chkList.Click += new EventHandler(this.chkList_Click); this.btn_OK.Location = new Point(0x62, 0xed); this.btn_OK.Name = "btn_OK"; this.btn_OK.Size = new Size(0x4b, 0x17); this.btn_OK.TabIndex = 3; this.btn_OK.Text = "确定"; this.btn_OK.UseVisualStyleBackColor = true; this.btn_OK.Click += new EventHandler(this.btn_OK_Click); this.btn_Close.Location = new Point(200, 0xed); this.btn_Close.Name = "btn_Close"; this.btn_Close.Size = new Size(0x4b, 0x17); this.btn_Close.TabIndex = 4; this.btn_Close.Text = "取消"; this.btn_Close.UseVisualStyleBackColor = true; this.btn_Close.Click += new EventHandler(this.btn_Close_Click); this.chkAll.AutoSize = true; this.chkAll.Location = new Point(8, 240); this.chkAll.Name = "chkAll"; this.chkAll.Size = new Size(0x30, 0x10); this.chkAll.TabIndex = 5; this.chkAll.Text = "全选"; this.chkAll.UseVisualStyleBackColor = true; this.chkAll.CheckedChanged += new EventHandler(this.chkAll_CheckedChanged); base.AutoScaleDimensions = new SizeF(6f, 12f); base.ClientSize = new Size(400, 0x108); base.Controls.Add(this.chkAll); base.Controls.Add(this.btn_Close); base.Controls.Add(this.btn_OK); base.Controls.Add(this.chkList); base.Controls.Add(this.panel1); base.MinimizeBox = false; base.Name = "frmSelItemList"; base.ShowIcon = false; base.ShowInTaskbar = false; this.Text = "多选项目"; base.Load += new EventHandler(this.frmSelItemList_Load); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); base.ResumeLayout(false); base.PerformLayout(); }
public static void crearRol(string nombreRol, int estado, CheckedListBox funcionalidades) { }
public static void modificarRol(string nombreRol, Int32 estado, CheckedListBox funcionalidades) { }
public static void getFuncRol(string nombreRol, CheckedListBox funcionalidades) { }
public static void fillCheckBoxList(CheckedListBox cmb, string englishName, int defaultItemId) { BasicInfoEntity entity = _basicInfoBL.getByEnglishName(englishName); fillCheckBoxList(cmb, int.Parse(entity.get(BasicInfoEntity.FIELD_ID).ToString()), defaultItemId); }
public static void fillCheckBoxList(CheckedListBox cmb, int parentId, int defaultItemId) { BasicInfoEntity parentEntity = _basicInfoBL.get(parentId); Boolean containsUnknown = false; string c = parentEntity.get(BasicInfoEntity.FIELD_CONTAINUNKNOWN).ToString(); if (c != null && c.Trim().Length > 0) { containsUnknown = Boolean.Parse(c); } BasicInfoEntity entity = _basicInfoBL.getByParentId(parentId); var dataSource = new List <ComboBoxItem>(); try { cmb.Items.Clear(); } catch (Exception ex) { } if (containsUnknown == true) { AddUnKnown(dataSource); } for (int i = 0; i < entity.Tables[entity.FilledTableName].Rows.Count; i++) { string id = entity.Tables[entity.FilledTableName].Rows[i][BasicInfoEntity.FIELD_ID].ToString(); string desc = entity.Tables[entity.FilledTableName].Rows[i][BasicInfoEntity.FIELD_DESCRIPTION].ToString(); string customData = ""; if (entity.Tables[entity.FilledTableName].Rows[i][BasicInfoEntity.FIELD_CUSTOMFIELD] != null) { customData = entity.Tables[entity.FilledTableName].Rows[i][BasicInfoEntity.FIELD_CUSTOMFIELD].ToString(); } dataSource.Add(new ComboBoxItem(desc, id, customData)); } // is inActive? or not BasicInfoEntity niEntity = _basicInfoBL.get(defaultItemId); if (niEntity.Tables[niEntity.FilledTableName].Rows.Count > 0) { bool isActive = bool.Parse(niEntity.Tables[niEntity.FilledTableName].Rows[0][BasicInfoEntity.FIELD_ACTIVE].ToString());; if (isActive == false) { string id = niEntity.Tables[niEntity.FilledTableName].Rows[0][BasicInfoEntity.FIELD_ID].ToString(); string desc = niEntity.Tables[niEntity.FilledTableName].Rows[0][BasicInfoEntity.FIELD_DESCRIPTION].ToString(); string customData = ""; if (niEntity.Tables[niEntity.FilledTableName].Rows[0][BasicInfoEntity.FIELD_CUSTOMFIELD] != null) { customData = niEntity.Tables[entity.FilledTableName].Rows[0][BasicInfoEntity.FIELD_CUSTOMFIELD].ToString(); } dataSource.Add(new ComboBoxItem(desc, id, customData)); } } cmb.DataSource = dataSource; cmb.DisplayMember = "Text"; cmb.ValueMember = "Value"; for (int i = 0; i < cmb.Items.Count; i++) { if (((ComboBoxItem)cmb.Items[i]).Value.Equals(defaultItemId.ToString())) { cmb.SelectedIndex = i; break; } } }
public MainDialog() { leftPadCol1 = 11; leftPadCol2 = 181; leftPadCol3 = 311; Text="Mouse"; StartPosition = FormStartPosition.Manual; Location = new Point(100, 100); Size = new Size(600, 400); Closed += new EventHandler(MainDialog_Closed); //left column m_LB = new ListBox(); m_LB.Items.Clear(); m_LB.IntegralHeight = false; m_LB.Location = new Point(leftPadCol1, 10); m_LB.Size = new Size(160, 190); m_LB.Items.AddRange(new object[]{"Red", "Orange", "Yellow", "Green", "Blue", "Indigo", "Violet"}); m_LB.SelectionMode = SelectionMode.One; m_LB.SetSelected(1, true); m_LB.SelectedIndexChanged += new EventHandler(LB_SelIndChanged); Controls.Add(m_LB); m_B_Create = new Button(); m_B_Create.Text = "Create"; m_B_Create.Location = new Point(5, 20); m_B_Create.Size = new Size(100, 24); m_B_Create.FlatStyle = System.Windows.Forms.FlatStyle.Popup; m_B_Create.Click += new System.EventHandler(B_C_Create); m_B_Create.BackColor = Color.Green; Controls.Add(m_B_Create); m_B_Edit = new Button(); m_B_Edit.Text = "Edit"; m_B_Edit.Location = new Point(5, 50); m_B_Edit.Size = new Size(100, 24); m_B_Edit.FlatStyle = System.Windows.Forms.FlatStyle.Popup; m_B_Edit.Click += new System.EventHandler(B_C_Edit); m_B_Edit.BackColor = Color.Blue; Controls.Add(m_B_Edit); m_B_Delete = new Button(); m_B_Delete.Text = "Delete"; m_B_Delete.Location = new Point(5, 80); m_B_Delete.Size = new Size(100, 24); m_B_Delete.FlatStyle = System.Windows.Forms.FlatStyle.Popup; m_B_Delete.Click += new System.EventHandler(B_C_Delete); m_B_Delete.BackColor = Color.Red; Controls.Add(m_B_Delete); m_GB_Button = new GroupBox(); m_GB_Button.Text = "Edit list"; m_GB_Button.Location = new Point(leftPadCol1, 211); m_GB_Button.Size = new Size(110, 110); m_GB_Button.Controls.AddRange(new Control[] {m_B_Create, m_B_Edit, m_B_Delete}); Controls.Add(m_GB_Button); //middle column m_LabelName = new Label(); m_LabelName.Text = "Name"; m_LabelName.Name = "LabelName"; m_LabelName.Location = new Point(leftPadCol2, 10); m_LabelName.Size = new Size(120, 16); m_LabelName.TextAlign = ContentAlignment.MiddleLeft; m_LabelName.Font = new Font("Arial", 10F, FontStyle.Italic | FontStyle.Bold); m_LabelName.ForeColor = Color.FromArgb(0, 0, 0); Controls.Add(m_LabelName); m_LabelColor = new Label(); m_LabelColor.Text = "Color"; m_LabelColor.Name = "LabelColor"; m_LabelColor.Location = new Point(leftPadCol2, 40); m_LabelColor.Size = new Size(120, 16); m_LabelColor.TextAlign = ContentAlignment.MiddleLeft; m_LabelColor.Font = new Font("Arial", 10F, FontStyle.Italic | FontStyle.Bold); m_LabelColor.ForeColor = Color.FromArgb(0, 0, 0); Controls.Add(m_LabelColor); m_LabelSite = new Label(); m_LabelSite.Text = "Web Site"; m_LabelSite.Name = "LabelSite"; m_LabelSite.Location = new Point(leftPadCol2, 130); m_LabelSite.Size = new Size(120, 16); m_LabelSite.TextAlign = ContentAlignment.MiddleLeft; m_LabelSite.Font = new Font("Arial", 10F, FontStyle.Italic | FontStyle.Bold); m_LabelSite.ForeColor = Color.FromArgb(0, 0, 0); Controls.Add(m_LabelSite); //right column m_TBName = new TextBox(); m_TBName.Text = ""; m_TBName.Location = new Point(leftPadCol3, 10); m_TBName.Size = new Size(120, 16); m_TBName.Multiline = false; m_TBName.MaxLength = 1000; m_TBName.ScrollBars = ScrollBars.Both; m_TBName.WordWrap = false; m_TBName.TextChanged += new EventHandler(TB_TextChanged); Controls.Add(m_TBName); m_RB_Red = new RadioButton(); m_RB_Red.Text = "Red"; m_RB_Red.Checked = false; m_RB_Red.Location = new Point(16, 16); m_RB_Red.Size = new Size(80, 20); m_RB_Red.Click += new System.EventHandler(RB_Click); m_RB_Red.Click += new System.EventHandler(RB_Click_Mes); m_RB_Green = new RadioButton(); m_RB_Green.Text = "Green"; m_RB_Green.Checked = true; m_RB_Green.Location = new Point(16, 36); m_RB_Green.Size = new Size(80, 20); m_RB_Green.Click += new System.EventHandler(RB_Click); m_RB_Blue = new RadioButton(); m_RB_Blue.Text = "Blue"; m_RB_Blue.Checked = false; m_RB_Blue.Location = new Point(16, 56); m_RB_Blue.Size = new Size(80, 20); m_RB_Blue.Click += new System.EventHandler(RB_Click); m_GB_Color = new GroupBox(); m_GB_Color.Text = "Choose color"; m_GB_Color.Location = new Point(leftPadCol3, 40); m_GB_Color.Size = new Size(120, 80); m_GB_Color.Controls.AddRange(new Control[] {m_RB_Red, m_RB_Green, m_RB_Blue}); Controls.Add(m_GB_Color); m_LLabel = new LinkLabel(); m_LLabel.Name = "Label2"; m_LLabel.Text = "www.logitec.com"; //m_LLabel.Text = "text.txt"; m_LLabel.Location = new Point(leftPadCol3, 130); m_LLabel.Size = new Size(120, 16); m_LLabel.TextAlign = ContentAlignment.MiddleLeft; m_LLabel.LinkClicked += new LinkLabelLinkClickedEventHandler(L2_LClicked); Controls.Add(m_LLabel); m_TT = new ToolTip(); m_TT.AutomaticDelay = 300; m_TT.ShowAlways = true; m_TT.SetToolTip(m_B_Create, "pressing the button will display message box"); m_CLB = new CheckedListBox(); m_CLB.Items.Clear(); m_CLB.IntegralHeight = false; m_CLB.Location = new Point(310, 310); m_CLB.Size = new Size(160, 90); m_CLB.Items.AddRange(new object[]{"Red", "Orange", "Yellow", "Green", "Blue", "Indigo", "Violet"}); m_CLB.SelectionMode = SelectionMode.One; m_CLB.SetSelected(1, true); m_CLB.CheckOnClick = true; m_CLB.SelectedIndexChanged += new EventHandler(CLB_SelIndChanged); Controls.Add(m_CLB); // Создаем экземпляр класса XmlDocument xmlDoc = new XmlDocument(); // Загружаем XML-документ из файла xmlDoc.Load("db.xml"); // Загружаем XML-документ из строки // xmlDoc.LoadXML(s1); // Получаем всех детей корневого элемента // xmlDoc.DocumentElement - корневой элемент foreach (XmlNode table in xmlDoc.DocumentElement.ChildNodes) { // перебираем все атрибуты элемента foreach (XmlAttribute attr in table.Attributes) { // attr.Name - имя текущего атрибута // attr.Value - значение текущего атрибута m_LB.Items.Add(attr.Name + ":" + attr.Value); } // перебираем всех детей текущего узла foreach (XmlNode ch in table.ChildNodes) { } // Получаем текст хранящийся в текущем узле //MessageBox.Show(s); } }
private void LoadSettings() { SkillTab tab = null; this.SkillSettingsBody.TabPages.RemoveAt(0); this.PotManaBox.Text = Settings.Instance.PotMana.ToString(); this.PotHealthBox.Text = Settings.Instance.PotHealth.ToString(); this.FightDistanceBox.Text = Settings.Instance.FightDistance.ToString(); foreach (Skill skill in Settings.Instance.Skills) { tab = new SkillTab(skill.Name); foreach (System.Reflection.PropertyInfo info in typeof(Skill).GetProperties()) { if (info.GetValue(skill) != null && (info.PropertyType.ToString().Contains("Int32")) && (info.Name.Equals("MobsAroundTarget") || (Int32)info.GetValue(skill) != 0)) { if (tab.Controls[info.Name + "Box"] != null) { if (info.Name.Equals("MobsAroundTarget")) { if ((Int32)info.GetValue(skill) == 1) { tab.Controls[info.Name + "Box"].Text = "Me"; } else { tab.Controls[info.Name + "Box"].Text = "Maintarget"; } } else { tab.Controls[info.Name + "Box"].Text = info.GetValue(skill).ToString(); } continue; } } if (info.GetValue(skill) != null && (info.PropertyType.ToString().Contains("String") && ((String)info.GetValue(skill)) != null)) { if (tab.Controls[info.Name + "Box"] != null) { tab.Controls[info.Name + "Box"].Text = info.GetValue(skill).ToString(); continue; } } if (info.PropertyType.ToString().Contains("Boolean") && (Boolean)info.GetValue(skill)) { CheckedListBox box = (CheckedListBox)tab.Controls["SkillTypeCheckBox"]; Int32 index = -1; if (box != null) { index = box.Items.IndexOf(info.Name); if (index == -1) { continue; } box.SetItemChecked(index, true); } } } this.SkillSettingsBody.TabPages.Add(tab); tab = null; } }
public main() { Text = ".net interface builder"; Size = new Size(500,535); int y = 10; //plugins groupbox pluginsGb = new GroupBox(); pluginsGb.Parent = this; pluginsGb.Text = "Plugins"; pluginsGb.Location = new Point(10, y); pluginsGb.Size = new Size(200,240); pluginsGb.Anchor = AnchorStyles.Left | AnchorStyles.Top; y += pluginsGb.Height + 10; //plugins checklistbox plugins = new CheckedListBox(); plugins.Parent = pluginsGb; plugins.Location = new Point(10,15); plugins.Size = new Size(180, 215); plugins.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Bottom; //plugins-user groupbox pluginsUserGb = new GroupBox(); pluginsUserGb.Parent = this; pluginsUserGb.Text = "Plugins-user"; pluginsUserGb.Location = new Point(10, y); pluginsUserGb.Size = new Size(200,240); pluginsUserGb.Anchor = AnchorStyles.Left | AnchorStyles.Top; y += pluginsUserGb.Height + 10; //pluginsUser checklistbox pluginsUser = new CheckedListBox(); pluginsUser.Parent = pluginsUserGb; pluginsUser.Location = new Point(10, 15); pluginsUser.Size = new Size(180, 215); pluginsUser.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom; y = 10; //namespace label Label lab = new Label(); lab.Parent = this; lab.AutoSize = true; lab.Text = "Namespace"; lab.Location = new Point(220, y); //class label lab = new Label(); lab.Parent = this; lab.AutoSize = true; lab.Text = "Class name"; lab.Location = new Point(360, y); y += lab.Height + 0; //namespace textbox nameSpace = new TextBox(); nameSpace.Parent = this; nameSpace.Location = new Point(220,y); nameSpace.Width = 130; //class textbox className = new TextBox(); className.Parent = this; className.Location = new Point(355, y); className.Width = 130; className.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; y += className.Height + 10; //build button Button btnBuild = new Button(); btnBuild.Parent = this; btnBuild.Text = "&Build"; btnBuild.Width -= 20; btnBuild.Location = new Point(360, y); btnBuild.Click += new EventHandler(btnBuild_Click); //about button Button btnAbout = new Button(); btnAbout.Parent = this; btnAbout.Text = "&About"; btnAbout.Width -= 20; btnAbout.Location = new Point(360 + btnBuild.Width + 15, y); btnAbout.Click += new EventHandler(btnAbout_Click); //exit button Button btnExit = new Button(); btnExit.Parent = this; btnExit.Text = "E&xit"; btnExit.Width -= 20; btnExit.Location = new Point(360 + btnBuild.Width + 15, y); btnExit.Click += new EventHandler(btnExit_Click); btnExit.Visible = false; //template groupbox GroupBox gb = new GroupBox(); gb.Parent = this; gb.Text = "Template"; gb.Location = new Point(220, y); gb.Size = new Size(120, 45); y += gb.Height + 10; //template combobox Combotemplate = new ComboBox(); Combotemplate.Parent = gb; Combotemplate.Width = 100; Combotemplate.Location = new Point(10, 15); Combotemplate.DropDownStyle = ComboBoxStyle.DropDownList; //search groupbox gb = new GroupBox(); gb.Parent = this; gb.Text = "Search functions"; gb.Location = new Point(220, y); gb.Size = new Size(this.Width - gb.Left - 15, this.Height - gb.Height - 40); gb.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom; //search listview search = new ListView(); search.Parent = gb; search.Location = new Point(10, 45); search.Size = new Size(gb.Width - 20, gb.Height - 55); search.View = View.Details; search.Columns.Add("Function name", 120, HorizontalAlignment.Left); search.Columns.Add("Dll", 120, HorizontalAlignment.Left); search.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; //search textbox TextBox searchBox = new TextBox(); searchBox.Parent = gb; searchBox.Location = new Point(10, 15); searchBox.Width = 190; searchBox.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; searchBox.TextChanged += new EventHandler(searchBox_TextChanged); //search button Button btnSearch = new Button(); btnSearch.Parent = gb; btnSearch.Text = "build"; btnSearch.Location = new Point(searchBox.Left + searchBox.Width + 5, 15); btnSearch.Width = 50; btnSearch.Anchor = AnchorStyles.Right | AnchorStyles.Top; btnSearch.Click += new EventHandler(btnSearch_Click); this.Load += new EventHandler(main_Load); this.Resize += new EventHandler(main_Resize); }
/// <summary> /// This is used to bind the controls in the given collection to their /// associated project properties. /// </summary> /// <param name="controls">The control collection from which to get /// the bound controls. Controls are bound if their <see cref="Control.Tag"/> /// property is a string that matches a project property.</param> /// <remarks>This method is recursive</remarks> protected void BindProperties(Control.ControlCollection controls) { Type t; PropertyInfo pi; string typeName, boundProperty; try { this.IsBinding = true; foreach (Control c in controls) { t = c.GetType(); typeName = t.FullName; boundProperty = c.Tag as string; // Ignore unbound controls if (String.IsNullOrEmpty(boundProperty)) { // Scan containers too except for user controls unless they are in the custom user control // list. They may or may not represent a single-valued item and we can't process them // reliably. The same could be true of one of these if it is a derived type. if (!customControls.ContainsKey(typeName) && (c is GroupBox || c is Panel || c is TabControl || c is TabPage || c is SplitContainer || customUserControls.Contains(typeName))) { this.BindProperties(c.Controls); continue; } continue; } // Check for custom types first if (customControls.ContainsKey(typeName)) { // Find and connect the Changed event for the named property if one exists var changedEvent = t.GetEvents().Where(ev => ev.Name == customControls[typeName] + "Changed").FirstOrDefault(); if (changedEvent != null) { EventHandler h = new EventHandler(OnPropertyChanged); changedEvent.RemoveEventHandler(c, h); changedEvent.AddEventHandler(c, h); } pi = t.GetProperty(customControls[typeName], BindingFlags.Public | BindingFlags.Instance); } else if (c is TextBoxBase || c is Label) { c.TextChanged -= OnPropertyChanged; c.TextChanged += OnPropertyChanged; pi = t.GetProperty("Text", BindingFlags.Public | BindingFlags.Instance); } else if (c is ComboBox) { ComboBox cbo = (ComboBox)c; cbo.SelectedIndexChanged -= OnPropertyChanged; cbo.SelectedIndexChanged += OnPropertyChanged; if (cbo.DataSource != null) { pi = t.GetProperty("SelectedValue", BindingFlags.Public | BindingFlags.Instance); } else { pi = t.GetProperty("SelectedItem", BindingFlags.Public | BindingFlags.Instance); } } else if (c is CheckBox) { CheckBox cb = (CheckBox)c; cb.CheckedChanged -= OnPropertyChanged; cb.CheckedChanged += OnPropertyChanged; pi = t.GetProperty("Checked", BindingFlags.Public | BindingFlags.Instance); } else if ((c is DateTimePicker) || (c is UpDownBase) || (c is TrackBar)) { DateTimePicker dtp = c as DateTimePicker; if (dtp != null) { dtp.ValueChanged -= OnPropertyChanged; dtp.ValueChanged += OnPropertyChanged; } else { UpDownBase udc = c as UpDownBase; if (udc != null) { udc.TextChanged -= OnPropertyChanged; udc.TextChanged += OnPropertyChanged; } else { TrackBar tbar = (TrackBar)c; tbar.ValueChanged -= OnPropertyChanged; tbar.ValueChanged += OnPropertyChanged; } } pi = t.GetProperty("Value", BindingFlags.Public | BindingFlags.Instance); } else if (c is CheckedListBox) { CheckedListBox clb = (CheckedListBox)c; clb.ItemCheck -= OnPropertyChanged; clb.ItemCheck += OnPropertyChanged; // Since CheckedListBox is a multi-valued control, the user will have to bind it // in the BindControlValue() method override. They'll have to store it in the // StoreControlValue() method override too. pi = null; } else if (c is ListBox) { ListBox lb = (ListBox)c; lb.SelectedIndexChanged -= OnPropertyChanged; lb.SelectedIndexChanged += OnPropertyChanged; if (lb.DataSource != null) { pi = t.GetProperty("SelectedValue", BindingFlags.Public | BindingFlags.Instance); } else { pi = t.GetProperty("SelectedItem", BindingFlags.Public | BindingFlags.Instance); } } else { pi = null; } // Give the user a chance to handle the control in a custom fashion. If not handled and we // couldn't figure out what to use, ignore it. if (!this.BindControlValue(c) && pi != null) { this.Bind(c, pi, boundProperty); } } } finally { this.IsBinding = false; } }
public void WorkerStart(BackgroundWorker backgroundWorker, ToolStripProgressBar progressBar, ToolStripLabel label, string path, List <Anime> animeList, TextBox AnimeListBox, CheckedListBox checkedListBox1, TextBox AnimeInfoBox) { methods.Logger("Inicjacja workera", null); this.backgroundWorker = backgroundWorker; this.progressBar = progressBar; this.label = label; this.path = path; this.animeList = animeList; this.AnimeListBox = AnimeListBox; this.checkedListBox1 = checkedListBox1; this.AnimeInfoBox = AnimeInfoBox; this.label.Text = "Zajęty..."; string[] files = Directory.GetFiles(this.path, "*.mp3", SearchOption.AllDirectories); methods.Logger("Obliczono liczbę plików mp3 w folderze", files.Length.ToString()); this.progressBar.Maximum = files.Length; this.progressBar.Value = 0; this.backgroundWorker.RunWorkerAsync(); }
private void updateCheckboxes(object sender, ItemCheckEventArgs e) { if (e.NewValue.Equals(System.Windows.Forms.CheckState.Checked)) { //remove any item just checked from all other boxes CheckedListBox box = (CheckedListBox)sender; string name = box.Name; if (box.SelectedItem != null) { switch (name) { case "checkedListBox1": this.checkedListBox2.Items.Remove(box.SelectedItem); this.checkedListBox3.Items.Remove(box.SelectedItem); this.checkedListBox4.Items.Remove(box.SelectedItem); break; case "checkedListBox2": this.checkedListBox1.Items.Remove(box.SelectedItem); break; case "checkedListBox3": this.checkedListBox1.Items.Remove(box.SelectedItem); break; case "checkedListBox4": this.checkedListBox1.Items.Remove(box.SelectedItem); break; } } } else { //add any items just unchecked to all other boxes CheckedListBox box = (CheckedListBox)sender; string name = box.Name; if (box.SelectedItem != null) { switch (name) { case "checkedListBox1": if (!checkedListBox2.Items.Contains(box.SelectedItem)) { this.checkedListBox2.Items.Add(box.SelectedItem); } if (!checkedListBox3.Items.Contains(box.SelectedItem)) { this.checkedListBox3.Items.Add(box.SelectedItem); } if (!checkedListBox4.Items.Contains(box.SelectedItem)) { this.checkedListBox4.Items.Add(box.SelectedItem); } break; case "checkedListBox2": if (!checkedListBox1.Items.Contains(box.SelectedItem)) { this.checkedListBox1.Items.Add(box.SelectedItem); } break; case "checkedListBox3": if (!checkedListBox1.Items.Contains(box.SelectedItem)) { this.checkedListBox1.Items.Add(box.SelectedItem); } break; case "checkedListBox4": if (!checkedListBox1.Items.Contains(box.SelectedItem)) { this.checkedListBox1.Items.Add(box.SelectedItem); } break; } } } }
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 static void SetFlags <T>(this CheckedListBox _clb, String remove) { _clb.SetFlags(typeof(T), remove); }
internal CheckedListBox cargarCheckedListBoxVacia(string p, CheckedListBox ListBoxFuncionalidad) { { return(ListBoxFuncionalidad); } }
public void populateCheckListBox(ref CheckedListBox designations, ref CheckedListBox faculty, ref CheckedListBox department, ref CheckedListBox leave, ref CheckedListBox salarycode, ref CheckedListBox salaryscale) { try { MySqlCommand cmd = conn.connConnection().CreateCommand(); cmd = conn.connConnection().CreateCommand(); cmd = new MySqlCommand("SELECT * FROM `faculty`", conn.connConnection()); conn.connOpen(); conn.connConnection(); MySqlDataReader reader1; reader1 = cmd.ExecuteReader(); while (reader1.Read()) { //if(count == 0) faculty.Items.Add(reader1["Faculty Name"].ToString()); } reader1.Close(); cmd = conn.connConnection().CreateCommand(); cmd = conn.connConnection().CreateCommand(); cmd = new MySqlCommand("SELECT * FROM `department`", conn.connConnection()); conn.connOpen(); conn.connConnection(); reader1 = cmd.ExecuteReader(); while (reader1.Read()) { //if(count == 0) department.Items.Add(reader1["Department Name"].ToString()); } reader1.Close(); cmd = conn.connConnection().CreateCommand(); cmd = conn.connConnection().CreateCommand(); cmd = new MySqlCommand("SELECT * FROM `designations`", conn.connConnection()); conn.connOpen(); conn.connConnection(); reader1 = cmd.ExecuteReader(); // TreeNode node2 = new TreeNode("Designation"); while (reader1.Read()) { //if(count == 0) designations.Items.Add(reader1["Designation"].ToString()); } reader1.Close(); cmd = conn.connConnection().CreateCommand(); cmd = conn.connConnection().CreateCommand(); cmd = new MySqlCommand("SELECT * FROM `leavetype`", conn.connConnection()); conn.connOpen(); conn.connConnection(); leave.Items.Clear(); reader1 = cmd.ExecuteReader(); //TreeNode node2 = new TreeNode("Designation"); while (reader1.Read()) { //if(count == 0) leave.Items.Add(reader1["Leave Type"].ToString()); } reader1.Close(); cmd = conn.connConnection().CreateCommand(); cmd = conn.connConnection().CreateCommand(); cmd = new MySqlCommand("SELECT * FROM `salarycode`", conn.connConnection()); conn.connOpen(); conn.connConnection(); reader1 = cmd.ExecuteReader(); //TreeNode node2 = new TreeNode("Designation"); while (reader1.Read()) { //if(count == 0) salarycode.Items.Add(reader1["Salary Code"].ToString()); } reader1.Close(); cmd = conn.connConnection().CreateCommand(); cmd = conn.connConnection().CreateCommand(); cmd = new MySqlCommand("SELECT * FROM `salaryscale`", conn.connConnection()); conn.connOpen(); conn.connConnection(); reader1 = cmd.ExecuteReader(); //TreeNode node2 = new TreeNode("Designation"); while (reader1.Read()) { //if(count == 0) salaryscale.Items.Add(reader1["Salary Scale"].ToString()); } reader1.Close(); cmd.Dispose(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public static string GetStatSQL(string zid, stcfg cfg, CheckedListBox cklistzhibiao, ComboBox cmbgroupcolumn) { string strzhibiao = ""; string columns = ""; string join = ""; string groupby = ""; string wherezt = "st_dt.ztid =" + zid; string where = ""; string tables = ""; string sql = "select {0},{1} from {2} where {3} {4} {5} group by {6}"; List <string> tablenames = new List <string>(); tablenames.Add("st_iv"); strzhibiao = " count(distinct st_iv.iv) as '发明人数量' "; ChartColumn group = (ChartColumn)cmbgroupcolumn.SelectedItem; columns = string.Format("{0}.{1} as '{2}'", group.TableName, group.ColName, group.ShowName); groupby = string.Format("{0}.{1}", group.TableName, group.ColName, group.ShowName); tablenames.Add(group.TableName); if (cfg.StartYear != 0 && cfg.EndYear != 0) { where += string.Format(" and {0}.{1} between {2} and {3}", group.TableName, group.ColName, cfg.StartYear, cfg.EndYear); } tablenames = tablenames.Distinct().ToList <string>(); tablenames.Remove("st_dt"); tablenames.Add("st_dt"); foreach (var tb in tablenames) { tables += tb + ","; } tables = tables.Trim(','); if (tablenames.Count > 1) { for (int i = 1; i < tablenames.Count; i++) { if (join == "") { join += string.Format("{0}.sid={1}.sid", tablenames[0], tablenames[i]); } else { join += string.Format(" and {0}.sid={1}.sid", tablenames[0], tablenames[i]); } } } if (join == "") { wherezt = string.Format("st_dt.ztid={0}", zid); } else { wherezt = string.Format(" and st_dt.ztid={0}", zid); } string tmpsql = string.Format(sql, columns, strzhibiao, tables, join, wherezt, where, groupby); return(tmpsql); }
public void loadReportTable(CheckedListBox chkLBxPersonal, CheckedListBox chkLBxFamily, CheckedListBox chkLBxEducational, CheckedListBox chkLBxService, CheckedListBox chkLBxOtherPositions, DataGridView tblReport, CheckedListBox chkLBAddress, CheckedListBox chkLBFaculty, CheckedListBox chkLBSalaryScale, CheckedListBox chkLBSalaryCode, CheckedListBox chkLBDesignation, CheckedListBox chkLBLeave, CheckedListBox chkLBDepartment, CheckedListBox chkLtBxLeaveCategory) { try { string query = "SELECT DISTINCT "; int wherecount = 0; foreach (object itemChecked in chkLBxPersonal.CheckedItems) { query += "`AcademicStaff`.`" + itemChecked.ToString() + "`" + ","; //MessageBox.Show(itemChecked.ToString()); } foreach (object itemChecked in chkLBxFamily.CheckedItems) { query += "`ChildrenDetail`.`" + itemChecked.ToString() + "`" + ","; //MessageBox.Show(itemChecked.ToString()); } foreach (object itemChecked in chkLBxEducational.CheckedItems) { query += "`educationalqulifications`.`" + itemChecked.ToString() + "`" + ","; //MessageBox.Show(itemChecked.ToString()); } foreach (object itemChecked in chkLBxService.CheckedItems) { query += "`servicerecords`.`" + itemChecked.ToString() + "`" + ","; //MessageBox.Show(itemChecked.ToString()); } foreach (object itemChecked in chkLBxOtherPositions.CheckedItems) { query += "`OtherPositions`.`" + itemChecked.ToString() + "`" + ","; //MessageBox.Show(itemChecked.ToString()); } foreach (object itemChecked in chkLBAddress.CheckedItems) { query += "`Address`.`" + itemChecked.ToString() + "`" + ","; //MessageBox.Show(itemChecked.ToString()); } foreach (object itemChecked in chkLBLeave.CheckedItems) { query += "`leave`.`" + itemChecked.ToString() + "`" + ","; //MessageBox.Show(itemChecked.ToString()); } query = query.Substring(0, query.Length - 1); query += " FROM academicstaff "; if (chkLBxFamily.CheckedItems.Count > 0) { query += ",childrendetail "; } if (chkLBxOtherPositions.CheckedItems.Count > 0) { query += ",otherpositions "; } if (chkLBxEducational.CheckedItems.Count > 0) { query += ",educationalqulifications "; } if (chkLBxService.CheckedItems.Count > 0) { query += ",servicerecords "; } if (chkLBSalaryCode.CheckedItems.Count > 0) { query += ",salarycode "; } if (chkLBSalaryScale.CheckedItems.Count > 0) { query += ",salaryscale "; } if (chkLBDesignation.CheckedItems.Count > 0) { query += ",designations "; } if (chkLBDepartment.CheckedItems.Count > 0 || chkLBFaculty.CheckedItems.Count > 0) { query += ",department "; } if (chkLtBxLeaveCategory.CheckedItems.Count > 0) { query += ",leavetype "; } if (chkLBFaculty.CheckedItems.Count > 0) { query += ",faculty "; } if (chkLBAddress.CheckedItems.Count > 0) { query += ",address "; } if (chkLBLeave.CheckedItems.Count > 0 || chkLtBxLeaveCategory.CheckedItems.Count > 0) { query += ",`leave` "; } if (chkLBxFamily.CheckedItems.Count > 0 || chkLBxOtherPositions.CheckedItems.Count > 0 || chkLBxEducational.CheckedItems.Count > 0 || chkLBxService.CheckedItems.Count > 0 || chkLBLeave.CheckedItems.Count > 0 || chkLBAddress.CheckedItems.Count > 0 || chkLtBxLeaveCategory.CheckedItems.Count > 0 || chkLBFaculty.CheckedItems.Count > 0) { query += "WHERE "; } if (chkLBxFamily.CheckedItems.Count > 0) { if (wherecount != 0) { query += "AND "; } wherecount++; query += "`AcademicStaff`.`NIC` = `ChildrenDetail`.`NIC` "; } if (chkLBxOtherPositions.CheckedItems.Count > 0) { if (wherecount != 0) { query += "AND "; } wherecount++; query += "`AcademicStaff`.`NIC` = `OtherPositions`.`NIC` "; } if (chkLBxEducational.CheckedItems.Count > 0) { if (wherecount != 0) { query += "AND "; } wherecount++; query += "`AcademicStaff`.`NIC` = `EducationalQulifications`.`NIC` "; } if (chkLBxService.CheckedItems.Count > 0) { if (wherecount != 0) { query += "AND "; } wherecount++; query += "`AcademicStaff`.`NIC` = `ServiceRecords`.`NIC` "; } if (chkLBSalaryCode.CheckedItems.Count > 0) { if (wherecount != 0) { query += "AND "; } wherecount++; query += "`AcademicStaff`.`Salary Scale` = `salaryscale`.`Salary Scale` "; query += "AND `salaryscale`.`Salary Code` = `salarycode`.`Salary Code` "; } if (chkLBSalaryScale.CheckedItems.Count > 0) { if (wherecount != 0) { query += "AND "; } wherecount++; query += "`AcademicStaff`.`Salary Scale` = `salaryscale`.`Salary Scale` "; } if (chkLBLeave.CheckedItems.Count > 0) { if (wherecount != 0) { query += "AND "; } wherecount++; query += "`academicstaff`.`NIC` = `leave`.`NIC` "; } if (chkLBDesignation.CheckedItems.Count > 0) { if (wherecount != 0) { query += "AND "; } wherecount++; query += "`academicstaff`.`Designation` = `designations`.`Designation` "; } if (chkLBDepartment.CheckedItems.Count > 0) { if (wherecount != 0) { query += "AND "; } wherecount++; query += "`academicstaff`.`Department Name` = `department`.`Department Name` "; } if (chkLtBxLeaveCategory.CheckedItems.Count > 0) { if (wherecount != 0) { query += "AND "; } wherecount++; query += "`AcademicStaff`.`NIC` = `leave`.`NIC` "; //query += "AND `leave`.`Leave Type` = `leavetype`.`Leave Type` "; } if (chkLBFaculty.CheckedItems.Count > 0) { if (wherecount != 0) { query += "AND "; } wherecount++; query += "`AcademicStaff`.`Department Name` = `Department`.`Department Name` "; //query += "AND `department`.`Faculty Name` = `faculty`.`Faculty Name` "; } if (chkLBAddress.CheckedItems.Count > 0) { if (wherecount != 0) { query += "AND "; } wherecount++; query += "`AcademicStaff`.`NIC` = `Address`.`NIC` "; } foreach (object itemChecked in chkLBDepartment.CheckedItems) { if (wherecount != 0) { query += "AND "; } wherecount++; query += "WHERE `Department Name` = " + itemChecked.ToString() + " "; // query += "`SalaryScale`.`" + itemChecked.ToString() + "`" + ","; //MessageBox.Show(itemChecked.ToString()); } foreach (object itemChecked in chkLtBxLeaveCategory.CheckedItems) { if (wherecount != 0) { query += "AND "; } wherecount++; query += "`leave`.`Leave Category` = " + itemChecked.ToString() + " "; //query += "`leavetype`.`" + itemChecked.ToString() + "`" + ","; //MessageBox.Show(itemChecked.ToString()); } foreach (object itemChecked in chkLBDesignation.CheckedItems) { if (wherecount != 0) { query += "AND "; } wherecount++; query += "WHERE `Designation` = " + itemChecked.ToString() + " "; // query += "`designations`.`" + itemChecked.ToString() + "`" + ","; //MessageBox.Show(itemChecked.ToString()); } foreach (object itemChecked in chkLBSalaryCode.CheckedItems) { if (wherecount != 0) { query += "AND "; } wherecount++; query += "WHERE `Salary Code` = " + itemChecked.ToString() + " "; //query += "`salarycode`.`" + itemChecked.ToString() + "`" + ","; //MessageBox.Show(itemChecked.ToString()); } foreach (object itemChecked in chkLBFaculty.CheckedItems) { if (wherecount != 0) { query += "AND "; } wherecount++; query += "`department`.`Faculty Name` = " + itemChecked.ToString() + " "; //query += "`Department`.`" + itemChecked.ToString() + "`" + ","; //MessageBox.Show(itemChecked.ToString()); } foreach (object itemChecked in chkLBSalaryScale.CheckedItems) { if (wherecount != 0) { query += "AND "; } wherecount++; query += "WHERE `Salary Scale` = " + itemChecked.ToString() + " "; //query += "`salaryscale`.`" + itemChecked.ToString() + "`" + ","; //MessageBox.Show(itemChecked.ToString()); } //MessageBox.Show(query); //Console.WriteLine(query); conn.connOpen(); conn.connConnection(); MySqlCommand cmd = conn.connConnection().CreateCommand(); cmd = new MySqlCommand(query, conn.connConnection()); //cmd.Parameters.AddWithValue("@1", txtSearchName); MySqlDataAdapter dataAdapter = new MySqlDataAdapter(cmd); DataTable table = new DataTable(); dataAdapter.Fill(table); tblReport.DataSource = table; conn.closeConnection(); cmd.Dispose(); dataAdapter.Dispose(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// Create a control for the given property. /// </summary> /// <param name="aInfo"></param> /// <param name="aAttribute"></param> /// <param name="aObject"></param> /// <returns></returns> private Control CreateControlForProperty(PropertyInfo aInfo, AttributeObjectProperty aAttribute, T aObject) { if (aInfo.PropertyType == typeof(int) || aInfo.PropertyType == typeof(float)) { //Integer properties are using numeric editor NumericUpDown ctrl = new NumericUpDown(); ctrl.AutoSize = true; //ctrl.Dock = DockStyle.Fill; // Fill the whole table cell ctrl.Minimum = (decimal)aAttribute.Minimum; ctrl.Maximum = (decimal)aAttribute.Maximum; ctrl.Increment = (decimal)aAttribute.Increment; ctrl.DecimalPlaces = aAttribute.DecimalPlaces; ctrl.Value = decimal.Parse(aInfo.GetValue(aObject).ToString()); // Hook-in change notification after setting the value ctrl.ValueChanged += ControlValueChanged; return(ctrl); } else if (aInfo.PropertyType.IsEnum) { //Enum properties are using combo box ComboBox ctrl = new ComboBox(); ctrl.AutoSize = true; ctrl.Sorted = true; ctrl.DropDownStyle = ComboBoxStyle.DropDownList; //Data source is fine but it gives us duplicate entries for duplicated enum values //ctrl.DataSource = Enum.GetValues(aInfo.PropertyType); //Therefore we need to explicitly create our items Size cbSize = new Size(0, 0); foreach (string name in aInfo.PropertyType.GetEnumNames()) { ctrl.Items.Add(name.ToString()); Graphics g = this.CreateGraphics(); //Since combobox autosize would not work we need to get measure text ourselves SizeF size = g.MeasureString(name.ToString(), ctrl.Font); cbSize.Width = Math.Max(cbSize.Width, (int)size.Width); cbSize.Height = Math.Max(cbSize.Height, (int)size.Height); } //Make sure our combobox is large enough ctrl.MinimumSize = cbSize; // Instantiate our enum object enumValue = Activator.CreateInstance(aInfo.PropertyType); enumValue = aInfo.GetValue(aObject); //Set the current item ctrl.SelectedItem = enumValue.ToString(); // Hook-in change notification after setting the value ctrl.SelectedIndexChanged += ControlValueChanged; return(ctrl); } else if (aInfo.PropertyType == typeof(bool)) { CheckBox ctrl = new CheckBox(); ctrl.AutoSize = true; ctrl.Text = aAttribute.Description; ctrl.Checked = (bool)aInfo.GetValue(aObject); // Hook-in change notification after setting the value ctrl.CheckedChanged += ControlValueChanged; return(ctrl); } else if (aInfo.PropertyType == typeof(string)) { TextBox ctrl = new TextBox(); ctrl.AutoSize = true; ctrl.Dock = DockStyle.Fill; // Fill the whole table cell ctrl.Text = (string)aInfo.GetValue(aObject); // Multiline setup ctrl.Multiline = aAttribute.Multiline; if (ctrl.Multiline) { ctrl.AcceptsReturn = true; ctrl.ScrollBars = ScrollBars.Vertical; // Adjust our height as needed Size size = ctrl.Size; size.Height += ctrl.Font.Height * (aAttribute.HeightInLines - 1); ctrl.MinimumSize = size; } // Hook-in change notification after setting the value ctrl.TextChanged += ControlValueChanged; return(ctrl); } else if (aInfo.PropertyType == typeof(PropertyFile)) { // We have a file property // Create a button that will trigger the open file dialog to select our file. Button ctrl = new Button(); ctrl.AutoSize = true; ctrl.Text = ((PropertyFile)aInfo.GetValue(aObject)).FullPath; // Add lambda expression to Click event ctrl.Click += (sender, e) => { // Create open file dialog OpenFileDialog ofd = new OpenFileDialog(); ofd.RestoreDirectory = true; // Use file filter specified by our property ofd.Filter = aAttribute.Filter; // Show our dialog if (SharpLib.Forms.DlgBox.ShowDialog(ofd) == DialogResult.OK) { // Fetch selected file name ctrl.Text = ofd.FileName; } }; // Hook-in change notification after setting the value ctrl.TextChanged += ControlValueChanged; return(ctrl); } else if (aInfo.PropertyType == typeof(PropertyComboBox)) { //ComboBox property PropertyComboBox property = ((PropertyComboBox)aInfo.GetValue(aObject)); ComboBox ctrl = new ComboBox(); ctrl.AutoSize = true; ctrl.Sorted = property.Sorted; ctrl.DropDownStyle = ComboBoxStyle.DropDownList; //Data source is such a pain to set the current item //ctrl.DataSource = ((PropertyComboBox)aInfo.GetValue(aObject)).Items; foreach (string item in property.Items) { ctrl.Items.Add(item); } ctrl.SelectedItem = property.CurrentItem; // Hook-in change notification after setting the value // Make sure form content is updated after property change ctrl.SelectedIndexChanged += ControlValueChanged; return(ctrl); } else if (aInfo.PropertyType == typeof(PropertyButton)) { // We have a button property // Create a button that will trigger the custom action. Button ctrl = new Button(); ctrl.AutoSize = true; ctrl.Text = ((PropertyButton)aInfo.GetValue(aObject)).Text; // Hook in click event ctrl.Click += ((PropertyButton)aInfo.GetValue(aObject)).ClickEventHandler; // Hook-in change notification after setting the value ctrl.TextChanged += ControlValueChanged; return(ctrl); } else if (aInfo.PropertyType == typeof(PropertyCheckedListBox)) { //CheckedListBox property PropertyCheckedListBox property = ((PropertyCheckedListBox)aInfo.GetValue(aObject)); CheckedListBox ctrl = new CheckedListBox(); ctrl.AutoSize = true; ctrl.Sorted = property.Sorted; ctrl.CheckOnClick = true; // Populate our box with list items foreach (string item in property.Items) { int index = ctrl.Items.Add(item); // Check items if needed if (property.CheckedItems.Contains(item)) { ctrl.SetItemChecked(index, true); } } // // Hook-in change notification after setting the value // That's essentially making sure title/brief gets updated as items are checked or unchecked // This looks convoluted as we are working around the fact that ItemCheck event is triggered before the model is updated. // See: https://stackoverflow.com/a/48645552/3969362 ctrl.ItemCheck += (s, e) => BeginInvoke((MethodInvoker)(() => ControlValueChanged(s, e))); return(ctrl); } //TODO: add support for other control type here return(null); }
public static void BuildList(string darkBasic, CheckedListBox ca, CheckedListBox cb, ListView lv, ArrayList al) { Cursor.Current = Cursors.WaitCursor; int s; string[] items; lv.BeginUpdate(); lv.Items.Clear(); StringBuilder sb = new StringBuilder(255); foreach (object ob in ca.Items) { string str = darkBasic + "plugins\\" + ob.ToString(); uint hinst = Build.LoadLibrary(str); s = 1; int bad = 0; while (bad < 5) { if (Build.LoadString(hinst, s, sb, 255) > 0) { ListViewItem lvi = new ListViewItem(); items = sb.ToString().Split("%".ToCharArray(), 2); lvi.Text = items[0]; lvi.SubItems.Add(ob.ToString()); lv.Items.Add(lvi); //add item to arraylist Search se = new Search(lvi.Text, lvi.SubItems[1].Text); al.Add(se); } else { bad ++; } s ++; } Build.FreeLibrary(hinst); } foreach (object ob in cb.Items) { string str = darkBasic + "plugins-user\\" + ob.ToString(); uint hinst = Build.LoadLibrary(str); s = 1; int bad = 0; while (bad < 5) { if (Build.LoadString(hinst, s, sb, 255) > 0) { ListViewItem lvi = new ListViewItem(); items = sb.ToString().Split("%".ToCharArray(), 2); lvi.Text = items[0]; lvi.SubItems.Add(ob.ToString()); lv.Items.Add(lvi); //add item to arraylist Search se = new Search(lvi.Text, lvi.SubItems[1].Text); al.Add(se); } else { bad ++; } s ++; } Build.FreeLibrary(hinst); } lv.EndUpdate(); Cursor.Current = Cursors.Default; }
// Constructors public ObjectCollection(CheckedListBox owner) {}
public static void SetControls(CheckedListBox soundFilterList, ComboBox playableMusicList) { _soundFilterList = soundFilterList; _playableMusicList = playableMusicList; }
private void showEditParams(String[] urlParams) { paramsForm = new Form(); paramsForm.Width = 560; paramsForm.Height = 440; paramsForm.Text = "Please select parameters to edit.."; paramsForm.FormBorderStyle = FormBorderStyle.FixedDialog; paramsForm.StartPosition = FormStartPosition.CenterParent; paramsForm.MinimizeBox = false; paramsForm.MaximizeBox = false; // add url label TextBox txtUrl = new TextBox(); txtUrl.ReadOnly = true; txtUrl.Location = new Point(20, 10); txtUrl.Width = paramsForm.Width - 40; txtUrl.Text = editWithSession.fullUrl; paramsForm.Controls.Add(txtUrl); // jsonp type option chkJsonp = new CheckBox(); chkJsonp.Text = "Is this a JSONP request? I'll replace response body with the value you selected."; chkJsonp.Location = new Point(20, 40); chkJsonp.Width = paramsForm.Width - 40; chkJsonp.BackColor = Color.DarkOrange; paramsForm.Controls.Add(chkJsonp); // add params ui paramList = new CheckedListBox(); paramList.Location = new Point(20, 70); paramList.Width = paramsForm.Width - 40; paramList.Height = 300; paramList.Items.AddRange(urlParams); //paramList.CheckOnClick = true; for (int i = 0; i < paramList.Items.Count; i++) { paramList.SetItemChecked(i, true); } paramsForm.Controls.Add(paramList); // add "Edit it!" button Button btn_go = new Button(); btn_go.Text = "Edit it!"; btn_go.Width = 250; btn_go.Height = 22; btn_go.Location = new Point(paramsForm.Width / 2 - btn_go.Width / 2, 370); btn_go.Click += new EventHandler(this.OnFeditParamsWithClick); paramsForm.Controls.Add(btn_go); paramsForm.AcceptButton = btn_go; paramList.Focus(); paramsForm.ShowDialog(); }
private void InitializeComponent() { _cancelButton = new Button(); _checkedListBox = new CheckedListBox(); _okButton = new Button(); _addFileButton = new Button(); _addFolderButton = new Button(); SuspendLayout(); _cancelButton.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right))); _cancelButton.DialogResult = DialogResult.Cancel; _cancelButton.Location = new Point(344, 330); _cancelButton.Name = "cancelButton"; _cancelButton.Size = new Size(75, 23); _cancelButton.TabIndex = 4; _cancelButton.Text = global::QuickSharp.CodeAssist.DotNet.Resources.ReferencesFormCancel; _cancelButton.UseVisualStyleBackColor = true; _checkedListBox.Anchor = ((AnchorStyles)((((AnchorStyles.Top | AnchorStyles.Bottom) | AnchorStyles.Left) | AnchorStyles.Right))); _checkedListBox.CheckOnClick = true; _checkedListBox.HorizontalScrollbar = true; _checkedListBox.IntegralHeight = false; _checkedListBox.Location = new Point(12, 12); _checkedListBox.Name = "checkedListBox"; _checkedListBox.Size = new Size(407, 308); _checkedListBox.Sorted = true; _checkedListBox.TabIndex = 0; _okButton.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right))); _okButton.DialogResult = DialogResult.OK; _okButton.Location = new Point(263, 330); _okButton.Name = "okButton"; _okButton.Size = new Size(75, 23); _okButton.TabIndex = 3; _okButton.Text = QuickSharp.CodeAssist.DotNet.Resources.ReferencesFormOK; _okButton.UseVisualStyleBackColor = true; _okButton.Click += new EventHandler(OkButton_Click); _addFileButton.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Left))); _addFileButton.Location = new Point(12, 330); _addFileButton.Name = "addFileButton"; _addFileButton.Size = new Size(75, 23); _addFileButton.TabIndex = 1; _addFileButton.Text = QuickSharp.CodeAssist.DotNet.Resources.ReferencesFormAddFile; _addFileButton.UseVisualStyleBackColor = true; _addFileButton.Click += new EventHandler(AddFileButton_Click); _addFolderButton.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Left))); _addFolderButton.Location = new Point(93, 330); _addFolderButton.Name = "addFolderButton"; _addFolderButton.Size = new Size(92, 23); _addFolderButton.TabIndex = 2; _addFolderButton.Text = QuickSharp.CodeAssist.DotNet.Resources.ReferencesFormAddFolder; _addFolderButton.UseVisualStyleBackColor = true; _addFolderButton.Click += new EventHandler(AddFolderButton_Click); AcceptButton = _okButton; AutoScaleDimensions = new SizeF(6F, 13F); AutoScaleMode = AutoScaleMode.Font; CancelButton = _cancelButton; ClientSize = new Size(431, 365); Controls.Add(_addFolderButton); Controls.Add(_addFileButton); Controls.Add(_okButton); Controls.Add(_checkedListBox); Controls.Add(_cancelButton); Font = new Font("Tahoma", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); MinimizeBox = false; MinimumSize = new Size(400, 200); Name = "ManageReferenceDatabaseForm"; ShowIcon = false; ShowInTaskbar = false; StartPosition = FormStartPosition.CenterParent; Text = Resources.ReferencesFormTitle; ResumeLayout(false); }
public static int[] SelectedCategoryIdentifier(this CheckedListBox sender) { return(sender.Items.Cast <Categories>().Where((cat, index) => sender.GetItemChecked(index)).Select(item => item.CategoryId).ToArray()); }
public MainDialog() { Text="Dialog based application"; StartPosition = FormStartPosition.Manual; Location = new Point(100, 100); Size = new Size(700, 400); Closed += new EventHandler(MainDialog_Closed); m_Label = new Label(); m_Label.Text = ".Net Framevork"; m_Label.Name = "Label1"; m_Label.Location = new Point(16, 16); m_Label.Size = new Size(120, 16); m_Label.TextAlign = ContentAlignment.MiddleCenter; m_Label.Font = new Font("Arial", 10F, FontStyle.Italic | FontStyle.Bold); m_Label.ForeColor = Color.FromArgb(255, 0, 0); Controls.Add(m_Label); m_LLabel = new LinkLabel(); m_LLabel.Name = "Label2"; //m_LLabel.Text = "www.microsoft.com"; m_LLabel.Text = "text.txt"; m_LLabel.Location = new Point(16, 40); m_LLabel.Size = new Size(120, 16); m_LLabel.TextAlign = ContentAlignment.MiddleCenter; m_LLabel.LinkClicked += new LinkLabelLinkClickedEventHandler(L2_LClicked); Controls.Add(m_LLabel); m_B = new Button(); m_B.Text = "Push me"; m_B.Location = new Point(18, 70); m_B.Size = new Size(100, 24); m_B.FlatStyle = System.Windows.Forms.FlatStyle.Popup; m_B.Click += new System.EventHandler(B_C); Controls.Add(m_B); m_TB = new TextBox(); m_TB.Text = ""; m_TB.Location = new Point(140, 16); m_TB.Size = new Size(160, 190); m_TB.Multiline = true; m_TB.MaxLength = 1000; m_TB.ScrollBars = ScrollBars.Both; m_TB.WordWrap = false; m_TB.TextChanged += new EventHandler(TB_TextChanged); Controls.Add(m_TB); m_RB_Red = new RadioButton(); m_RB_Red.Text = "Red"; m_RB_Red.Checked = false; m_RB_Red.Location = new Point(16, 16); m_RB_Red.Size = new Size(80, 20); m_RB_Red.Click += new System.EventHandler(RB_Click); m_RB_Red.Click += new System.EventHandler(RB_Click_Mes); m_RB_Green = new RadioButton(); m_RB_Green.Text = "Green"; m_RB_Green.Checked = true; m_RB_Green.Location = new Point(16, 36); m_RB_Green.Size = new Size(80, 20); m_RB_Green.Click += new System.EventHandler(RB_Click); m_RB_Blue = new RadioButton(); m_RB_Blue.Text = "Blue"; m_RB_Blue.Checked = false; m_RB_Blue.Location = new Point(16, 56); m_RB_Blue.Size = new Size(80, 20); m_RB_Blue.Click += new System.EventHandler(RB_Click); m_B.BackColor = Color.Green; m_GB_Color = new GroupBox(); m_GB_Color.Text = "Choose color"; m_GB_Color.Location = new Point(18, 100); m_GB_Color.Size = new Size(100, 80); m_GB_Color.Controls.AddRange(new Control[] {m_RB_Red, m_RB_Green, m_RB_Blue}); Controls.Add(m_GB_Color); m_TT = new ToolTip(); m_TT.AutomaticDelay = 300; m_TT.ShowAlways = true; m_TT.SetToolTip(m_B, "pressing the button will display message box"); m_LB = new ListBox(); m_LB.Items.Clear(); m_LB.IntegralHeight = false; m_LB.Location = new Point(310, 16); m_LB.Size = new Size(160, 90); m_LB.Items.AddRange(new object[]{"Red", "Orange", "Yellow", "Green", "Blue", "Indigo", "Violet"}); m_LB.SelectionMode = SelectionMode.MultiSimple; m_LB.SetSelected(1, true); m_LB.SelectedIndexChanged += new EventHandler(LB_SelIndChanged); Controls.Add(m_LB); m_CLB = new CheckedListBox(); m_CLB.Items.Clear(); m_CLB.IntegralHeight = false; m_CLB.Location = new Point(310, 110); m_CLB.Size = new Size(160, 90); m_CLB.Items.AddRange(new object[]{"Red", "Orange", "Yellow", "Green", "Blue", "Indigo", "Violet"}); m_CLB.SelectionMode = SelectionMode.One; m_CLB.SetSelected(1, true); m_CLB.CheckOnClick = true; m_CLB.SelectedIndexChanged += new EventHandler(CLB_SelIndChanged); Controls.Add(m_CLB); m_CB = new ComboBox(); m_CB.Items.Clear(); m_CB.Location = new Point(480, 16); m_CB.Size = new Size(160, 20); m_CB.DropDownStyle = ComboBoxStyle.DropDownList; m_CB.Items.AddRange(new object[]{"Red", "Orange", "Yellow", "Green", "Blue", "Indigo", "Violet"}); m_CB.SelectedIndex = 0; m_CB.SelectedIndexChanged += new EventHandler(CB_TextChanged); Controls.Add(m_CB); m_DUD = new DomainUpDown(); m_DUD.Items.Clear(); m_DUD.Location = new Point(480, 46); m_DUD.Size = new Size(160, 20); m_DUD.Items.AddRange(new object[]{"Red", "Orange", "Yellow", "Green", "Blue", "Indigo", "Violet"}); m_DUD.ReadOnly = true; m_DUD.UpDownAlign = LeftRightAlignment.Left; m_DUD.TextAlign = HorizontalAlignment.Right; m_DUD.Wrap = true; m_DUD.SelectedIndex = 1; Controls.Add(m_DUD); m_NUD = new NumericUpDown(); m_NUD.Location = new Point(480, 76); m_NUD.Size = new Size(160, 20); m_NUD.Minimum = new Decimal(-10); m_NUD.Maximum = new Decimal(10); m_NUD.Increment = new Decimal(0.1); m_NUD.DecimalPlaces = 1; m_NUD.Value = new Decimal(0.0); m_NUD.ValueChanged += new EventHandler(NUD_ValueChanged); Controls.Add(m_NUD); m_CT_L = new Label(); m_CT_L.Text = ""; m_CT_L.Location = new Point(18, 220); m_CT_L.Size = new Size(100, 16); m_CT_L.BorderStyle = BorderStyle.Fixed3D; m_CT_L.TextAlign = ContentAlignment.MiddleCenter; Controls.Add(m_CT_L); m_STT_B = new Button(); m_STT_B.Text = "Start timer"; m_STT_B.Location = new Point(18, 246); m_STT_B.Size = new Size(100, 24); m_STT_B.Click += new EventHandler(STT_BC); Controls.Add(m_STT_B); m_SPT_B = new Button(); m_SPT_B.Text = "Stop timer"; m_SPT_B.Location = new Point(18, 280); m_SPT_B.Size = new Size(100, 24); m_SPT_B.Click += new EventHandler(STP_BC); Controls.Add(m_SPT_B); m_T = new Timer(); m_T.Enabled = true; m_T.Interval = 100; m_T.Stop(); m_T.Tick += new EventHandler(T_T); m_LL = new Label(); m_LL.Location = new Point(480, 116); m_LL.Size = new Size(160, 20); m_LL.TextAlign = ContentAlignment.MiddleCenter; Controls.Add(m_LL); m_TrB = new TrackBar(); m_TrB.Minimum = 0; m_TrB.Maximum = 100; m_TrB.Value = 50; m_LL.Text = "Nivelul indicatorul este " + m_TrB.Value; m_TrB.Location = new Point(480, 146); m_TrB.Size = new Size(160, 20); m_TrB.Orientation = Orientation.Horizontal; m_TrB.TickStyle = TickStyle.TopLeft; m_TrB.TickFrequency = 10; m_TrB.Scroll += new EventHandler(TrB_Scroll); Controls.Add(m_TrB); }
public CheckedListBoxAccessibleObject(CheckedListBox owner) : base(owner) { }
public void CheckedListBox_SelectionModeGetSetInvalidFromEnum(SelectionMode expected) { using var box = new CheckedListBox(); ArgumentException ex = Assert.Throws <ArgumentException>(() => box.SelectionMode = expected); }
private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frm_finance_bank_salary_payment_sheet_report_selector)); this.panel1 = new System.Windows.Forms.Panel(); this.lblreportType = new System.Windows.Forms.Label(); this.cbo_bank_branch = new System.Windows.Forms.ComboBox(); this.label4 = new System.Windows.Forms.Label(); this.cbo_bank_name = new System.Windows.Forms.ComboBox(); this.label3 = new System.Windows.Forms.Label(); this.btnextract = new System.Windows.Forms.Button(); this.chk_current_period = new System.Windows.Forms.CheckBox(); this.cbo_deploy_period = new System.Windows.Forms.ComboBox(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.panel2 = new System.Windows.Forms.Panel(); this.chklist_branches = new System.Windows.Forms.CheckedListBox(); this.btnGenerateReport = new System.Windows.Forms.Button(); this.panel1.SuspendLayout(); this.panel2.SuspendLayout(); this.SuspendLayout(); // // panel1 // this.panel1.BackColor = System.Drawing.Color.Azure; this.panel1.Controls.Add(this.btnGenerateReport); this.panel1.Controls.Add(this.lblreportType); this.panel1.Controls.Add(this.cbo_bank_branch); this.panel1.Controls.Add(this.label4); this.panel1.Controls.Add(this.cbo_bank_name); this.panel1.Controls.Add(this.label3); this.panel1.Controls.Add(this.btnextract); this.panel1.Controls.Add(this.chk_current_period); this.panel1.Controls.Add(this.cbo_deploy_period); this.panel1.Controls.Add(this.label2); this.panel1.Controls.Add(this.label1); this.panel1.Controls.Add(this.panel2); this.panel1.Location = new System.Drawing.Point(3, 1); this.panel1.Margin = new System.Windows.Forms.Padding(4); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(758, 434); this.panel1.TabIndex = 0; // // lblreportType // this.lblreportType.AutoSize = true; this.lblreportType.Location = new System.Drawing.Point(315, 17); this.lblreportType.Name = "lblreportType"; this.lblreportType.Size = new System.Drawing.Size(92, 17); this.lblreportType.TabIndex = 11; this.lblreportType.Text = "lblreportType"; // // cbo_bank_branch // this.cbo_bank_branch.FormattingEnabled = true; this.cbo_bank_branch.Location = new System.Drawing.Point(292, 265); this.cbo_bank_branch.Margin = new System.Windows.Forms.Padding(4); this.cbo_bank_branch.Name = "cbo_bank_branch"; this.cbo_bank_branch.Size = new System.Drawing.Size(316, 24); this.cbo_bank_branch.TabIndex = 10; // // label4 // this.label4.AutoSize = true; this.label4.BackColor = System.Drawing.Color.Yellow; this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label4.Location = new System.Drawing.Point(288, 242); this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(93, 18); this.label4.TabIndex = 9; this.label4.Text = "Bank Branch"; // // cbo_bank_name // this.cbo_bank_name.FormattingEnabled = true; this.cbo_bank_name.Location = new System.Drawing.Point(292, 213); this.cbo_bank_name.Margin = new System.Windows.Forms.Padding(4); this.cbo_bank_name.Name = "cbo_bank_name"; this.cbo_bank_name.Size = new System.Drawing.Size(316, 24); this.cbo_bank_name.TabIndex = 8; this.cbo_bank_name.SelectedIndexChanged += new System.EventHandler(this.cbo_bank_name_SelectedIndexChanged); // // label3 // this.label3.AutoSize = true; this.label3.BackColor = System.Drawing.Color.Yellow; this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label3.Location = new System.Drawing.Point(288, 191); this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(86, 18); this.label3.TabIndex = 7; this.label3.Text = "Bank Name"; // // btnextract // this.btnextract.Location = new System.Drawing.Point(867, 265); this.btnextract.Margin = new System.Windows.Forms.Padding(4); this.btnextract.Name = "btnextract"; this.btnextract.Size = new System.Drawing.Size(131, 56); this.btnextract.TabIndex = 6; this.btnextract.Text = "Generate Report"; this.btnextract.UseVisualStyleBackColor = true; this.btnextract.Click += new System.EventHandler(this.btnextract_Click); // // chk_current_period // this.chk_current_period.AutoSize = true; this.chk_current_period.Checked = true; this.chk_current_period.CheckState = System.Windows.Forms.CheckState.Checked; this.chk_current_period.Enabled = false; this.chk_current_period.Location = new System.Drawing.Point(616, 136); this.chk_current_period.Margin = new System.Windows.Forms.Padding(4); this.chk_current_period.Name = "chk_current_period"; this.chk_current_period.Size = new System.Drawing.Size(147, 38); this.chk_current_period.TabIndex = 5; this.chk_current_period.Text = "use current \r\ndeployment period"; this.chk_current_period.UseVisualStyleBackColor = true; this.chk_current_period.CheckedChanged += new System.EventHandler(this.chk_current_period_CheckedChanged); // // cbo_deploy_period // this.cbo_deploy_period.FormattingEnabled = true; this.cbo_deploy_period.Location = new System.Drawing.Point(292, 150); this.cbo_deploy_period.Margin = new System.Windows.Forms.Padding(4); this.cbo_deploy_period.Name = "cbo_deploy_period"; this.cbo_deploy_period.Size = new System.Drawing.Size(316, 24); this.cbo_deploy_period.TabIndex = 4; // // label2 // this.label2.AutoSize = true; this.label2.BackColor = System.Drawing.Color.Yellow; this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label2.Location = new System.Drawing.Point(288, 128); this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(113, 18); this.label2.TabIndex = 2; this.label2.Text = "Payment Period"; // // label1 // this.label1.AutoSize = true; this.label1.BackColor = System.Drawing.Color.Yellow; this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.Location = new System.Drawing.Point(13, 4); this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(205, 18); this.label1.TabIndex = 1; this.label1.Text = "Select Stations for your report"; // // panel2 // this.panel2.BackColor = System.Drawing.Color.Silver; this.panel2.Controls.Add(this.chklist_branches); this.panel2.Location = new System.Drawing.Point(13, 26); this.panel2.Margin = new System.Windows.Forms.Padding(4); this.panel2.Name = "panel2"; this.panel2.Size = new System.Drawing.Size(267, 402); this.panel2.TabIndex = 0; // // chklist_branches // this.chklist_branches.FormattingEnabled = true; this.chklist_branches.Location = new System.Drawing.Point(4, 4); this.chklist_branches.Margin = new System.Windows.Forms.Padding(4); this.chklist_branches.Name = "chklist_branches"; this.chklist_branches.Size = new System.Drawing.Size(257, 395); this.chklist_branches.TabIndex = 1; // // btnGenerateReport // this.btnGenerateReport.ForeColor = System.Drawing.Color.Blue; this.btnGenerateReport.Location = new System.Drawing.Point(391, 296); this.btnGenerateReport.Name = "btnGenerateReport"; this.btnGenerateReport.Size = new System.Drawing.Size(217, 43); this.btnGenerateReport.TabIndex = 12; this.btnGenerateReport.Text = "Generate Report"; this.btnGenerateReport.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.btnGenerateReport.UseVisualStyleBackColor = true; this.btnGenerateReport.Click += new System.EventHandler(this.btnGenerateReport_Click); // // frm_finance_bank_salary_payment_sheet_report_selector // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(224)))), ((int)(((byte)(192))))); this.ClientSize = new System.Drawing.Size(766, 440); this.Controls.Add(this.panel1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Margin = new System.Windows.Forms.Padding(4); this.MaximizeBox = false; this.Name = "frm_finance_bank_salary_payment_sheet_report_selector"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Bank Salary Payment Report"; this.Load += new System.EventHandler(this.frm_finance_bank_salary_payment_sheet_report_selector_Load); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); this.panel2.ResumeLayout(false); this.ResumeLayout(false); }
//RpcClient DepartmentClient = new RpcClient(Config.RpcConfigString, "Departments"); public void LoadDepartments() { departments = new CheckedListBox(); }