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); } } } }
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); }
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); }
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); }
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); } }
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); }
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; }