Exemple #1
0
        protected override void OnRenderSeparator(ToolStripSeparatorRenderEventArgs e)
        {
            Rectangle rect = new Rectangle(0, 0, e.Item.Width, e.Item.Height);

            if (cms != null)
            {
                ThemeKit.DrawOrFill(cms.theme.Seperator, e.Graphics, rect);
            }
            else if (ts != null)
            {
                if (e.Item is ToolStripMenuItem)
                {
                    ThemeKit.DrawOrFill(ts.theme.MenuSeperator, e.Graphics, rect);
                }
            }
            else if (ss != null)
            {
                if (e.Item is ToolStripMenuItem)
                {
                    ThemeKit.DrawOrFill(ss.theme.MenuSeperator, e.Graphics, rect);
                }
            }
            else if (ms != null)
            {
                if (e.Item is ToolStripMenuItem)
                {
                    ThemeKit.DrawOrFill(ms.theme.MenuSeperator, e.Graphics, rect);
                }
            }
        }
Exemple #2
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);
        }
Exemple #3
0
        protected override void DoPaint(PaintEventArgs e)
        {
            if (Width * Height <= 0)
            {
                return;
            }

            ThemeKit.DrawOrFill(elements.NormalBackground, e.Graphics, this.ClientRectangle);
        }
Exemple #4
0
        protected override void DoPaint(PaintEventArgs e)
        {
            ThemeKit.DrawOrFill(theme.NormalBackground, e.Graphics, e.ClipRectangle);

            int       pw    = (int)((float)((float)val / (float)(max - min)) * (float)e.ClipRectangle.Width);
            Rectangle prect = new Rectangle(e.ClipRectangle.X, e.ClipRectangle.Y, pw, e.ClipRectangle.Height);

            ThemeKit.DrawOrFill(theme.NormalProgress, e.Graphics, prect);
        }
Exemple #5
0
        protected override void DoPaint(PaintEventArgs e)
        {
            Rectangle rect     = e.ClipRectangle;
            Rectangle boxrect  = new Rectangle(rect.Left, rect.Top + ((rect.Height - theme.BoxHeight) / 2), theme.BoxWidth, theme.BoxHeight);
            Rectangle textrect = new Rectangle(boxrect.Right, rect.Top, rect.Width - boxrect.Width, rect.Height);

            Font fnt = SystemFonts.DefaultFont;

            if (!this.Enabled)
            {
                if (check)
                {
                    ThemeKit.DrawOrFill(theme.DisabledCheckedBackground, e.Graphics, rect);
                    ThemeKit.DrawOrFill(theme.DisabledCheckedBox, e.Graphics, boxrect);
                    ThemeKit.DrawContent(text, null, ContentAlignment.MiddleLeft, ContentAlignment.TopLeft, theme.DisabledCheckedText, e.Graphics, textrect, fnt);
                }
                else
                {
                    ThemeKit.DrawOrFill(theme.DisabledUncheckedBackground, e.Graphics, rect);
                    ThemeKit.DrawOrFill(theme.DisabledUncheckedBox, e.Graphics, boxrect);
                    ThemeKit.DrawContent(text, null, ContentAlignment.MiddleLeft, ContentAlignment.TopLeft, theme.DisabledUncheckedText, e.Graphics, textrect, fnt);
                }
            }
            else
            {
                if (mouseover)
                {
                    if (check)
                    {
                        ThemeKit.DrawOrFill(theme.OverCheckedBackground, e.Graphics, rect);
                        ThemeKit.DrawOrFill(theme.OverCheckedBox, e.Graphics, boxrect);
                        ThemeKit.DrawContent(text, null, ContentAlignment.MiddleLeft, ContentAlignment.TopLeft, theme.OverCheckedText, e.Graphics, textrect, fnt);
                    }
                    else
                    {
                        ThemeKit.DrawOrFill(theme.OverUncheckedBackground, e.Graphics, rect);
                        ThemeKit.DrawOrFill(theme.OverUncheckedBox, e.Graphics, boxrect);
                        ThemeKit.DrawContent(text, null, ContentAlignment.MiddleLeft, ContentAlignment.TopLeft, theme.OverUncheckedText, e.Graphics, textrect, fnt);
                    }
                }
                else
                {
                    if (check)
                    {
                        ThemeKit.DrawOrFill(theme.NormalCheckedBackground, e.Graphics, rect);
                        ThemeKit.DrawOrFill(theme.NormalCheckedBox, e.Graphics, boxrect);
                        ThemeKit.DrawContent(text, null, ContentAlignment.MiddleLeft, ContentAlignment.TopLeft, theme.NormalCheckedText, e.Graphics, textrect, fnt);
                    }
                    else
                    {
                        ThemeKit.DrawOrFill(theme.NormalUncheckedBackground, e.Graphics, rect);
                        ThemeKit.DrawOrFill(theme.NormalUncheckedBox, e.Graphics, boxrect);
                        ThemeKit.DrawContent(text, null, ContentAlignment.MiddleLeft, ContentAlignment.TopLeft, theme.NormalUncheckedText, e.Graphics, textrect, fnt);
                    }
                }
            }
        }
