protected void ResetMargins() { PanelMargins panelMargins = (PanelMargins)GetDefaultPropertyValue("Margins", Margins); margins.Top = panelMargins.Top; margins.Bottom = panelMargins.Bottom; margins.Left = panelMargins.Left; margins.Right = panelMargins.Right; }
private void AdjustAutoOrientationForDocking(PanelDockStyle dockStyle) { if (Orientation == Orientation.Auto && ((GetOrientation() == Orientation.Vertical && (dockStyle == PanelDockStyle.Bottom || dockStyle == PanelDockStyle.Top)) || (GetOrientation() == Orientation.Horizontal && (dockStyle == PanelDockStyle.Left || dockStyle == PanelDockStyle.Right)))) { MapSize size = new MapSize(this, Size.Height, Size.Width); PanelMargins panelMargins2 = base.Margins = new PanelMargins(base.Margins.Bottom, base.Margins.Right, base.Margins.Top, base.Margins.Left); Size = size; } }
protected bool ShouldSerializeMargins() { PanelMargins panelMargins = (PanelMargins)GetDefaultPropertyValue("Margins", Margins); if (Margins.Top == panelMargins.Top && Margins.Bottom == panelMargins.Bottom && Margins.Left == panelMargins.Left && Margins.Right == panelMargins.Right) { return(false); } return(true); }
internal virtual object GetDefaultPropertyValue(string prop, object currentValue) { object result = null; switch (prop) { case "Margins": result = new PanelMargins(5, 5, 5, 5); break; case "Location": result = new MapLocation(null, 0f, 0f); break; case "LocationUnit": result = CoordinateUnit.Percent; break; case "Size": result = new MapSize(null, 200f, 100f); break; case "SizeUnit": result = CoordinateUnit.Pixel; break; case "BackColor": result = Color.White; break; case "BorderColor": result = Color.DarkGray; break; case "BorderWidth": result = 1; break; case "BackGradientType": result = GradientType.DiagonalLeft; break; case "BackHatchStyle": result = MapHatchStyle.None; break; case "BackSecondaryColor": result = Color.FromArgb(230, 230, 230); break; } return(result); }
internal Panel(CommonElements common) : base(common) { Margins = new PanelMargins((PanelMargins)GetDefaultPropertyValue("Margins", null)); Location = new MapLocation((MapLocation)GetDefaultPropertyValue("Location", null)); LocationUnit = (CoordinateUnit)GetDefaultPropertyValue("LocationUnit", null); Size = new MapSize((MapSize)GetDefaultPropertyValue("Size", null)); SizeUnit = (CoordinateUnit)GetDefaultPropertyValue("SizeUnit", null); BackColor = (Color)GetDefaultPropertyValue("BackColor", null); BorderColor = (Color)GetDefaultPropertyValue("BorderColor", null); BorderWidth = (int)GetDefaultPropertyValue("BorderWidth", null); BackGradientType = (GradientType)GetDefaultPropertyValue("BackGradientType", null); BackHatchStyle = (MapHatchStyle)GetDefaultPropertyValue("BackHatchStyle", null); BackSecondaryColor = (Color)GetDefaultPropertyValue("BackSecondaryColor", null); }
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == null) { throw new ArgumentNullException(SR.no_destination_type); } if (value is PanelMargins && destinationType == typeof(string)) { PanelMargins panelMargins = (PanelMargins)value; if (culture == null) { culture = CultureInfo.CurrentCulture; } string listSeparator = culture.TextInfo.ListSeparator; return(string.Format(culture, "{1}{0} {2}{0} {3}{0} {4}", listSeparator, panelMargins.Left.ToString(culture), panelMargins.Top.ToString(culture), panelMargins.Right.ToString(culture), panelMargins.Bottom.ToString(culture))); } return(base.ConvertTo(context, culture, value, destinationType)); }
internal PanelMargins(PanelMargins margins) : this(margins.Owner, margins.Left, margins.Top, margins.Right, margins.Bottom) { }