コード例 #1
0
        protected override void OnPaintBackground(PaintEventArgs e)
        {
            if (theme == null)
            {
                Rectangle r = this.ClientRectangle;
                r.Width--;
                r.Height--;

                e.Graphics.FillRectangle(Brushes.White, r);
                e.Graphics.DrawRectangle(Pens.Black, r);

                StringFormat sf = new StringFormat();
                sf.LineAlignment = StringAlignment.Center;
                sf.Alignment     = StringAlignment.Center;

                e.Graphics.DrawString("No Theme Loaded\r\n\r\nPlease Load One Using the ThemeFile Property", SystemFonts.DefaultFont, Brushes.Black, r, sf);

                sf.Dispose();

                return;
            }

            Rectangle rect = this.ClientRectangle;

            rect.Inflate(1, 1);

            ThemeKit.SetGraphicsQuality(e.Graphics);
            ThemeKit.DrawOrFill(elements.NormalBackground, e.Graphics, rect);
        }
コード例 #2
0
        protected override void OnNonClientAreaPaint(PaintEventArgs e)
        {
            if (theme == null)
            {
                Rectangle r = e.ClipRectangle;
                r.Width--;
                r.Height--;

                e.Graphics.FillRectangle(Brushes.LightGray, r);
                e.Graphics.DrawRectangle(Pens.Black, r);

                return;
            }

            ThemeKit.SetGraphicsQuality(e.Graphics);
            ThemeKit.DrawOrFill(elements.ActiveBorder, e.Graphics, e.ClipRectangle);

            if (elements.ShowIcon && (this.Icon != null))
            {
                e.Graphics.DrawIcon(this.Icon, elements.IconRect(e.ClipRectangle));
            }

            if (elements.ShowTitle)
            {
                Font f = new Font(elements.TitleFont, elements.TitleSize, (FontStyle)elements.TitleStyle);

                ThemeKit.DrawContent(this.Text, null, ContentAlignment.MiddleLeft, ContentAlignment.TopLeft, elements.NormalTitleText, e.Graphics, elements.TitleRect(e.ClipRectangle), f);
            }

            if (elements.CloseButton && this.ControlBox)
            {
                btnclose._Paint(e.Graphics, btnclose.Bounds);
            }

            if (elements.MaximizeButton && this.MaximizeBox)
            {
                btnmax._Paint(e.Graphics, btnmax.Bounds);
            }

            if (elements.MinimizeButton && this.MinimizeBox)
            {
                btnmin._Paint(e.Graphics, btnmin.Bounds);
            }
        }
コード例 #3
0
 protected override void OnPaint(PaintEventArgs e)
 {
     ThemeKit.SetGraphicsQuality(e.Graphics);
     DoPaint(new PaintEventArgs(e.Graphics, this.ClientRectangle));
 }