Exemple #6
0
        protected override void DoPaint(PaintEventArgs e)
        {
            Rectangle rect = this.ClientRectangle;

            ThemeKit.DrawOrFill(elements.NormalBackground, e.Graphics, rect);
            ThemeKit.DrawOrFill(elements.OverBackground, e.Graphics, rect, overfadeprogress);
            ThemeKit.DrawOrFill(elements.DownBackground, e.Graphics, rect, downfadeprogress);

            if (dropdown != null)
            {
                switch (dropdownpos)
                {
                case DropDownPosition.Bottom:
                    rect.Height -= dropdownsize;
                    break;

                case DropDownPosition.Left:
                    rect.Offset(dropdownsize, 0);
                    rect.Width -= dropdownsize;
                    break;

                case DropDownPosition.Right:
                    rect.Width -= dropdownsize;
                    break;

                case DropDownPosition.Top:
                    rect.Offset(0, dropdownsize);
                    rect.Height -= dropdownsize;
                    break;
                }

                ThemeKit.DrawOrFill(elements.NormalBackground, e.Graphics, rect);
                ThemeKit.DrawOrFill(elements.OverBackground, e.Graphics, rect, overfadeprogress);
                ThemeKit.DrawOrFill(elements.DownBackground, e.Graphics, rect, downfadeprogress);
            }

            Image img = null;

            if (this.Image != null)
            {
                img = this.Image;
            }
            else if (this.ImageList != null && this.ImageIndex > -1)
            {
                img = this.ImageList.Images[this.ImageIndex];
            }

            ThemeKit.DrawContent(this.Text, img, TextAlign, ImageAlign, elements.NormalText, e.Graphics, rect, this.Font);
            ThemeKit.DrawContent(this.Text, img, TextAlign, ImageAlign, elements.OverText, e.Graphics, rect, this.Font, overfadeprogress);
            ThemeKit.DrawContent(this.Text, img, TextAlign, ImageAlign, elements.DownText, e.Graphics, rect, this.Font, downfadeprogress);
        }
Exemple #7
0
        protected override void DoPaint(PaintEventArgs e)
        {
            Image img = null;

            if (this.Image != null)
            {
                img = this.Image;
            }
            else if (this.ImageList != null && this.ImageIndex > -1)
            {
                img = this.ImageList.Images[this.ImageIndex];
            }

            ThemeKit.DrawContent(this.Text, img, TextAlign, ImageAlign, elements.NormalText, e.Graphics, this.ClientRectangle, this.Font);
        }
