Ejemplo n.º 1
0
        /// <summary>
        /// Returns the copy of the style.
        /// </summary>
        /// <returns>Copy of the style.</returns>
        public void CopyTo(VisualStyle copy)
        {
            base.CopyTo(copy);

            copy.TextColor = _TextColor;

            if (_Background != null)
                copy.Background = _Background.Copy();

            if (_BorderColor != null)
                copy.BorderColor = _BorderColor.Copy();

            if (_BorderPattern != null)
                copy.BorderPattern = _BorderPattern.Copy();

            if (_BorderPattern != null)
                copy.BorderPattern = _BorderPattern.Copy();

            if (_BorderThickness != null)
                copy.BorderThickness = _BorderThickness.Copy();

            if (_Font != null)
                copy.Font = (Font)_Font.Clone();

            if (_Margin != null)
                copy.Margin = _Margin.Copy();

            if (_Padding != null)
                copy.Padding = _Padding.Copy();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Applies the style to instance of this style.
        /// </summary>
        /// <param name="style">Style to apply.</param>
        public void ApplyStyle(VisualStyle style)
        {
            if (style != null)
            {
                base.ApplyStyle(style);

                if (style._Background != null && style._Background.IsEmpty == false)
                    Background = style._Background.Copy();

                if (style._BorderColor != null && style._BorderColor.IsEmpty == false)
                    BorderColor = style._BorderColor;

                if (style._BorderPattern != null && style._BorderPattern.IsEmpty == false)
                    BorderPattern.ApplyPattern(style._BorderPattern);

                if (style._BorderThickness != null && style._BorderThickness.IsZero == false)
                    BorderThickness = style._BorderThickness.Copy();

                if (style.Font != null)
                    Font = style.Font;

                if (style._Margin != null && style._Margin.IsEmpty == false)
                    Margin = style.Margin.Copy();

                if (style._Padding != null && style._Padding.IsEmpty == false)
                    Padding = style.Padding.Copy();

                if (style._TextColor.IsEmpty == false)
                    TextColor = style._TextColor;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Returns the copy of the style.
        /// </summary>
        /// <returns>Copy of the style.</returns>
        public new VisualStyle Copy()
        {
            VisualStyle style = new VisualStyle();

            CopyTo(style);

            return (style);
        }
Ejemplo n.º 4
0
 private void RenderBackground(Graphics g,
     VisualStyle style, Rectangle r)
 {
     using (Brush br = style.Background.GetBrush(r))
         g.FillRectangle(br, r);
 }