private void button_CheckedChanged(object sender, EventArgs e) { NomadRadioButton nomadRadioButton = (NomadRadioButton)sender; object value = ((ParamEnumButtons.Item)nomadRadioButton.Tag).Value; if (nomadRadioButton.Checked && this.m_value != value) { this.OnValueChanged(value); } }
public void UpdateUI() { base.SuspendLayout(); this.ClearUI(); foreach (ParamEnumButtons.Item current in this.m_itemList) { NomadRadioButton nomadRadioButton = new NomadRadioButton(); nomadRadioButton.Appearance = Appearance.Button; nomadRadioButton.AutoSize = true; nomadRadioButton.Margin = new Padding(1); nomadRadioButton.Checked = current.Value.Equals(this.Value); nomadRadioButton.Image = current.Image; if (current.Image == null) { nomadRadioButton.Text = current.Name; } nomadRadioButton.CheckedChanged += new EventHandler(this.button_CheckedChanged); nomadRadioButton.Tag = current; MainForm.Instance.ToolTip.SetToolTip(nomadRadioButton, current.Name); this.flowLayoutPanel.Controls.Add(nomadRadioButton); this.m_buttonList.Add(current, nomadRadioButton); } base.ResumeLayout(); }