Exemple #8
0
        protected override void DoPaint(PaintEventArgs e)
        {
            if (theme.NormalText.Length > 0 && theme.NormalText[0].Colors.Length > 0)
            {
                tb.ForeColor = theme.NormalText[0].Colors[0];
            }

            if (theme.NormalBackground.Length > 0 && theme.NormalBackground[0].Colors.Length > 0)
            {
                tb.ForeColor = theme.NormalText[0].Colors[0];
            }

            e.Graphics.FillRectangle(new SolidBrush(tb.BackColor), e.ClipRectangle);

            ThemeKit.DrawOrFill(theme.NormalBorder, e.Graphics, e.ClipRectangle);
        }
Exemple #9
0
        protected override void DoPaint(PaintEventArgs e)
        {
            if (!this.Enabled)
            {
                if (type == CapBtnType.Close)
                {
                    ThemeKit.DrawOrFill(elements.CloseButtonDisabled, e.Graphics, e.ClipRectangle);
                }
                else if (type == CapBtnType.Maximize)
                {
                    ThemeKit.DrawOrFill(elements.MaximizeButtonDisabled, e.Graphics, e.ClipRectangle);
                }
                else
                {
                    ThemeKit.DrawOrFill(elements.MinimizeButtonDisabled, e.Graphics, e.ClipRectangle);
                }
            }
            else
            {
                if (type == CapBtnType.Close)
                {
                    ThemeKit.DrawOrFill(elements.CloseButtonNormal, e.Graphics, e.ClipRectangle);
                }
                else if (type == CapBtnType.Maximize)
                {
                    ThemeKit.DrawOrFill(elements.MaximizeButtonNormal, e.Graphics, e.ClipRectangle);
                }
                else
                {
                    ThemeKit.DrawOrFill(elements.MinimizeButtonNormal, e.Graphics, e.ClipRectangle);
                }

                if (type == CapBtnType.Close)
                {
                    ThemeKit.DrawOrFill(elements.CloseButtonOver, e.Graphics, e.ClipRectangle, overfadeprogress);
                }
                else if (type == CapBtnType.Maximize)
                {
                    ThemeKit.DrawOrFill(elements.MaximizeButtonOver, e.Graphics, e.ClipRectangle, overfadeprogress);
                }
                else
                {
                    ThemeKit.DrawOrFill(elements.MinimizeButtonOver, e.Graphics, e.ClipRectangle, overfadeprogress);
                }
            }
        }
Exemple #10
0
        void PaintItem(int i, object item, Rectangle bounds, Graphics g)
        {
            if (i == selectedindex)
            {
                ThemeKit.DrawOrFill(theme.SelectedItemBackground, g, bounds);
            }
            else if (i == overindex)
            {
                ThemeKit.DrawOrFill(theme.OverItemBackrgound, g, bounds);
            }
            else
            {
                ThemeKit.DrawOrFill(theme.NormalItemBackground, g, bounds);
            }

            ThemeKit.DrawContent(item.ToString(), null, ContentAlignment.MiddleLeft, ContentAlignment.TopLeft, theme.NormalItemText, g, bounds, font);
        }
Exemple #11
0
        protected override void DoPaint(PaintEventArgs e)
        {
            if (Width * Height <= 0)
            {
                return;
            }

            Rectangle r = this.ClientRectangle;

            r.Inflate(1, 1);
            ThemeKit.DrawOrFill(theme.NormalBackground, e.Graphics, r);

            if (bounds.Width > 0)
            {
                Rectangle linerect = new Rectangle(bounds.Left, -1, bounds.Width, 1);
                ThemeKit.DrawOrFill(theme.NormalSelectedTabBorder, e.Graphics, linerect);
            }
        }
Exemple #12
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);
            }
        }
