protected RadioButton (Generator generator, Type type, RadioButton controller, bool initialize = true) : base (generator, type, false) { Handler.Create (controller); if (initialize) Initialize (); }
void LogEvents(RadioButton control) { control.CheckedChanged += delegate { Log.Write(control, "CheckedChanged, Value: {0}, Checked: {1}", control.Text, control.Checked); }; }
protected virtual void LogEvents(RadioButton control) { control.CheckedChanged += delegate { Log.Write (control, "CheckedChanged"); }; LogEvents ((Control)control); }
void Init() { // radioButton_noProxy _radioButtonNoProxy = new RadioButton() { Text = AltStrRes.NotUseProxy }; _radioButtonNoProxy.CheckedChanged += delegate { if (_radioButtonNoProxy.Checked) { _groupBoxSetting.Enabled = false; } }; // radioButton_ieProxy _radioButtonIeProxy = new RadioButton(_radioButtonNoProxy) { Text = AltStrRes.UseSystemProxySetting }; _radioButtonIeProxy.CheckedChanged += delegate { if (_radioButtonIeProxy.Checked) { _groupBoxSetting.Enabled = false; } }; // radioButton_customProxy _radioButtonCustomProxy = new RadioButton(_radioButtonNoProxy) { Text = AltStrRes.UseCustomProxySetting }; _radioButtonCustomProxy.CheckedChanged += delegate { if (_radioButtonCustomProxy.Checked) { _groupBoxSetting.Enabled = true; } }; // textBox _textBoxProxyAddr = new TextBox(); _textBoxProxyPort = new TextBox(); _textBoxProxyUser = new TextBox(); _textBoxProxyPasswd = new TextBox(); _textBoxProxyDomain = new TextBox(); var proxysetting = new DynamicLayout { Padding = new Padding(20, 10), Spacing = new Size(5, 5) }; proxysetting.AddRow(new Label { Text = "Server: ", VerticalAlign = VerticalAlign.Middle}, TableLayout.AutoSized(_textBoxProxyAddr)); proxysetting.AddRow(new Label { Text = "Port: ", VerticalAlign = VerticalAlign.Middle }, TableLayout.AutoSized(_textBoxProxyPort)); proxysetting.AddRow(new Label { Text = "User: "******"Passwd: ", VerticalAlign = VerticalAlign.Middle }, TableLayout.AutoSized(_textBoxProxyPasswd)); proxysetting.AddRow(new Label { Text = "Domain: ", VerticalAlign = VerticalAlign.Middle }, TableLayout.AutoSized(_textBoxProxyDomain)); _groupBoxSetting = new GroupBox {Text = AltStrRes.Setting, Content = proxysetting}; var layout = new DynamicLayout { Padding = new Padding(20, 20), Spacing = new Size(10, 10) }; layout.AddRow(_radioButtonNoProxy); layout.AddRow(_radioButtonIeProxy); layout.AddRow(_radioButtonCustomProxy); layout.AddRow(_groupBoxSetting); layout.AddRow(null); this.Content = layout; }
Control Default() { var layout = new DynamicLayout(); var first = new RadioButton { Text = "First" }; var second = new RadioButton(first) { Text = "Second" }; var third = new RadioButton(first) { Text = "Third" }; layout.AddRow(first, second, third); LogEvents(first); LogEvents(second); LogEvents(third); return layout; }
Control SetInitialValue() { var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5) }; layout.BeginHorizontal(); RadioButton controller = null; for (int i = 0; i < 5; i++) { var item = new RadioButton(controller) { Text = "Item " + i, Checked = i == 2 }; controller = controller ?? item; LogEvents(item); layout.Add(item); } layout.EndHorizontal(); return layout; }
Control Disabled() { var layout = new DynamicLayout(); layout.BeginHorizontal(); RadioButton controller = null; for (int i = 0; i < 5; i++) { var item = new RadioButton(controller) { Text = "Item " + i, Checked = i == 2, Enabled = false }; controller = controller ?? item; LogEvents(item); layout.Add(item); } layout.EndHorizontal(); return layout; }
Control SetInitialValue() { var layout = new DynamicLayout(); layout.BeginHorizontal(); RadioButton controller = null; for (int i = 0; i < 5; i++) { var item = new RadioButton(controller) { Text = "Item " + i, Checked = i == 2 }; if (controller == null) controller = item; LogEvents(item); layout.Add(item); } layout.EndHorizontal(); return layout; }
void Init() { _textAreaInput = new TextArea(); _textAreaInput.Font = new Font(FontFamilies.Monospace, 10); _dropDownServices = new DropDown {Width = 200}; _dropDownServices.SelectedIndexChanged += DropDownServicesSelectedIndexChanged; _radioButtonEncode = new RadioButton {Text = "Encode"}; _radioButtonEncode.CheckedChanged += _radioButtonEncode_CheckedChanged; _radioButtonDecode = new RadioButton(_radioButtonEncode) {Text = "Decode"}; _buttonRun = new Button { Text = "Run" }; _buttonRun.Click += _buttonRun_Click; _textAreaOutput = new TextArea(); _textAreaOutput.Font = new Font(FontFamilies.Monospace, 10); var inputLayout = new DynamicLayout {Padding = new Padding(5, 5, 5, 0), Spacing = new Size(5, 5)}; inputLayout.AddSeparateRow(_textAreaInput); var outputLayout = new DynamicLayout {Padding = new Padding(5, 5), Spacing = new Size(5, 5)}; outputLayout.BeginVertical(); outputLayout.BeginHorizontal(); outputLayout.AddCentered(_radioButtonEncode, horizontalCenter: false); outputLayout.AddCentered(_radioButtonDecode, horizontalCenter: false); outputLayout.Add(null); outputLayout.AddCentered(_dropDownServices, horizontalCenter: false); outputLayout.AddCentered(_buttonRun, horizontalCenter: false); outputLayout.EndHorizontal(); outputLayout.EndVertical(); outputLayout.AddSeparateRow(_textAreaOutput); var layout = new Splitter { Panel1 = inputLayout, Panel2 = outputLayout, Orientation = SplitterOrientation.Vertical, Position = 130 }; Content = layout; }
public DynamicFocusSection() { var content = new Panel(); var focusControlCheckBox = new CheckBox { Text = "Focus Control", Checked = true }; var addContentButton = new Button { Text = "Add Control" }; var count = 0; addContentButton.Click += (sender, e) => { Control control; switch((count++) % 9) { case 0: control = new TextBox(); break; case 1: control = new TextArea(); break; case 2: control = new CheckBox { Text = "A Check Box" }; break; case 3: control = new RadioButton { Text = "A Radio Button" }; break; case 4: control = new DropDown { Items = { "Item 1", "Item 2", "Item 3" } }; break; case 5: control = new DateTimePicker(); break; case 6: control = new ColorPicker(); break; case 7: control = new PasswordBox(); break; case 8: control = new ListBox { Items = { "Item 1", "Item 2", "Item 3" } }; break; case 9: control = new PasswordBox(); break; default: throw new InvalidOperationException(); } if (focusControlCheckBox.Checked ?? false) control.Focus(); content.Content = new TableLayout( null, new Label { Text = string.Format("Control: {0}", control.GetType().Name) }, new TableRow(control), null ); }; Content = new TableLayout( new TableLayout(new TableRow(null, addContentButton, focusControlCheckBox, null)), content ); }
/// <summary> /// Initializes a new instance of the <see cref="Eto.Forms.RadioButton"/> class. /// </summary> /// <param name="controller">Controller radio button to link to, or null if no controller.</param> public RadioButton(RadioButton controller = null) { Handler.Create(controller); Initialize(); }
/// <summary> /// Raises the checked changed event. /// </summary> public void OnCheckedChanged(RadioButton widget, EventArgs e) { widget.OnCheckedChanged(e); }
/// <summary> /// Raises the click event. /// </summary> public void OnClick(RadioButton widget, EventArgs e) { widget.OnClick(e); }
public RadioButton (Generator g, RadioButton controller) : this (g, typeof(IRadioButton), controller) { }
public RadioButton (RadioButton controller = null) : this (Generator.Current, controller) { }
void UnregisterButton(RadioButton button) { button.CheckedChanged -= HandleCheckedChanged; }
public RadioButton (RadioButton controller = null, Generator generator = null) : this(generator, typeof(IRadioButton), controller) { }
Control RadioButtonControl() { var control = new RadioButton { Text = "RadioButton Control" }; LogEvents(control); return control; }
void Init() { // _textBoxFindText var labelFindText = new Label { Text = StrRes.GetString("StrFindContent", "FindContent") }; _textBoxFindText = new TextBox(); // _buttonFindNext _buttonFindNext = new Button { Text = StrRes.GetString("StrFindNext", "FindNext") }; _buttonFindNext.Click += _buttonFindNext_Click; // _buttonCancel _buttonCancel = new Button { Text = StrRes.GetString("StrCancel","Cancel") }; _buttonCancel.Click += _buttonCancel_Click; // _checkBoxCaseSensitive _checkBoxCaseSensitive = new CheckBox { Text = StrRes.GetString("StrCaseSensitive", "Case Sensitive") }; // _radio _radioButtonUp = new RadioButton { Text = StrRes.GetString("StrUp", "Up") }; _radioButtonDown = new RadioButton(_radioButtonUp) { Text = StrRes.GetString("StrDown", "Down") }; _radioButtonDown.Checked = true; var groupLayout = new DynamicLayout {Padding = new Padding(5, 5), Spacing = new Size(5, 5)}; groupLayout.AddRow(_radioButtonUp, _radioButtonDown); var group = new GroupBox { Text = StrRes.GetString("StrDirection", "Direction") }; group.Content = groupLayout; var layout = new DynamicLayout { Padding = new Padding(5, 5), Spacing = new Size(5, 5) }; layout.BeginHorizontal(); // left start ---> layout.BeginVertical(xscale: true); layout.BeginHorizontal(); layout.Add(labelFindText); layout.Add(_textBoxFindText); layout.EndHorizontal(); layout.Add(null); layout.BeginHorizontal(); layout.Add(_checkBoxCaseSensitive); layout.Add(group); layout.EndHorizontal(); layout.EndVertical(); // <--- left end // right start ---> layout.BeginVertical(xscale: false, yscale: false); layout.Add(_buttonFindNext); layout.Add(null); layout.Add(_buttonCancel); layout.EndVertical(); // <--- right end layout.EndHorizontal(); Content = layout; Title = StrRes.GetString("StrFind", "Find"); Minimizable = false; Maximizable = false; Topmost = true; ClientSize = new Size(350, 90); Resizable = false; }
public RadioButton(Generator g, RadioButton controller) : base(g, typeof(IRadioButton)) { inner = (IRadioButton)base.Handler; inner.Create (controller); }