internal override void PaintOver(PaintEventArgs e, CheckState state) { ButtonBaseAdapter.ColorData colors = base.PaintPopupRender(e.Graphics).Calculate(); ButtonBaseAdapter.LayoutData layout = this.PaintPopupLayout(e, state == CheckState.Unchecked, SystemInformation.HighContrast ? 2 : 1).Layout(); Graphics g = e.Graphics; Rectangle clientRectangle = base.Control.ClientRectangle; Brush background = null; if (state == CheckState.Indeterminate) { background = ButtonBaseAdapter.CreateDitherBrush(colors.highlight, colors.buttonFace); } try { base.PaintButtonBackground(e, clientRectangle, background); } finally { if (background != null) { background.Dispose(); background = null; } } if (base.Control.IsDefault) { clientRectangle.Inflate(-1, -1); } base.PaintImage(e, layout); base.PaintField(e, layout, colors, colors.windowText, true); ButtonBaseAdapter.DrawDefaultBorder(g, clientRectangle, colors.options.highContrast ? colors.windowText : colors.buttonShadow, base.Control.IsDefault); if (SystemInformation.HighContrast) { using (Pen pen = new Pen(colors.windowFrame)) { using (Pen pen2 = new Pen(colors.highlight)) { using (Pen pen3 = new Pen(colors.buttonShadow)) { g.DrawLine(pen, (int)(clientRectangle.Left + 1), (int)(clientRectangle.Top + 1), (int)(clientRectangle.Right - 2), (int)(clientRectangle.Top + 1)); g.DrawLine(pen, (int)(clientRectangle.Left + 1), (int)(clientRectangle.Top + 1), (int)(clientRectangle.Left + 1), (int)(clientRectangle.Bottom - 2)); g.DrawLine(pen, clientRectangle.Left, clientRectangle.Bottom - 1, clientRectangle.Right, clientRectangle.Bottom - 1); g.DrawLine(pen, clientRectangle.Right - 1, clientRectangle.Top, clientRectangle.Right - 1, clientRectangle.Bottom); g.DrawLine(pen2, clientRectangle.Left, clientRectangle.Top, clientRectangle.Right, clientRectangle.Top); g.DrawLine(pen2, clientRectangle.Left, clientRectangle.Top, clientRectangle.Left, clientRectangle.Bottom); g.DrawLine(pen3, (int)(clientRectangle.Left + 1), (int)(clientRectangle.Bottom - 2), (int)(clientRectangle.Right - 2), (int)(clientRectangle.Bottom - 2)); g.DrawLine(pen3, (int)(clientRectangle.Right - 2), (int)(clientRectangle.Top + 1), (int)(clientRectangle.Right - 2), (int)(clientRectangle.Bottom - 2)); } } } clientRectangle.Inflate(-2, -2); } else { ButtonBaseAdapter.Draw3DLiteBorder(g, clientRectangle, colors, true); } }
internal override void PaintUp(PaintEventArgs e, CheckState state) { ButtonBaseAdapter.ColorData colors = base.PaintPopupRender(e.Graphics).Calculate(); ButtonBaseAdapter.LayoutData layout = this.PaintPopupLayout(e, state == CheckState.Unchecked, 1).Layout(); Graphics g = e.Graphics; Rectangle clientRectangle = base.Control.ClientRectangle; Brush background = null; if (state == CheckState.Indeterminate) { background = ButtonBaseAdapter.CreateDitherBrush(colors.highlight, colors.buttonFace); } try { base.PaintButtonBackground(e, clientRectangle, background); } finally { if (background != null) { background.Dispose(); background = null; } } if (base.Control.IsDefault) { clientRectangle.Inflate(-1, -1); } base.PaintImage(e, layout); base.PaintField(e, layout, colors, colors.windowText, true); ButtonBaseAdapter.DrawDefaultBorder(g, clientRectangle, colors.options.highContrast ? colors.windowText : colors.buttonShadow, base.Control.IsDefault); if (state == CheckState.Unchecked) { ButtonBaseAdapter.DrawFlatBorder(g, clientRectangle, colors.options.highContrast ? colors.windowText : colors.buttonShadow); } else { ButtonBaseAdapter.Draw3DLiteBorder(g, clientRectangle, colors, false); } }
internal override void PaintDown(PaintEventArgs e, CheckState state) { bool flag = (base.Control.FlatAppearance.BorderSize != 1) || !base.Control.FlatAppearance.BorderColor.IsEmpty; ButtonBaseAdapter.ColorData colors = base.PaintFlatRender(e.Graphics).Calculate(); ButtonBaseAdapter.LayoutData layout = this.PaintFlatLayout(e, !base.Control.FlatAppearance.CheckedBackColor.IsEmpty || (SystemInformation.HighContrast ? (state != CheckState.Indeterminate) : (state == CheckState.Unchecked)), (!flag && SystemInformation.HighContrast) && (state == CheckState.Checked), base.Control.FlatAppearance.BorderSize).Layout(); if (!base.Control.FlatAppearance.BorderColor.IsEmpty) { colors.windowFrame = base.Control.FlatAppearance.BorderColor; } Graphics g = e.Graphics; Rectangle clientRectangle = base.Control.ClientRectangle; Color backColor = base.Control.BackColor; if (!base.Control.FlatAppearance.MouseDownBackColor.IsEmpty) { backColor = base.Control.FlatAppearance.MouseDownBackColor; } else { switch (state) { case CheckState.Unchecked: case CheckState.Checked: backColor = colors.options.highContrast ? colors.buttonShadow : colors.lowHighlight; break; case CheckState.Indeterminate: backColor = ButtonBaseAdapter.MixedColor(colors.options.highContrast ? colors.buttonShadow : colors.lowHighlight, colors.buttonFace); break; } } this.PaintBackground(e, clientRectangle, backColor); if (base.Control.IsDefault) { clientRectangle.Inflate(-1, -1); } base.PaintImage(e, layout); base.PaintField(e, layout, colors, colors.windowText, false); if (base.Control.Focused && base.Control.ShowFocusCues) { ButtonBaseAdapter.DrawFlatFocus(g, layout.focus, colors.options.highContrast ? colors.windowText : colors.constrastButtonShadow); } if ((!base.Control.IsDefault || !base.Control.Focused) || (base.Control.FlatAppearance.BorderSize != 0)) { ButtonBaseAdapter.DrawDefaultBorder(g, clientRectangle, colors.windowFrame, base.Control.IsDefault); } if (flag) { if (base.Control.FlatAppearance.BorderSize != 1) { ButtonBaseAdapter.DrawFlatBorderWithSize(g, clientRectangle, colors.windowFrame, base.Control.FlatAppearance.BorderSize); } else { ButtonBaseAdapter.DrawFlatBorder(g, clientRectangle, colors.windowFrame); } } else if ((state == CheckState.Checked) && SystemInformation.HighContrast) { ButtonBaseAdapter.DrawFlatBorder(g, clientRectangle, colors.windowFrame); ButtonBaseAdapter.DrawFlatBorder(g, clientRectangle, colors.buttonShadow); } else if (state == CheckState.Indeterminate) { ButtonBaseAdapter.Draw3DLiteBorder(g, clientRectangle, colors, false); } else { ButtonBaseAdapter.DrawFlatBorder(g, clientRectangle, colors.windowFrame); } }