Exemple #13
0
        protected override void DoPaint(PaintEventArgs e)
        {
            if (Orientation == ThemeScrollBarOrientation.Vertical)
            {
                ThemeKit.DrawOrFill(VerticalNormalBackground, e.Graphics, e.ClipRectangle);
                ThemeKit.DrawOrFill(VerticalOverBackground, e.Graphics, e.ClipRectangle, overfadeprogress);
                ThemeKit.DrawOrFill(VerticalDownBackground, e.Graphics, e.ClipRectangle, downfadeprogress);

                Rectangle upbtnrect   = new Rectangle(e.ClipRectangle.Left, e.ClipRectangle.Top, e.ClipRectangle.Width, VerticalUpButtonSize);
                Rectangle dwnbtnrect  = new Rectangle(e.ClipRectangle.Left, e.ClipRectangle.Bottom - VerticalDownButtonSize, e.ClipRectangle.Width, VerticalDownButtonSize);
                Rectangle bararearect = new Rectangle(e.ClipRectangle.Left, e.ClipRectangle.Top + VerticalUpButtonSize, e.ClipRectangle.Width, e.ClipRectangle.Height - VerticalUpButtonSize - VerticalDownButtonSize);

                ThemeKit.DrawOrFill(VerticalNormalUpButton, e.Graphics, upbtnrect);


                ThemeKit.DrawOrFill(VerticalNormalDownButton, e.Graphics, dwnbtnrect);
            }
            else if (Orientation == ThemeScrollBarOrientation.Horizontal)
            {
            }
        }
Exemple #14
0
 protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e)
 {
     if (cms != null)
     {
         ThemeKit.DrawOrFill(cms.theme.NormalBackground, e.Graphics, e.AffectedBounds);
     }
     else if (ss != null)
     {
         if (e.ToolStrip is ToolStripDropDownMenu)
         {
             ThemeKit.DrawOrFill(ss.theme.MenuNormalBackground, e.Graphics, e.AffectedBounds);
         }
         else
         {
             ThemeKit.DrawOrFill(ss.theme.NormalBackground, e.Graphics, e.AffectedBounds);
         }
     }
     else if (ts != null)
     {
         if (e.ToolStrip is ToolStripDropDownMenu)
         {
             ThemeKit.DrawOrFill(ts.theme.MenuNormalBackground, e.Graphics, e.AffectedBounds);
         }
         else
         {
             ThemeKit.DrawOrFill(ts.theme.NormalBackground, e.Graphics, e.AffectedBounds);
         }
     }
     else if (ms != null)
     {
         if (e.ToolStrip is ToolStripDropDownMenu)
         {
             ThemeKit.DrawOrFill(ms.theme.MenuNormalBackground, e.Graphics, e.AffectedBounds);
         }
         else
         {
             ThemeKit.DrawOrFill(ms.theme.NormalBackground, e.Graphics, e.AffectedBounds);
         }
     }
 }
Exemple #15
0
        protected override void DoPaint(PaintEventArgs e)
        {
            if (Width * Height <= 0)
            {
                return;
            }

            Rectangle labelrect = new Rectangle();
            Rectangle rect      = new Rectangle();

            switch (labelpos)
            {
            case LabelPosition.Top:
                labelrect = new Rectangle(0, 0, this.Width, labelsize);
                rect      = new Rectangle(0, labelsize, this.Width, this.Height - labelsize);
                break;

            case LabelPosition.Bottom:
                labelrect = new Rectangle(0, this.Height - labelsize, this.Width, labelsize);
                rect      = new Rectangle(0, 0, this.Width, this.Height - labelsize);
                break;

            case LabelPosition.Left:
                labelrect = new Rectangle(0, 0, labelsize, this.Height);
                rect      = new Rectangle(labelsize, 0, this.Width - labelsize, this.Height);
                break;

            case LabelPosition.Right:
                labelrect = new Rectangle(this.Width - labelsize, 0, labelsize, this.Height);
                rect      = new Rectangle(0, 0, this.Width - labelsize, this.Height);
                break;
            }

            ThemeKit.DrawOrFill(theme.NormalBackground, e.Graphics, rect);
            ThemeKit.DrawOrFill(theme.NormalLabelBackground, e.Graphics, labelrect);

            labelrect.Inflate(-labelpadding, -labelpadding);

            ThemeKit.DrawContent(this.Text, null, textalign, ContentAlignment.MiddleCenter, theme.NormalLabelText, e.Graphics, labelrect, this.Font);
        }
