public Button(Base parent) : base(parent) { buttonA = new Control.Button(this); buttonA.Text = "Event tester"; buttonA.SetBounds(200, 30, 300, 200); buttonA.Pressed += onButtonAp; buttonA.Clicked += onButtonAc; buttonA.Released += onButtonAr; buttonB = new Control.Button(this); buttonB.Text = "\u0417\u0430\u043C\u0435\u0436\u043D\u0430\u044F \u043C\u043E\u0432\u0430"; buttonB.SetPosition(0, 20); buttonC = new Control.Button(this); buttonC.Text = "Image button"; buttonC.SetImage("test16.png"); Align.PlaceDownLeft(buttonC, buttonB, 10); buttonD = new Control.Button(this); buttonD.SetImage("test16.png"); buttonD.SetSize(20, 20); Align.PlaceDownLeft(buttonD, buttonC, 10); buttonE = new Control.Button(this); buttonE.Text = "Toggle me"; buttonE.IsToggle = true; buttonE.Toggled += onToggle; buttonE.ToggledOn += onToggleOn; buttonE.ToggledOff += onToggleOff; Align.PlaceDownLeft(buttonE, buttonD, 10); buttonF = new Control.Button(this); buttonF.Text = "Disabled :D"; buttonF.IsDisabled = true; Align.PlaceDownLeft(buttonF, buttonE, 10); buttonG = new Control.Button(this); buttonG.Text = "With Tooltip"; buttonG.SetToolTipText("This is tooltip"); Align.PlaceDownLeft(buttonG, buttonF, 10); buttonH = new Control.Button(this); buttonH.Text = "I'm autosized"; buttonH.SizeToContents(); Align.PlaceDownLeft(buttonH, buttonG, 10); }
public Button(ControlBase parent) : base(parent) { buttonA = new Control.Button(this); buttonA.Text = "Event tester"; buttonA.SetBounds(200, 30, 300, 200); buttonA.Pressed += onButtonAp; buttonA.Clicked += onButtonAc; buttonA.Released += onButtonAr; buttonB = new Control.Button(this); buttonB.Text = "\u0417\u0430\u043C\u0435\u0436\u043D\u0430\u044F \u043C\u043E\u0432\u0430"; buttonB.SetPosition(0, 20); buttonC = new Control.Button(this); buttonC.Text = "Image button"; buttonC.SetImage("test16.png"); Align.PlaceDownLeft(buttonC, buttonB, 10); buttonD = new Control.Button(this); buttonD.SetImage("test16.png"); buttonD.SetSize(20, 20); Align.PlaceDownLeft(buttonD, buttonC, 10); buttonE = new Control.Button(this); buttonE.Text = "Toggle me"; buttonE.IsToggle = true; buttonE.Toggled += onToggle; buttonE.ToggledOn += onToggleOn; buttonE.ToggledOff += onToggleOff; Align.PlaceDownLeft(buttonE, buttonD, 10); buttonF = new Control.Button(this); buttonF.Text = "Disabled :D"; buttonF.IsDisabled = true; Align.PlaceDownLeft(buttonF, buttonE, 10); buttonG = new Control.Button(this); buttonG.Text = "With Tooltip"; buttonG.SetToolTipText("This is tooltip"); Align.PlaceDownLeft(buttonG, buttonF, 10); buttonH = new Control.Button(this); buttonH.Text = "I'm autosized"; buttonH.SizeToContents(); Align.PlaceDownLeft(buttonH, buttonG, 10); }
public FlowLayout(ControlBase parent) : base(parent) { ControlBase layout = new Control.Layout.DockLayout(this); Control.Layout.FlowLayout flowLayout = new Control.Layout.FlowLayout(layout); flowLayout.Width = 200; flowLayout.Padding = Padding.Five; flowLayout.Dock = Dock.Fill; flowLayout.DrawDebugOutlines = true; { Control.Button button; int buttonNum = 1; const int buttonCount = 10; for (int n = 0; n < buttonCount; n++) { button = new Control.Button(flowLayout); button.VerticalAlignment = VerticalAlignment.Top; button.HorizontalAlignment = HorizontalAlignment.Left; button.Margin = Margin.Five; button.Padding = Padding.Five; button.ShouldDrawBackground = false; button.Text = String.Format("Button {0}", buttonNum++); button.SetImage("test16.png", ImageAlign.Above); } } Control.HorizontalSlider flowLayoutWidth = new HorizontalSlider(layout); flowLayoutWidth.Margin = Margin.Five; flowLayoutWidth.Width = 500; flowLayoutWidth.Dock = Dock.Top; flowLayoutWidth.Min = 50; flowLayoutWidth.Max = 500; flowLayoutWidth.Value = flowLayout.Width; flowLayoutWidth.ValueChanged += (control, args) => { flowLayout.Width = (int)flowLayoutWidth.Value; }; }
public Button(ControlBase parent) : base(parent) { HorizontalLayout hlayout = new HorizontalLayout(this); { VerticalLayout vlayout = new VerticalLayout(hlayout); vlayout.Width = 300; { Gwen.Control.Button button; button = new Control.Button(vlayout); button.Margin = Margin.Five; button.Text = "Button"; button = new Control.Button(vlayout); button.Margin = Margin.Five; button.Padding = Padding.Three; button.Text = "Image button (default)"; button.SetImage("test16.png"); button = new Control.Button(vlayout); button.Margin = Margin.Five; button.Padding = Padding.Three; button.Text = "Image button (above)"; button.SetImage("test16.png", ImageAlign.Above); button = new Control.Button(vlayout); button.Margin = Margin.Five; button.Padding = Padding.Three; button.Alignment = Alignment.Left | Alignment.CenterV; button.Text = "Image button (left)"; button.SetImage("test16.png"); button = new Control.Button(vlayout); button.Margin = Margin.Five; button.Padding = Padding.Three; button.Alignment = Alignment.Right | Alignment.CenterV; button.Text = "Image button (right)"; button.SetImage("test16.png"); button = new Control.Button(vlayout); button.Margin = Margin.Five; button.Padding = Padding.Three; button.Text = "Image button (image left)"; button.SetImage("test16.png", ImageAlign.Left | ImageAlign.CenterV); button = new Control.Button(vlayout); button.Margin = Margin.Five; button.Padding = Padding.Three; button.Text = "Image button (image right)"; button.SetImage("test16.png", ImageAlign.Right | ImageAlign.CenterV); button = new Control.Button(vlayout); button.Margin = Margin.Five; button.Padding = Padding.Three; button.Text = "Image button (image fill)"; button.SetImage("test16.png", ImageAlign.Fill); HorizontalLayout hlayout2 = new HorizontalLayout(vlayout); { button = new Control.Button(hlayout2); button.HorizontalAlignment = HorizontalAlignment.Left; button.Padding = Padding.Three; button.Margin = Margin.Five; button.SetImage("test16.png"); button.ImageSize = new Size(32, 32); button = new Control.Button(hlayout2); button.HorizontalAlignment = HorizontalAlignment.Left; button.VerticalAlignment = VerticalAlignment.Center; button.Padding = Padding.Three; button.Margin = Margin.Five; button.SetImage("test16.png"); button = new Control.Button(hlayout2); button.HorizontalAlignment = HorizontalAlignment.Left; button.VerticalAlignment = VerticalAlignment.Center; button.Padding = Padding.Three; button.Margin = Margin.Five; button.SetImage("test16.png"); button.ImageTextureRect = new Rectangle(4, 4, 8, 8); button = new Control.Button(hlayout2); button.HorizontalAlignment = HorizontalAlignment.Left; button.VerticalAlignment = VerticalAlignment.Center; button.Padding = Padding.Three; button.Margin = Margin.Five; button.SetImage("test16.png"); button.ImageColor = Color.DarkGrey; } button = new Control.Button(vlayout); button.Margin = Margin.Five; button.Padding = new Padding(20, 20, 20, 20); button.Text = "Toggle me"; button.IsToggle = true; button.Toggled += onToggle; button.ToggledOn += onToggleOn; button.ToggledOff += onToggleOff; button = new Control.Button(vlayout); button.Margin = Margin.Five; button.Padding = Padding.Three; button.Text = "Disabled"; button.IsDisabled = true; button = new Control.Button(vlayout); button.Margin = Margin.Five; button.Padding = Padding.Three; button.Text = "With Tooltip"; button.SetToolTipText("This is tooltip"); button = new Control.Button(vlayout); button.Margin = Margin.Five; button.Padding = Padding.Three; button.Text = "Autosized"; button.HorizontalAlignment = HorizontalAlignment.Left; } { Control.Button button = new Control.Button(hlayout); button.Margin = Margin.Five; button.Padding = Padding.Three; button.Text = "Event tester"; button.Size = new Size(300, 200); button.Pressed += onButtonAp; button.Clicked += onButtonAc; button.Released += onButtonAr; } } }