static void SetTabComboBoxState(TabComboBox combobox, string strText) { string strState = ""; if (IsType(strText, combobox, out strState) == false) { return; } if (string.IsNullOrEmpty(strState) == false) { Hashtable table = StringUtil.ParseParameters(strState, ',', '=', "url"); string strStyle = (string)table["style"]; string strValue = (string)table["text"]; if (string.IsNullOrEmpty(strValue) == false) { ComboBoxStyle style; Enum.TryParse <ComboBoxStyle>(strStyle, out style); combobox.Text = strValue; if (combobox.Text != strValue) { combobox.Items.Add(strValue); combobox.Text = strValue; } } } }
static string GetTabComboBoxState(TabComboBox combobox) { Hashtable table = new Hashtable(); table["style"] = combobox.DropDownStyle.ToString(); table["text"] = combobox.Text; return(combobox.GetType().ToString() + ":" + StringUtil.BuildParameterString(table, ',', '=', "url")); }
// 根据左侧文字匹配 Items 中整行文字,如果有匹配的行,返回整行文字 static string GetLineText(TabComboBox combobox, string strLeft) { foreach (string s in combobox.Items) { if (StringUtil.HasHead(s, strLeft + "\t") == true) return s; } return null; }
public Item(AmazonSearchParametersControl container, ItemType itemType) { this.Container = container; this.ItemType = itemType; int nTopBlank = 0; // (int)this.Container.Font.GetHeight() + 2; label = new Label(); label.Dock = DockStyle.Fill; label.Size = new Size(70, 28); label.AutoSize = true; label.TextAlign = ContentAlignment.MiddleRight; label.Margin = new Padding(1, 0, 1, 0); if (this.ItemType == AmazonSearchParametersControl.ItemType.TextBox) { this.textBox = new TextBox(); textBox.BorderStyle = BorderStyle.None; textBox.Dock = DockStyle.Fill; textBox.MinimumSize = new Size(80, 24); // textBox_price.Multiline = true; textBox.Margin = new Padding(6, nTopBlank + 6, 6, 0); textBox.ForeColor = this.Container.tableLayoutPanel_content.ForeColor; } if (this.ItemType == AmazonSearchParametersControl.ItemType.ComboBox) { comboBox = new TabComboBox(); comboBox.RemoveRightPartAtTextBox = false; comboBox.DropDownStyle = ComboBoxStyle.DropDown; comboBox.FlatStyle = FlatStyle.Flat; comboBox.Dock = DockStyle.Fill; // comboBox.MaximumSize = new Size(150, 28); comboBox.Size = new Size(100, 28); comboBox.MinimumSize = new Size(50, 28); comboBox.DropDownHeight = 300; comboBox.DropDownWidth = 300; comboBox.ForeColor = this.Container.tableLayoutPanel_content.ForeColor; comboBox.Text = ""; comboBox.Margin = new Padding(6 - 4, nTopBlank + 6 - 2, 6, 2); } }
void DisposeChildControls() { if (label != null) { label.Dispose(); label = null; } if (textBox != null) { textBox.Dispose(); textBox = null; } if (comboBox != null) { comboBox.Dispose(); comboBox = null; } Container = null; }
static string GetTabComboBoxState(TabComboBox combobox) { Hashtable table = new Hashtable(); table["style"] = combobox.DropDownStyle.ToString(); table["text"] = combobox.Text; return combobox.GetType().ToString() + ":" + StringUtil.BuildParameterString(table); }
static void SetTabComboBoxState(TabComboBox combobox, string strText) { string strState = ""; if (IsType(strText, combobox, out strState) == false) return; if (string.IsNullOrEmpty(strState) == false) { Hashtable table = StringUtil.ParseParameters(strState); string strStyle = (string)table["style"]; string strValue = (string)table["text"]; if (string.IsNullOrEmpty(strValue) == false) { ComboBoxStyle style; Enum.TryParse<ComboBoxStyle>(strStyle, out style); combobox.Text = strValue; if (combobox.Text != strValue) { combobox.Items.Add(strValue); combobox.Text = strValue; } } } }