Exemple #16
0
        protected override void DoPaint(PaintEventArgs e)
        {
            ThemeKit.DrawOrFill(theme.NormalBackground, e.Graphics, e.ClipRectangle);

            if (firstdisplayeditem < 0)
            {
                firstdisplayeditem = 0;
            }
            if (firstdisplayeditem > (items.Count - 1))
            {
                firstdisplayeditem = items.Count - 1;
            }

            int y = e.ClipRectangle.Y + 2;

            vscroll.Width  = theme.VerticalScrollBarSize;
            vscroll.Left   = this.Width - vscroll.Width;
            vscroll.Top    = 0;
            vscroll.Height = this.Height;

            int i = 0;

            foreach (object obj in items)
            {
                Rectangle rect = new Rectangle(e.ClipRectangle.X + 2, y, e.ClipRectangle.Width - 4 - vscroll.Width, itemheight);
                itemboundrects.Add(rect);

                if (rect.Y >= e.ClipRectangle.Height)
                {
                    continue;
                }

                PaintItem(i, obj, rect, e.Graphics);
                y += itemheight;
                i++;
            }
        }
Exemple #17
0
        protected override void OnRenderSplitButtonBackground(ToolStripItemRenderEventArgs e)
        {
            Rectangle rect = new Rectangle(0, 0, e.Item.Width, e.Item.Height);

            if (ts != null)
            {
                if (!e.Item.Enabled)
                {
                    ThemeKit.DrawOrFill(ts.theme.SplitButtonDisabledBackground, e.Graphics, rect);
                }
                else if (e.Item.Pressed)
                {
                    ThemeKit.DrawOrFill(ts.theme.SplitButtonDownBackground, e.Graphics, rect);
                }
                else if (e.Item.Selected)
                {
                    ThemeKit.DrawOrFill(ts.theme.SplitButtonOverBackground, e.Graphics, rect);
                }
                else
                {
                    ThemeKit.DrawOrFill(ts.theme.SplitButtonNormalBackground, e.Graphics, rect);
                }
            }
        }
Exemple #18
0
 protected override void OnPaint(PaintEventArgs e)
 {
     ThemeKit.SetGraphicsQuality(e.Graphics);
     DoPaint(new PaintEventArgs(e.Graphics, this.ClientRectangle));
 }
