Ejemplo n.º 1
0
        protected void ResetMargins()
        {
            PanelMargins panelMargins = (PanelMargins)this.GetDefaultPropertyValue("Margins", this.Margins);

            this.margins.Top    = panelMargins.Top;
            this.margins.Bottom = panelMargins.Bottom;
            this.margins.Left   = panelMargins.Left;
            this.margins.Right  = panelMargins.Right;
        }
Ejemplo n.º 2
0
        protected bool ShouldSerializeMargins()
        {
            PanelMargins panelMargins = (PanelMargins)this.GetDefaultPropertyValue("Margins", this.Margins);

            if (this.Margins.Top == panelMargins.Top && this.Margins.Bottom == panelMargins.Bottom && this.Margins.Left == panelMargins.Left && this.Margins.Right == panelMargins.Right)
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 3
0
        public 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);
        }
 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));
 }
Ejemplo n.º 5
0
 private void AdjustAutoOrientationForDocking(PanelDockStyle dockStyle)
 {
     if (this.Orientation == Orientation.Auto)
     {
         if (this.GetOrientation() != Orientation.Vertical || (dockStyle != PanelDockStyle.Bottom && dockStyle != PanelDockStyle.Top))
         {
             if (this.GetOrientation() != 0)
             {
                 return;
             }
             if (dockStyle != PanelDockStyle.Left && dockStyle != PanelDockStyle.Right)
             {
                 return;
             }
         }
         MapSize      size          = new MapSize(this, this.Size.Height, this.Size.Width);
         PanelMargins panelMargins2 = base.Margins = new PanelMargins(base.Margins.Bottom, base.Margins.Right, base.Margins.Top, base.Margins.Left);
         this.Size = size;
     }
 }
Ejemplo n.º 6
0
 public PanelMargins(PanelMargins margins)
     : this(margins.Owner, margins.Left, margins.Top, margins.Right, margins.Bottom)
 {
 }