public SetRowScale ( int row, bool scale = true ) : void | ||
row | int | Row to set the scale for. |
scale | bool | If set to |
리턴 | void |
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; }
Control NoPadding() { var layout = new TableLayout(3, 3) { BackgroundColor = Colors.Blue }; layout.Padding = Padding.Empty; layout.Spacing = new Size(20, 20); // scale first and last column layout.SetColumnScale(0); layout.SetColumnScale(2); // scale first and last row layout.SetRowScale(0); layout.SetRowScale(2); FillTable(layout); return new Panel { Content = layout, BackgroundColor = Colors.Blue }; }
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); }
Control NoSpacing() { var layout = new TableLayout(3, 3) { BackgroundColor = Colors.Blue }; layout.Padding = new Padding(10); layout.Spacing = Size.Empty; layout.SetColumnScale(1); // scale middle column layout.SetRowScale(1); // scale middle row FillTable(layout); return layout; }
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); }
/// <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; } }
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 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; }