Exemple #19
0
        protected override void DoPaint(PaintEventArgs e)
        {
            this.Height = elements.TabBarHeight;

            RecalculateTabBounds();

            if (parent.customnavbtnenable)
            {
                navbtnbackenabled = parent.enablenavbtnback;
                navbtnfwdenabled  = parent.enablenavbtnfwd;
            }
            else
            {
                navbtnbackenabled = parent.SelectedIndex > 0;
                navbtnfwdenabled  = parent.SelectedIndex < (parent.TabPages.Count - 1);
            }

            Rectangle r = e.ClipRectangle;

            r.Offset(-1, -1);
            r.Width++;
            r.Height++;
            ThemeKit.DrawOrFill(elements.NormalBackground, e.Graphics, r);

            if (elements.NavButtonBack)
            {
                if (!navbtnbackenabled)
                {
                    ThemeKit.DrawOrFill(elements.NavButtonBackDisabled, e.Graphics, elements.NavButtonBackRect());
                }
                else
                {
                    ThemeKit.DrawOrFill(elements.NavButtonBackNormal, e.Graphics, elements.NavButtonBackRect());
                    ThemeKit.DrawOrFill(elements.NavButtonBackOver, e.Graphics, elements.NavButtonBackRect(), navbtnbackoverfadeprogress);
                }
            }

            if (elements.NavButtonForward)
            {
                if (!navbtnfwdenabled)
                {
                    ThemeKit.DrawOrFill(elements.NavButtonForwardDisabled, e.Graphics, elements.NavButtonForwardRect());
                }
                else
                {
                    ThemeKit.DrawOrFill(elements.NavButtonForwardNormal, e.Graphics, elements.NavButtonForwardRect());
                    ThemeKit.DrawOrFill(elements.NavButtonForwardOver, e.Graphics, elements.NavButtonForwardRect(), navbtnfwdoverfadeprogress);
                }
            }

            foreach (ThemeTab tab in parent.TabPages)
            {
                if (!tab.ShowTab)
                {
                    continue;
                }

                tab.CheckStyle();

                Rectangle tabrect = tab.bounds;

                if (tab is ThemeLabelTab)
                {
                    ThemeLabelTab ltab = (ThemeLabelTab)tab;

                    object[] atts = ltab.GetType().GetCustomAttributes(typeof(ThemeKitControl), false);

                    ThemeKit.DrawOrFill(ltab.theme.NormalTab, e.Graphics, tabrect);
                    ThemeKit.DrawOrFill(ltab.theme.OverTab, e.Graphics, tabrect, ltab.overfadeprogress);

                    if ((ltab.state & ThemeTab.State.Selected) > 0)
                    {
                        ThemeKit.DrawOrFill(ltab.theme.SelectedTab, e.Graphics, tabrect);
                    }

                    ThemeKit.DrawContent(ltab.TabText, null, ContentAlignment.MiddleCenter, ContentAlignment.MiddleCenter, ltab.theme.NormalTabText, e.Graphics, tabrect, ltab.Font);
                    ThemeKit.DrawContent(ltab.TabText, null, ContentAlignment.MiddleCenter, ContentAlignment.MiddleCenter, ltab.theme.OverTabText, e.Graphics, tabrect, ltab.Font, ltab.overfadeprogress);

                    if ((ltab.state & ThemeTab.State.Selected) > 0)
                    {
                        ThemeKit.DrawContent(ltab.TabText, null, ContentAlignment.MiddleCenter, ContentAlignment.MiddleCenter, ltab.theme.SelectedTabText, e.Graphics, tabrect, ltab.Font);
                    }
                }
                else
                {
                    ThemeKit.DrawOrFill(tab.theme.NormalTab, e.Graphics, tabrect);
                    ThemeKit.DrawOrFill(tab.theme.OverTab, e.Graphics, tabrect, tab.overfadeprogress);

                    if ((tab.state & ThemeTab.State.Selected) > 0)
                    {
                        ThemeKit.DrawOrFill(tab.theme.SelectedTab, e.Graphics, tabrect);
                    }

                    ThemeKit.DrawContent(tab.TabText, null, ContentAlignment.MiddleCenter, ContentAlignment.MiddleCenter, tab.theme.NormalTabText, e.Graphics, tabrect, tab.Font);
                    ThemeKit.DrawContent(tab.TabText, null, ContentAlignment.MiddleCenter, ContentAlignment.MiddleCenter, tab.theme.OverTabText, e.Graphics, tabrect, tab.Font, tab.overfadeprogress);

                    if ((tab.state & ThemeTab.State.Selected) > 0)
                    {
                        ThemeKit.DrawContent(tab.TabText, null, ContentAlignment.MiddleCenter, ContentAlignment.MiddleCenter, tab.theme.SelectedTabText, e.Graphics, tabrect, tab.Font);
                    }
                }
            }

            if (elements.CloseButton)
            {
                bool closebtnenabled = false;

                Control c = this;

                while (c != null && !(c is Form))
                {
                    c = c.Parent;
                }

                if (c != null && c is Form && ((Form)c).ControlBox)
                {
                    closebtnenabled = true;
                }

                btnclose.Enabled = closebtnenabled;
            }
            btnclose.Visible = elements.CloseButton;

            if (elements.MaximizeButton)
            {
                bool maxbtnenabled = false;

                Control c = this;

                while (c != null && !(c is Form))
                {
                    c = c.Parent;
                }

                if (c != null && c is Form && ((Form)c).MaximizeBox)
                {
                    maxbtnenabled = true;
                }

                btnmax.Enabled = maxbtnenabled;
            }
            btnmax.Visible = elements.MaximizeButton;

            if (elements.MinimizeButton)
            {
                bool minbtnenabled = false;

                Control c = this;

                while (c != null && !(c is Form))
                {
                    c = c.Parent;
                }

                if (c != null && c is Form && ((Form)c).MinimizeBox)
                {
                    minbtnenabled = true;
                }

                btnmin.Enabled = minbtnenabled;
            }
            btnmin.Visible = elements.MinimizeButton;
        }
