public void AddYesNoRadioParameter(BoolFormBuilderField field) { this.AddLabelInNewRow(field); Panel panel = new Panel {Dock = DockStyle.Top, Size = new Size(371, 49)}; RadioButton radioButton1 = new RadioButton { AutoSize = true, Dock = DockStyle.Left, Font = new Font("Arial", 9.75F, FontStyle.Regular, GraphicsUnit.Point, 177), TabStop = true, Text = @"Yes", UseVisualStyleBackColor = true, Enabled = !field.Readonly }; RadioButton radioButton2 = new RadioButton { AutoSize = true, Dock = DockStyle.Left, Font = new Font("Arial", 9.75F, FontStyle.Regular, GraphicsUnit.Point, 177), TabStop = true, Text = @"No", UseVisualStyleBackColor = true, Enabled = !field.Readonly }; panel.Controls.Add(radioButton2); panel.Controls.Add(radioButton1); panel.Enabled = !field.Readonly; if (field.Value) radioButton1.Checked = true; else radioButton2.Checked = true; radioButton1.CheckedChanged += (sender, args) => field.Value = radioButton1.Checked; this.AddControl(panel); }
public void VisitBoolField(BoolFormBuilderField field) { this.form.AddYesNoRadioParameter(field); }