public Add ( |
||
control | Control to add. | |
location | Point | The location of the control. |
Результат | void |
public SpacingSection () { var layout = new TableLayout (this, 3, 1); layout.Add (NoSpacing (), 0, 0, true, true); layout.Add (NoPadding (), 1, 0, true, true); layout.Add (DifferentSizes (), 2, 0, true, true); }
public WebViewSection () { var layout = new TableLayout (this, 1, 3); int row = 0; layout.Add (Buttons (), 0, row++); layout.Add (TitleLabel (), 0, row++); layout.Add (WebView (), 0, row++, true, true); }
Control MiddleSection() { middleTable = new TableLayout(1, 3); middleTable.Add(new Label { Text = "Content", BackgroundColor = Colors.LightGrey, HorizontalAlign = HorizontalAlign.Center, VerticalAlign = VerticalAlign.Middle }, 0, 1, true, true); middleTable.Add(topSection = new Panel(), 0, 0); return middleTable; }
Control MainTable() { mainTable = new TableLayout(3, 1); mainTable.Add(MiddleSection(), 1, 0, true, true); mainTable.Add(rightSection = new Panel(), 2, 0); return mainTable; }
Control MainTable() { mainTable = new TableLayout(3, 1); mainTable.Padding = new Padding(10); mainTable.Spacing = new Size(5, 5); mainTable.Add(MiddleSection(), 1, 0, true, true); mainTable.Add(rightSection = new Panel(), 2, 0); return mainTable; }
Control MiddleSection() { middleTable = new TableLayout(1, 3); middleTable.Padding = new Padding(10); middleTable.Spacing = new Size(5, 5); middleTable.Add(new Label { Text = "Content", BackgroundColor = Colors.LightGrey, TextAlignment = TextAlignment.Center, VerticalAlignment = VerticalAlignment.Center }, 0, 1, true, true); middleTable.Add(topSection = new Panel(), 0, 0); return middleTable; }
public SpacingSection() { var layout = new TableLayout(3, 1); layout.Spacing = new Size(5, 5); layout.Padding = new Padding(10); layout.Add(NoSpacing(), 0, 0, true, true); layout.Add(NoPadding(), 1, 0, true, true); layout.Add(DifferentSizes(), 2, 0, true, true); Content = layout; }
public ScrollableSection() { var layout = new TableLayout(4, 2); layout.Spacing = new Size(5, 5); layout.Padding = new Padding(10); layout.SetColumnScale(1); layout.SetColumnScale(3); layout.SetRowScale(0); layout.SetRowScale(1); layout.Add(new Label { Text = "Default" }, 0, 0); layout.Add(DefaultScrollable(), 1, 0); layout.Add(new Label { Text = "No Border" }, 2, 0); layout.Add(NoBorderScrollable(), 3, 0); layout.Add(new Label { Text = "Bezeled" }, 0, 1); layout.Add(BezelScrollable(), 1, 1); layout.Add(new Label { Text = "Line" }, 2, 1); layout.Add(LineScrollable(), 3, 1); Content = layout; }
public SessionCreator() { _session = new Session(); _session.Processes.Add(new PortManagerProcess()); _session.Processes.Add(new RouterProcess()); _session.Processes.Add(new HostProcess()); _session.Processes.Add(new DeviceFinderProcess ()); _session.Processes.Add(new NetworkDatabaseProcess()); var left = new TableLayout(1, 3); _processesList = new ListBox(); _processesList.Size = new Size(250, -1); _processesList.DataStore = _session.Processes; _processesList.SelectedValueChanged += _selectedProcessChanged; left.Add(_processesList, 0, 0); _portTypesCombo = new ComboBox(); foreach (var portType in PortType.All()) { _portTypesCombo.Items.Add(portType); } _addPortButton = new Button(); _addPortButton.Text = Constants.AddPortButtonText; _addPortButton.Click += _addPortButtonClicked; var newPortLayout = new DynamicLayout(); newPortLayout.Padding = Eto.Drawing.Padding.Empty; newPortLayout.AddRow(_portTypesCombo, _addPortButton); left.Add(newPortLayout, 0, 1); _contentPanel = new Panel(); _contentPanel.Content = new SessionSettings(_session); _createSessionButton = new Button(); _createSessionButton.Text = Constants.CreateSessionButtonText; _createSessionButton.Click += _createSessionButtonClicked; this.BeginVertical(padding:null, xscale: true, yscale: true); this.AddRow(left, _contentPanel); this.EndVertical(); this.BeginVertical(padding:null, xscale: true, yscale: false); this.AddRow(null, _createSessionButton); this.EndVertical(); }
public virtual void Generate (DynamicLayout layout, TableLayout parent, int x, int y) { var c = Generate (layout); if (c != null) parent.Add (c, x, y); if (XScale != null) parent.SetColumnScale (x, XScale.Value); if (YScale != null) parent.SetRowScale (y, YScale.Value); }
void FillTable (TableLayout layout) { for (int y = 0; y < layout.Size.Height - 1; y++) for (int x = 0; x < layout.Size.Width; x++) { var panel = new Panel { Size = SquareSize, BackgroundColor = (x+y*layout.Size.Width) % 2 == 0 ? Colors.Lime : Colors.Red }; layout.Add (panel, x, y); } }
public ScalingSection() { TableLayout tableLayout; var layout = new DynamicLayout(); var size = new Size(-1, 100); tableLayout = new TableLayout(1, 1) { BackgroundColor = Colors.Blue, Size = size }; tableLayout.Add(new Label { Text = "1x1, should scale to fill entire region with 5px padding around border", BackgroundColor = Colors.Red }, 0, 0, false, false); layout.Add(tableLayout, yscale: true); tableLayout = new TableLayout(2, 2) { BackgroundColor = Colors.Blue, Size = size }; tableLayout.Add(new Label { Text = "2x2, should scale with extra space on top & left", BackgroundColor = Colors.Red }, 1, 1, false, false); layout.Add(tableLayout, yscale: true); tableLayout = new TableLayout(2, 2) { BackgroundColor = Colors.Blue, Size = size }; tableLayout.Add(new Label { Text = "2x2, should scale with extra space on bottom & right", BackgroundColor = Colors.Red }, 0, 0, true, true); layout.Add(tableLayout, yscale: true); tableLayout = new TableLayout(3, 3) { BackgroundColor = Colors.Blue, Size = size }; tableLayout.Add(new Label { Text = "3x3, should scale with extra space all around (10px)", BackgroundColor = Colors.Red }, 1, 1, true, true); layout.Add(tableLayout, yscale: true); tableLayout = new TableLayout(2, 2) { BackgroundColor = Colors.Blue, Size = size }; tableLayout.Add(new Label { Text = "2x2, should not scale and be top left", BackgroundColor = Colors.Red }, 0, 0, false, false); layout.Add(tableLayout, yscale: true); tableLayout = new TableLayout(2, 2) { BackgroundColor = Colors.Blue, Size = size }; tableLayout.SetColumnScale(0); tableLayout.SetRowScale(0); tableLayout.Add(new Label { Text = "2x2, should not scale and be bottom-right", BackgroundColor = Colors.Red }, 1, 1); layout.Add(tableLayout, yscale: true); tableLayout = new TableLayout(3, 3) { BackgroundColor = Colors.Blue, Size = size }; tableLayout.SetColumnScale(0); tableLayout.SetRowScale(0); tableLayout.Add(new Label { Text = "3x3, should not scale and be bottom-right", BackgroundColor = Colors.Red }, 1, 1); layout.Add(tableLayout, yscale: true); tableLayout = new TableLayout(3, 3) { BackgroundColor = Colors.Blue, Size = size }; tableLayout.SetColumnScale(0); tableLayout.SetColumnScale(2); tableLayout.SetRowScale(0); tableLayout.SetRowScale(2); tableLayout.Add(new Label { Text = "2x2, should not scale and be centered", BackgroundColor = Colors.Red }, 1, 1); layout.Add(tableLayout, yscale: true); Content = layout; }
public static Control AutoSized(Control control, Padding?padding = null, bool centered = false) { var layout = new TableLayout(3, 3); layout.Padding = padding ?? Padding.Empty; layout.Spacing = Size.Empty; if (centered) { layout.SetColumnScale(0); layout.SetColumnScale(2); layout.SetRowScale(0); layout.SetRowScale(2); } layout.Add(control, 1, 1); return(layout); }
public ScalingSection () { TableLayout tableLayout; var layout = new DynamicLayout (this); var size = new Size (400, 100); tableLayout = new TableLayout (new Panel { BackgroundColor = Colors.Blue, Size = size }, 1, 1); tableLayout.Add (new Label { Text = "1x1, should scale to fill entire region (minus padding)", BackgroundColor = Colors.Red }, 0, 0, false, false); layout.Add (tableLayout.Container, yscale: true); tableLayout = new TableLayout (new Panel { BackgroundColor = Colors.Blue, Size = size }, 2, 2); tableLayout.Add (new Label { Text = "2x2, should scale", BackgroundColor = Colors.Red }, 1, 1, false, false); layout.Add (tableLayout.Container, yscale: true); tableLayout = new TableLayout (new Panel { BackgroundColor = Colors.Blue, Size = size }, 2, 2); tableLayout.Add (new Label { Text = "2x2, should scale", BackgroundColor = Colors.Red }, 0, 0, true, true); layout.Add (tableLayout.Container, yscale: true); tableLayout = new TableLayout (new Panel { BackgroundColor = Colors.Blue, Size = size }, 3, 3); tableLayout.Add (new Label { Text = "3x3, should scale", BackgroundColor = Colors.Red }, 1, 1, true, true); layout.Add (tableLayout.Container, yscale: true); tableLayout = new TableLayout (new Panel { BackgroundColor = Colors.Blue, Size = size }, 2, 2); tableLayout.Add (new Label { Text = "2x2, should not scale and be top left", BackgroundColor = Colors.Red }, 0, 0, false, false); layout.Add (tableLayout.Container, yscale: true); tableLayout = new TableLayout (new Panel { BackgroundColor = Colors.Blue, Size = size }, 2, 2); tableLayout.SetColumnScale (0); tableLayout.SetRowScale (0); tableLayout.Add (new Label { Text = "2x2, should not scale and be bottom-right", BackgroundColor = Colors.Red }, 1, 1); layout.Add (tableLayout.Container, yscale: true); tableLayout = new TableLayout (new Panel { BackgroundColor = Colors.Blue, Size = size }, 3, 3); tableLayout.SetColumnScale (0); tableLayout.SetRowScale (0); tableLayout.Add (new Label { Text = "2x2, should not scale and be bottom-right", BackgroundColor = Colors.Red }, 1, 1); layout.Add (tableLayout.Container, yscale: true); tableLayout = new TableLayout (new Panel { BackgroundColor = Colors.Blue, Size = size }, 3, 3); tableLayout.SetColumnScale (0); tableLayout.SetColumnScale (2); tableLayout.SetRowScale (0); tableLayout.SetRowScale (2); tableLayout.Add (new Label { Text = "2x2, should not scale and be centered", BackgroundColor = Colors.Red }, 1, 1); layout.Add (tableLayout.Container, yscale: true); }
public virtual void Generate(DynamicLayout layout, TableLayout parent, int x, int y) { var c = Generate(layout); if (c != null) { parent.Add(c, x, y); } if (XScale != null) { parent.SetColumnScale(x, XScale.Value); } if (YScale != null) { parent.SetRowScale(y, YScale.Value); } }
public ScrollableSection () { var layout = new TableLayout(this, 4, 2); layout.SetColumnScale (1); layout.SetColumnScale (3); layout.SetRowScale (0); layout.SetRowScale (1); layout.Add (new Label{ Text = "Default" }, 0, 0); layout.Add (DefaultScrollable(), 1, 0); layout.Add (new Label{ Text = "No Border" }, 2, 0); layout.Add (NoBorderScrollable (), 3, 0); layout.Add (new Label{ Text = "Bezeled" }, 0, 1); layout.Add (BezelScrollable (), 1, 1); layout.Add (new Label{ Text = "Line" }, 2, 1); layout.Add (LineScrollable (), 3, 1); }
Control Buttons() { var layout = new TableLayout (new Panel (), 7, 1); int col = 0; layout.Add (BackButton (), col++, 0); layout.Add (ForwardButton (), col++, 0); layout.Add (LoadHtmlButton (), col++, 0); layout.Add (ReloadButton (), col++, 0); layout.Add (StopButton (), col++, 0); layout.Add (ExecuteScriptButton (), col++, 0); layout.SetColumnScale (col++); return layout.Container; }
/// <summary> /// Creates a table layout with an auto sized control. /// </summary> /// <remarks> /// Since controls fill an entire cell, you can use this method to create a layout that will ensure that the /// specified <paramref name="control"/> gets its preferred size instead of stretching to fill the container. /// /// By default, extra space will be added to the right and bottom, unless <paramref name="centered"/> is <c>true</c>, /// which will add equal space to the top/bottom, and left/right. /// </remarks> /// <returns>The table layout with the auto sized control.</returns> /// <param name="control">Control to auto size.</param> /// <param name="padding">Padding around the control</param> /// <param name="centered">If set to <c>true</c> center the control, otherwise control is upper left of the container.</param> public static TableLayout AutoSized(Control control, Padding? padding = null, bool centered = false) { if (centered) { var layout = new TableLayout(3, 3); layout.Padding = padding ?? Padding.Empty; layout.Spacing = Size.Empty; layout.SetColumnScale(0); layout.SetColumnScale(2); layout.SetRowScale(0); layout.SetRowScale(2); layout.Add(control, 1, 1); return layout; } else { var layout = new TableLayout(2, 2); layout.Padding = padding ?? Padding.Empty; layout.Spacing = Size.Empty; layout.Add(control, 0, 0); return layout; } }
Control StatusBar() { var font = new Font(SystemFont.StatusBar); var layout = new TableLayout(3, 1) { Size = new Size(Size.Width, 18), Spacing = new Size(5, 5), Padding = new Padding(5, 0) }; layout.Add(_showMsgLabel = new Label { Text = "Ready", Font = font }, 0, 0); layout.Add(null, 1, 0); var version = string.Format("Version: {0}@KeePwn", Assembly.GetExecutingAssembly().GetName().Version); layout.Add(new Label { Text = version, Font = font, HorizontalAlign = HorizontalAlign.Right }, 2, 0); return layout; }
Control CreateButtons() { var table = new TableLayout(3, 3); CheckBox top, right, bottom, left; table.Add(top = new CheckBox { Text = "Top", BackgroundColor = Colors.Blue }, 1, 0, true, true); table.Add(right = new CheckBox { Text = "Right", BackgroundColor = Colors.Red }, 2, 1, true, true); table.Add(bottom = new CheckBox { Text = "Bottom", BackgroundColor = Colors.Blue }, 1, 2, true, true); table.Add(left = new CheckBox { Text = "Left", BackgroundColor = Colors.Red }, 0, 1, true, true); top.CheckedChanged += (s, e) => Anchor = Flip(Anchor, Anchor.Top); right.CheckedChanged += (s, e) => Anchor = Flip(Anchor, Anchor.Right); bottom.CheckedChanged += (s, e) => Anchor = Flip(Anchor, Anchor.Bottom); left.CheckedChanged += (s, e) => Anchor = Flip(Anchor, Anchor.Left); return table; }
private void Init() { _textBoxInput = new TextBox { Size = new Size(200, -1) }; _buttonOnline = new Button { Text = "Online Query", Size = new Size(150, -1) }; _buttonOnline.Click += _buttonOnline_Click; _buttonOffline = new Button { Text = "Offline Query", Size = new Size(150, -1) }; _buttonOffline.Click += _buttonOffline_Click; var cellPadding = new Padding(1, 1, 1, 1); var cellPaddingLeft = new Padding(1, 1, 0, 1); var cellPaddingRight = new Padding(0, 1, 1, 1); _labelA = ColumnContent(""); _labelB = ColumnContent(""); _labelC = ColumnContent(""); _labelD = ColumnContent(""); _labelE = ColumnContent(""); _labelF = ColumnContent(""); _otherTable = new TableLayout(3, 5); //{ BackgroundColor = Colors.Black }; //row1 _otherTable.Add(new Panel { Content = ColumnTitle("From Taobao"), Padding = new Padding(1, 0, 0, 0) }, 0, 1, true, false); _otherTable.Add(new Panel { Content = ColumnTitle("From Tencent") }, 1, 1, true, false); _otherTable.Add(new Panel { Content = ColumnTitle("From Sina"), Padding = new Padding(0, 0, 1, 0) }, 2, 1, true, false); //row2 _otherTable.Add(new Panel { Content = _labelA, Padding = cellPaddingLeft }, 0, 2, true, true); _otherTable.Add(new Panel { Content = _labelB, Padding = cellPaddingLeft }, 1, 2, true, true); _otherTable.Add(new Panel { Content = _labelC, Padding = cellPadding }, 2, 2, true, true); //row3 //_otherTable.Add(new Panel { Content = ColumnTitle("From IPB"), Padding = new Padding(1, 0, 0, 0) }, 0, 3, true, false); //_otherTable.Add(new Panel { Content = ColumnTitle("From Cz88") }, 1, 3, true, false); //_otherTable.Add(new Panel { Content = ColumnTitle("From MaxMind GeoLite2"), Padding = new Padding(0, 0, 1, 0) }, 2, 3, true, false); //row4 //_otherTable.Add(new Panel { Content = _labelD, Padding = cellPaddingLeft }, 0, 4, true, true); //_otherTable.Add(new Panel { Content = _labelE, Padding = cellPaddingLeft }, 1, 4, true, true); //_otherTable.Add(new Panel { Content = _labelF, Padding = cellPadding }, 2, 4, true, true); _mainTable = new TableLayout(1, 2) {BackgroundColor = Colors.LightGrey}; _mainTable.Add(new Panel { Content = _lableIp = new Label { Text = "", Font = new Font(FontFamilies.Sans, 20), VerticalAlign = VerticalAlign.Middle, HorizontalAlign = HorizontalAlign.Center, Size = new Size(-1, 100), BackgroundColor = Colors.White }, Padding = cellPadding }, 0, 0, true, false); _mainTable.Add(_otherTable, 0, 1, true, true); var layout = new DynamicLayout { Padding = new Padding(10, 10), Spacing = new Size(5, 5) }; layout.BeginVertical(); layout.BeginHorizontal(); layout.AddCentered(_textBoxInput); layout.Add(_buttonOnline); layout.Add(_buttonOffline); layout.Add(null); layout.AddCentered(new Label { Text = "Data from 17mon.cn" }); layout.EndHorizontal(); layout.EndVertical(); layout.Add(_mainTable); Content = layout; }
Control DifferentSizes () { var layout = new TableLayout (new Panel { BackgroundColor = Colors.Blue }, 3, 5); // row 1 layout.Add (new Panel { Size = new Size (10, 10), BackgroundColor = Colors.Lime }, 0, 0); layout.Add (new Panel { Size = new Size (30, 10), BackgroundColor = Colors.Red }, 1, 0); layout.Add (new Panel { Size = new Size (10, 30), BackgroundColor = Colors.Lime }, 2, 0); // row 2 layout.Add (new Panel { Size = new Size (30, 10), BackgroundColor = Colors.Red }, 0, 1); layout.Add (new Panel { Size = new Size (10, 30), BackgroundColor = Colors.Lime }, 1, 1); layout.Add (new Panel { Size = new Size (10, 10), BackgroundColor = Colors.Red }, 2, 1); // row 3 layout.Add (new Panel { Size = new Size (30, 30), BackgroundColor = Colors.Lime }, 0, 2); layout.Add (new Panel { Size = new Size (20, 20), BackgroundColor = Colors.Red }, 1, 2); layout.Add (new Panel { Size = new Size (10, 10), BackgroundColor = Colors.Lime }, 2, 2); // row 3 layout.Add (new Panel { Size = new Size (10, 10), BackgroundColor = Colors.Red }, 0, 3); layout.Add (new Panel { Size = new Size (20, 20), BackgroundColor = Colors.Lime }, 1, 3); layout.Add (new Panel { Size = new Size (30, 30), BackgroundColor = Colors.Red }, 2, 3); return layout.Container; }
public static Control AutoSized (Control control, Padding? padding = null, bool centered = false) { var layout = new TableLayout(new Panel(), 3, 3); layout.Padding = padding ?? Padding.Empty; layout.Spacing = Size.Empty; if (centered) { layout.SetColumnScale (0); layout.SetColumnScale (2); layout.SetRowScale (0); layout.SetRowScale (2); } layout.Add (control, 1, 1); return layout.Container; }
Control DifferentSizes() { var layout = new TableLayout(3, 4) { BackgroundColor = Colors.Blue, Spacing = new Size(5, 5) }; // row 1 layout.Add(new Panel { Size = new Size(10, 10), BackgroundColor = Colors.Lime }, 0, 0); layout.Add(new Panel { Size = new Size(30, 10), BackgroundColor = Colors.Red }, 1, 0); layout.Add(new Panel { Size = new Size(10, 30), BackgroundColor = Colors.Lime }, 2, 0); // row 2 layout.Add(new Panel { Size = new Size(30, 10), BackgroundColor = Colors.Red }, 0, 1); layout.Add(new Panel { Size = new Size(10, 30), BackgroundColor = Colors.Lime }, 1, 1); layout.Add(new Panel { Size = new Size(10, 10), BackgroundColor = Colors.Red }, 2, 1); // row 3 layout.Add(new Panel { Size = new Size(30, 30), BackgroundColor = Colors.Lime }, 0, 2); layout.Add(new Panel { Size = new Size(20, 20), BackgroundColor = Colors.Red }, 1, 2); layout.Add(new Panel { Size = new Size(10, 10), BackgroundColor = Colors.Lime }, 2, 2); // row 4 layout.Add(new Panel { Size = new Size(10, 10), BackgroundColor = Colors.Red }, 0, 3); layout.Add(new Panel { Size = new Size(20, 20), BackgroundColor = Colors.Lime }, 1, 3); layout.Add(new Panel { Size = new Size(30, 30), BackgroundColor = Colors.Red }, 2, 3); return layout; }
public static Control AutoSized(Control control, Padding? padding = null) { var layout = new TableLayout(new Panel(), 2, 2); layout.Padding = padding ?? Padding.Empty; layout.Spacing = Size.Empty; layout.Add (control, 0, 0); return layout.Container; }