SetColumnScale() public method

Sets the scale for the specified column.
public SetColumnScale ( int column, bool scale = true ) : void
column int Column to set the scale for.
scale bool If set to true scale, otherwise size to preferred size of controls in the column.
return void
Ejemplo n.º 1
0
		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;
		}
Ejemplo n.º 2
0
		Control NoPadding ()
		{
			var layout = new TableLayout (new Panel { BackgroundColor = Colors.Blue }, 3, 4);
			layout.Padding = Padding.Empty;
			layout.Spacing = new Size (20, 20);
			layout.SetColumnScale (0); // scale first and last column
			layout.SetColumnScale (2); // scale first and last column
			FillTable (layout);
			return layout.Container;
		}
Ejemplo n.º 3
0
		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 };
		}
Ejemplo n.º 4
0
		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;
		}
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
		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);
		}
Ejemplo n.º 7
0
		Control NoSpacing ()
		{
			var layout = new TableLayout (new Panel { BackgroundColor = Colors.Blue }, 3, 4);
			layout.Padding = new Padding (10);
			layout.Spacing = Size.Empty;
			layout.SetColumnScale (1); // scale middle column
			FillTable (layout);
			return layout.Container;
		}
Ejemplo n.º 8
0
		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);
		}
Ejemplo n.º 9
0
		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;
		}
Ejemplo n.º 10
0
		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);
		}
Ejemplo n.º 11
0
		/// <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;
			}
		}
Ejemplo n.º 12
0
        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;
        }
Ejemplo n.º 13
0
        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);
            }
        }
Ejemplo n.º 14
0
		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;
		}