Exemple #20
0
 protected override void DoPaint(PaintEventArgs e)
 {
     ThemeKit.DrawOrFill(elements.NormalBackground, e.Graphics, this.ClientRectangle);
 }
Exemple #21
0
        protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e)
        {
            Rectangle rect = new Rectangle(0, 0, e.Item.Width, e.Item.Height);

            if (cms != null)
            {
                if (!e.Item.Enabled)
                {
                    ThemeKit.DrawOrFill(cms.theme.DisabledItemBackground, e.Graphics, rect);
                }
                else if (e.Item.Selected)
                {
                    ThemeKit.DrawOrFill(cms.theme.OverItemBackground, e.Graphics, rect);
                }
                else
                {
                    ThemeKit.DrawOrFill(cms.theme.NormalItemBackground, e.Graphics, rect);
                }
            }
            else if (ts != null)
            {
                if (!e.Item.Enabled)
                {
                    ThemeKit.DrawOrFill(ts.theme.MenuDisabledItemBackground, e.Graphics, rect);
                }
                else if (e.Item.Selected)
                {
                    ThemeKit.DrawOrFill(ts.theme.MenuOverItemBackground, e.Graphics, rect);
                }
                else
                {
                    ThemeKit.DrawOrFill(ts.theme.MenuNormalItemBackground, e.Graphics, rect);
                }
            }
            else if (ss != null)
            {
                if (!e.Item.Enabled)
                {
                    ThemeKit.DrawOrFill(ss.theme.MenuDisabledItemBackground, e.Graphics, rect);
                }
                else if (e.Item.Selected)
                {
                    ThemeKit.DrawOrFill(ss.theme.MenuOverItemBackground, e.Graphics, rect);
                }
                else
                {
                    ThemeKit.DrawOrFill(ss.theme.MenuNormalItemBackground, e.Graphics, rect);
                }
            }
            else if (ms != null)
            {
                if (e.ToolStrip is ToolStripDropDownMenu)
                {
                    if (!e.Item.Enabled)
                    {
                        ThemeKit.DrawOrFill(ms.theme.MenuDisabledItemBackground, e.Graphics, rect);
                    }
                    else if (e.Item.Selected)
                    {
                        ThemeKit.DrawOrFill(ms.theme.MenuOverItemBackground, e.Graphics, rect);
                    }
                    else
                    {
                        ThemeKit.DrawOrFill(ms.theme.MenuNormalItemBackground, e.Graphics, rect);
                    }
                }
                else
                {
                    if (!e.Item.Enabled)
                    {
                        ThemeKit.DrawOrFill(ms.theme.DisabledItemBackground, e.Graphics, rect);
                    }
                    else if (e.Item.Pressed)
                    {
                        ThemeKit.DrawOrFill(ms.theme.DownItemBackground, e.Graphics, rect);
                    }
                    else if (e.Item.Selected)
                    {
                        ThemeKit.DrawOrFill(ms.theme.OverItemBackground, e.Graphics, rect);
                    }
                    else
                    {
                        ThemeKit.DrawOrFill(ms.theme.NormalItemBackground, e.Graphics, rect);
                    }
                }
            }
        }