public SliderTest(ControlBase parent) : base(parent) { TableLayout table = new TableLayout(parent); table.ColumnCount = 2; // table.Dock = Dock.Fill; table.Width = 500; table.Height = 500; var row = table.CreateRow(); // Gwen.Controls.sl VerticalSlider slider = new VerticalSlider(row.GetCell(0)); slider.Tooltip = "val"; slider.SetRange(0, 100); //row.AutoSizeToContents = true; HorizontalSlider slider2 = new HorizontalSlider(row.GetCell(1)); slider2.Width = 100; slider2.SetRange(0, 100); row = table.CreateRow(); slider = new VerticalSlider(row.GetCell(0)); slider.NotchCount = 10; slider.ValueChanged += (o, e) => { var sl = (Slider)o; Console.WriteLine(sl.Value); }; slider.SnapToNotches = true; slider.SetRange(0, 100); //row.AutoSizeToContents = true; slider2 = new HorizontalSlider(row.GetCell(1)); slider2.SnapToNotches = true; slider2.Width = 100; slider2.SetRange(-100, 100); slider2.NotchCount = 15; slider2.SnapToNotches = true; slider2.Tooltip = "I have notches but theyre hidden"; slider2.DrawNotches = false; row = table.CreateRow(); slider2 = new HorizontalSlider(row.GetCell(1)); slider2.SnapToNotches = true; slider2.Disable(); slider2.Width = 100; slider2.SetRange(-100, 100); slider2.NotchCount = 15; slider2.SnapToNotches = true; slider2.Tooltip = "I have notches but theyre hidden"; slider2.DrawNotches = false; }
private void CreateTable(ControlBase container) { TableLayout sp = new TableLayout(container); sp.AutoSizeRows = false; // sp.DrawDebugOutlines = true; sp.AutoSizeToContents = true; sp.Dock = Dock.Fill; var row = sp.CreateRow(); CreateButton(row.GetCell(0), "autosize").Clicked += (o, e) => { sp.AutoSizeRows = true; var txt = ((Button)o).Text; if (txt == "short") { txt = "much longer"; } else { txt = "short"; } ((Button)o).Text = txt; }; CreateButton(row.GetCell(1), "Test 2"); row = sp.CreateRow(); CreateButton(row.GetCell(0), "Test 3 --"); var b = CreateButton(row.GetCell(1), "Tall 4"); b.SizeToChildren(); b.AutoSizeToContents = false; b.Height = 50; row = sp.CreateRow(); CreateButton(row.GetCell(0), "no auto").Clicked += (o, e) => { sp.AutoSizeRows = false; sp.SetColumnWidth(0, 20); }; row = sp.CreateRow(); row.SetCell(CreateButton(null, "Test 6"), 1); }
private void CreateCheckables() { var row = _layout.CreateRow(); var box = new Checkbox(row.GetCell(0)); row = _layout.CreateRow(); box = new Checkbox(row.GetCell(0)) { Text = "Checked", IsChecked = true }; row = _layout.CreateRow(); box = new Checkbox(row.GetCell(0)) { Text = "Checkbox", IsChecked = false }; row = _layout.CreateRow(); box = new Checkbox(row.GetCell(0)) { Text = "Disabled", IsChecked = false, IsDisabled = true, }; box = new Checkbox(row.GetCell(1)) { Text = "Disabled", IsChecked = true, IsDisabled = true, }; row = _layout.CreateRow(); var radiogroup = new RadioButtonGroup(row.GetCell(0)); radiogroup.AddOption("Radio 1").Tooltip = "tooltip 1"; radiogroup.AddOption("Radio 2").Tooltip = "tooltip 2"; var dc = radiogroup.AddOption("disabledChecked"); dc.IsChecked = true; dc.Disable(); radiogroup.AddOption("disabled").Disable(); row = _layout.CreateRow(); var radio = new RadioButton(row.GetCell(0)) { Text = "ungrouped 1", Dock = Dock.Top }; radio = new RadioButton(row.GetCell(0)) { Text = "ungrouped 2", Dock = Dock.Top }; }
private void Create() { _layout = new TableLayout(Parent) { AutoSizeRows = true, Dock = Dock.Fill, ColumnCount = 2, //DrawDebugOutlines = true }; var btn = CreateButton("auto sized button (hover me)"); btn.AutoSizeToContents = true; btn.Tooltip = "With tooltip"; btn = CreateButton("Auto sized padding button"); btn.Padding = new Gwen.Padding(10, 10, 10, 10); btn.AutoSizeToContents = true; btn = CreateButton("Event Test Button"); btn.Padding = new Gwen.Padding(10, 10, 10, 10); btn.AutoSizeToContents = true; btn.Clicked += (o, e) => { Console.WriteLine("Clicked"); }; btn.DoubleClicked += (o, e) => { Console.WriteLine("Double Clicked"); }; btn.Pressed += (o, e) => { Console.WriteLine("Pressed"); }; btn.Released += (o, e) => { Console.WriteLine("Released"); }; btn = CreateButton("manual sized button"); btn.Width += 100; btn.AutoSizeToContents = false; btn.AutoSizeToContents = false; btn = CreateButton("disabled"); btn.IsDisabled = true; btn = CreateButton("toggle"); btn.IsToggle = true; btn.Toggle(); btn = CreateButton("left aligned button"); btn.Width = 150; btn.AutoSizeToContents = false; btn.Alignment = Gwen.Pos.Left | Gwen.Pos.CenterV; btn = CreateButton("right align button."); btn.Width = 150; btn.Alignment = Gwen.Pos.Right | Gwen.Pos.CenterV; btn.AutoSizeToContents = false; var row = _layout.CreateRow(); btn = new DropDownButton(row.GetCell(0)) { Text = "Drop me" }; CreateCheckables(); }