private Control.Layout.GridLayout CreateGrid(ControlBase parent) { Control.Layout.GridLayout grid = new Control.Layout.GridLayout(parent); grid.SetColumnWidths(0.2f, Control.Layout.GridLayout.AutoSize, 140.0f, 0.8f); grid.SetRowHeights(0.2f, Control.Layout.GridLayout.AutoSize, 140.0f, 0.8f); CreateControl(grid, "C: 20%, R: 20%"); CreateControl(grid, "C: Auto R: 20%"); CreateControl(grid, "C: 140, R: 20%"); CreateControl(grid, "C: 80%, R: 20%"); CreateControl(grid, "C: 20%, R: Auto"); CreateControl(grid, "C: Auto R: Auto"); CreateControl(grid, "C: 140, R: Auto"); CreateControl(grid, "C: 80%, R: Auto"); CreateControl(grid, "C: 20%, R: 140"); CreateControl(grid, "C: Auto R: 140"); CreateControl(grid, "C: 140, R: 140"); CreateControl(grid, "C: 80%, R: 140"); CreateControl(grid, "C: 20%, R: 80%"); CreateControl(grid, "C: Auto R: 80%"); CreateControl(grid, "C: 140, R: 80%"); CreateControl(grid, "C: 80%, R: 80%"); return(grid); }
public XsdWriting(ControlBase parent) : base(parent) { Control.Layout.GridLayout layout = new Control.Layout.GridLayout(this); layout.VerticalAlignment = VerticalAlignment.Top; layout.VerticalAlignment = VerticalAlignment.Stretch; layout.SetColumnWidths(Control.Layout.GridLayout.Fill); layout.SetRowHeights(30.0f, Control.Layout.GridLayout.Fill); Control.Button button1 = new Control.Button(layout); button1.Text = "Write Xsd File "; button1.Clicked += WriteXsd; button1.Width = 100; button1.HorizontalAlignment = HorizontalAlignment.Left; xsdContent = new Control.MultilineTextBox(layout); }
public CommonDialogs(ControlBase parent) : base(parent) { Control.Layout.GridLayout grid = new Control.Layout.GridLayout(this); grid.Dock = Dock.Fill; grid.SetColumnWidths(Control.Layout.GridLayout.AutoSize, Control.Layout.GridLayout.Fill); Control.Button button; { Control.Label openFile = null; button = new Control.Button(grid); button.Margin = Margin.Five; button.Text = "OpenFileDialog"; button.Clicked += (sender, args) => { openFile.Text = ""; OpenFileDialog dialog = Component.Create <OpenFileDialog>(this); dialog.InitialFolder = "C:\\"; dialog.Filters = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"; dialog.Callback = (path) => openFile.Text = path != null ? path : "Cancelled"; }; openFile = new Control.Label(grid); openFile.TextPadding = new Padding(3, 0, 0, 0); openFile.Alignment = Alignment.Left | Alignment.CenterV; } { Control.Label saveFile = null; button = new Control.Button(grid); button.Margin = Margin.Five; button.Text = "SaveFileDialog"; button.Clicked += (sender, args) => { saveFile.Text = ""; SaveFileDialog dialog = Component.Create <SaveFileDialog>(this); dialog.Callback = (path) => saveFile.Text = path != null ? path : "Cancelled"; }; saveFile = new Control.Label(grid); saveFile.TextPadding = new Padding(3, 0, 0, 0); saveFile.Alignment = Alignment.Left | Alignment.CenterV; } { Control.Label createFile = null; button = new Control.Button(grid); button.Margin = Margin.Five; button.Text = "SaveFileDialog (create)"; button.Clicked += (sender, args) => { createFile.Text = ""; SaveFileDialog dialog = Component.Create <SaveFileDialog>(this); dialog.Title = "Create File"; dialog.OkButtonText = "Create"; dialog.Callback = (path) => createFile.Text = path != null ? path : "Cancelled"; }; createFile = new Control.Label(grid); createFile.TextPadding = new Padding(3, 0, 0, 0); createFile.Alignment = Alignment.Left | Alignment.CenterV; } { Control.Label selectFolder = null; button = new Control.Button(grid); button.Margin = Margin.Five; button.Text = "FolderBrowserDialog"; button.Clicked += (sender, args) => { selectFolder.Text = ""; FolderBrowserDialog dialog = Component.Create <FolderBrowserDialog>(this); dialog.InitialFolder = "C:\\"; dialog.Callback = (path) => selectFolder.Text = path != null ? path : "Cancelled"; }; selectFolder = new Control.Label(grid); selectFolder.TextPadding = new Padding(3, 0, 0, 0); selectFolder.Alignment = Alignment.Left | Alignment.CenterV; } }
ControlBase CreateControls(Control.ControlBase subject, Dock docking, string name, ControlBase container) { Control.GroupBox gb = new Control.GroupBox(container); gb.Text = name; { HorizontalLayout hlayout = new HorizontalLayout(gb); { Control.GroupBox dgb = new Control.GroupBox(hlayout); dgb.Text = "Dock"; { Control.RadioButtonGroup dock = new RadioButtonGroup(dgb); dock.UserData = subject; dock.AddOption("Left", null, Dock.Left); dock.AddOption("Top", null, Dock.Top); dock.AddOption("Right", null, Dock.Right); dock.AddOption("Bottom", null, Dock.Bottom); dock.AddOption("Fill", null, Dock.Fill); dock.SelectByUserData(docking); dock.SelectionChanged += DockChanged; } VerticalLayout vlayout = new VerticalLayout(hlayout); { HorizontalLayout hlayout2 = new HorizontalLayout(vlayout); { Control.GroupBox hgb = new Control.GroupBox(hlayout2); hgb.Text = "H. Align"; { Control.RadioButtonGroup halign = new RadioButtonGroup(hgb); halign.UserData = subject; halign.AddOption("Left", null, HorizontalAlignment.Left); halign.AddOption("Center", null, HorizontalAlignment.Center); halign.AddOption("Right", null, HorizontalAlignment.Right); halign.AddOption("Stretch", null, HorizontalAlignment.Stretch); halign.SelectByUserData(subject.HorizontalAlignment); halign.SelectionChanged += HAlignChanged; } Control.GroupBox vgb = new Control.GroupBox(hlayout2); vgb.Text = "V. Align"; { Control.RadioButtonGroup valign = new RadioButtonGroup(vgb); valign.UserData = subject; valign.AddOption("Top", null, VerticalAlignment.Top); valign.AddOption("Center", null, VerticalAlignment.Center); valign.AddOption("Bottom", null, VerticalAlignment.Bottom); valign.AddOption("Stretch", null, VerticalAlignment.Stretch); valign.SelectByUserData(subject.VerticalAlignment); valign.SelectionChanged += VAlignChanged; } } Control.Layout.GridLayout glayout = new Control.Layout.GridLayout(vlayout); glayout.SetColumnWidths(Control.Layout.GridLayout.AutoSize, Control.Layout.GridLayout.Fill); { Control.Label l_width = new Control.Label(glayout); l_width.Text = "Width:"; Control.HorizontalSlider width = new HorizontalSlider(glayout); width.Name = "Width"; width.UserData = subject; width.Min = 50; width.Max = 350; width.Value = 100; width.ValueChanged += WidthChanged; Control.Label l_height = new Control.Label(glayout); l_height.Text = "Height:"; Control.HorizontalSlider height = new Control.HorizontalSlider(glayout); height.Name = "Height"; height.UserData = subject; height.Min = 50; height.Max = 350; height.Value = 100; height.ValueChanged += HeightChanged; Control.Label l_margin = new Control.Label(glayout); l_margin.Text = "Margin:"; Control.HorizontalSlider margin = new HorizontalSlider(glayout); margin.Name = "Margin"; margin.UserData = subject; margin.Min = 0; margin.Max = 50; margin.Value = 0; margin.ValueChanged += MarginChanged; } } } } return(gb); }