-
Notifications
You must be signed in to change notification settings - Fork 18
SelectItemForm
SelectItemForm is a dialogue form which is using for select an item from lists such as IEnumerable or DataTable. Also, the SelectItemForm has ability to sort items by clicking on the column's headers and filtering items by criteria from TextBox control which exists on the dialogue.
This page describes how to show items on the SelectItemForm. For selecting items, please see the Static methods of SelectItemForm page.
The big point is on the dataGrid property which can be configured by DataGridView extenders
var items = new Dictionary<int, string>();
items.Add(1, "First value");
items.Add(2, "Second value");
items.Add(3, "More values...");
using (var form = SelectItemForm.CreateFormWithoutColumns(
items, "My values", "These values are mine"))
{
form.dataGrid.AddTextColumn("key", "Key").SetNumberStyle();
form.dataGrid.AddTextColumn("value", "Value").SetAutoSizeFillStyle(50);
form.ShowDialog();
}
var items = new DataTable();
items.Columns.AddRange(new DataColumn[] {
new DataColumn("ID", typeof(byte)),
new DataColumn("Group", typeof(string)),
new DataColumn("Remarks", typeof(string))});
items.Columns[0].Unique = true;
items.Columns[2].AllowDBNull = true;
items.Rows.Add(0, "Default");
items.Rows.Add(1, "Regular", "Regular group");
items.Rows.Add(2, "RG+Bonus", "Regular group with bonuses");
items.Rows.Add(3, "RET");
items.Rows.Add(4, "BIN");
using (var form = SelectItemForm.CreateFormWithoutColumns(items, "Groups"))
{
form.dataGrid.AddTextColumn(
items.Columns[0].ColumnName, "ID").SetNumberStyle();
form.dataGrid.AddTextColumn(
items.Columns[1].ColumnName, "Group");
form.dataGrid.AddTextColumn(
items.Columns[2].ColumnName, "Remarks").SetAutoSizeFillStyle(50);
form.ShowDialog();
}
The SelectItemForm provides two methods for showing the text on Header and Footer:
public void SetHeaderText(string Text)
public void SetFooterText(string Text)
Extenders:
DataGridView
DataGridViewColumn
FlowLayoutPanel
TableLayoutPanel
Features:
SelectItemForm
Settings
Components:
BitMaskCheckedListBox
HeaderTableLayoutPanel
SelectItemForm