Esempio n. 1
0
        public HeaderPanel()
            : base()
        {
            InitializeComponent();

            this.Font = new Font(SystemFonts.CaptionFont,
                                                    SystemFonts.CaptionFont.Style);
            this.mfnt_CaptionFont = this.Font;

            this.mstr_CaptionText = this.GetType().Name;
            this.mint_CaptionHeight = SystemInformation.CaptionHeight;
            this.mclr_CaptionBeginColor = Color.FromKnownColor(KnownColor.InactiveCaption);
            this.mclr_CaptionEndColor = Color.FromKnownColor(KnownColor.ActiveCaption);
            this.menm_CaptionGradientMode = LinearGradientMode.Vertical;
            this.menm_CaptionPosition = HeaderPanelCaptionPositions.Top;

            this.menm_BorderStyle = HeaderPanelBorderStyles.Shadow;
            base.BorderStyle = 0;
            this.mclr_BorderColor = Color.FromKnownColor(KnownColor.ActiveCaption);

            this.mclr_StartColor = Color.FromKnownColor(KnownColor.Window);
            this.mclr_EndColor = Color.FromKnownColor(KnownColor.Window);
            this.menm_GradientMode = LinearGradientMode.Vertical;

            this.SetStyle(ControlStyles.ResizeRedraw, true);
            this.SetStyle(ControlStyles.UserPaint, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.DoubleBuffer, true);
        }
Esempio n. 2
0
        private void DrawBackground(PaintEventArgs peArgs, HeaderPanelBorderStyles brdStyle)
        {
            LinearGradientBrush brsh = null;

            try
            {
                if (menm_BorderStyle == HeaderPanelBorderStyles.Shadow)
                {
                    brsh = new LinearGradientBrush(new Rectangle(0, 0, Width - DEFAULT_SHADOW_WIDTH,
                                                                 Height - DEFAULT_SHADOW_WIDTH), mclr_StartColor,
                                                   mclr_EndColor, menm_GradientMode);
                    peArgs.Graphics.FillRectangle(brsh, 0, 0,
                                                  Width - DEFAULT_SHADOW_WIDTH,
                                                  Height - DEFAULT_SHADOW_WIDTH);
                }
                else
                {
                    brsh = new LinearGradientBrush(new Rectangle(0, 0, Width,
                                                                 Height), mclr_StartColor,
                                                   mclr_EndColor, menm_GradientMode);
                    peArgs.Graphics.FillRectangle(brsh, 0, 0, Width, Height);
                }
            }
            finally
            {
                if (brsh != null)
                {
                    brsh.Dispose();
                    brsh = null;
                }
            }
        }
Esempio n. 3
0
        public HeaderPanel()
            : base()
        {
            InitializeComponent();

            this.Font = new Font(SystemFonts.CaptionFont,
                                 SystemFonts.CaptionFont.Style);
            this.mfnt_CaptionFont = this.Font;

            this.mstr_CaptionText         = this.GetType().Name;
            this.mint_CaptionHeight       = SystemInformation.CaptionHeight;
            this.mclr_CaptionBeginColor   = Color.FromKnownColor(KnownColor.InactiveCaption);
            this.mclr_CaptionEndColor     = Color.FromKnownColor(KnownColor.ActiveCaption);
            this.menm_CaptionGradientMode = LinearGradientMode.Vertical;
            this.menm_CaptionPosition     = HeaderPanelCaptionPositions.Top;

            this.menm_BorderStyle = HeaderPanelBorderStyles.Shadow;
            base.BorderStyle      = 0;
            this.mclr_BorderColor = Color.FromKnownColor(KnownColor.ActiveCaption);

            this.mclr_StartColor   = Color.FromKnownColor(KnownColor.Window);
            this.mclr_EndColor     = Color.FromKnownColor(KnownColor.Window);
            this.menm_GradientMode = LinearGradientMode.Vertical;

            this.SetStyle(ControlStyles.ResizeRedraw, true);
            this.SetStyle(ControlStyles.UserPaint, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.DoubleBuffer, true);
        }
Esempio n. 4
0
        private void DrawBackground(PaintEventArgs peArgs, HeaderPanelBorderStyles brdStyle)
        {
            LinearGradientBrush brsh = null;

            try
            {
                if (menm_BorderStyle == HeaderPanelBorderStyles.Shadow)
                {
                    brsh = new LinearGradientBrush(new Rectangle(0, 0, Width - DEFAULT_SHADOW_WIDTH,
                                                                                    Height - DEFAULT_SHADOW_WIDTH), mclr_StartColor,
                                                                                    mclr_EndColor, menm_GradientMode);
                    peArgs.Graphics.FillRectangle(brsh, 0, 0,
                                                                                    Width - DEFAULT_SHADOW_WIDTH,
                                                                                    Height - DEFAULT_SHADOW_WIDTH);
                }
                else
                {
                    brsh = new LinearGradientBrush(new Rectangle(0, 0, Width,
                                                                                    Height), mclr_StartColor,
                                                                                    mclr_EndColor, menm_GradientMode);
                    peArgs.Graphics.FillRectangle(brsh, 0, 0, Width, Height);
                }
            }
            finally
            {
                if (brsh != null)
                {
                    brsh.Dispose();
                    brsh = null;
                }
            }
        }