internal static void DrawCheckOnly(int checkSize, bool controlChecked, bool controlEnabled, CheckState controlCheckState, Graphics g, ButtonBaseAdapter.LayoutData layout, ButtonBaseAdapter.ColorData colors, Color checkColor, Color checkBackground, bool disabledColors) { if (controlChecked) { if (!controlEnabled && disabledColors) { checkColor = colors.buttonShadow; } else if ((controlCheckState == CheckState.Indeterminate) && disabledColors) { checkColor = SystemInformation.HighContrast ? colors.highlight : colors.buttonShadow; } Rectangle checkBounds = layout.checkBounds; if (checkBounds.Width == checkSize) { checkBounds.Width++; checkBounds.Height++; } checkBounds.Width++; checkBounds.Height++; Bitmap image = null; if (controlCheckState == CheckState.Checked) { image = GetCheckBoxImage(checkColor, checkBounds, ref checkImageCheckedBackColor, ref checkImageChecked); } else { image = GetCheckBoxImage(checkColor, checkBounds, ref checkImageIndeterminateBackColor, ref checkImageIndeterminate); } if (layout.options.everettButtonCompat) { checkBounds.Y--; } else { checkBounds.Y -= 2; } ControlPaint.DrawImageColorized(g, image, checkBounds, checkColor); } }
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); } }
protected void DrawCheckOnly(PaintEventArgs e, ButtonBaseAdapter.LayoutData layout, ButtonBaseAdapter.ColorData colors, Color checkColor, Color checkBackground, bool disabledColors) { DrawCheckOnly(11, this.Control.Checked, this.Control.Enabled, this.Control.CheckState, e.Graphics, layout, colors, checkColor, checkBackground, disabledColors); }
internal ButtonBaseAdapter.LayoutData Layout() { ButtonBaseAdapter.LayoutData layout = new ButtonBaseAdapter.LayoutData(this) { client = this.client }; int fullBorderSize = this.FullBorderSize; layout.face = Rectangle.Inflate(layout.client, -fullBorderSize, -fullBorderSize); this.CalcCheckmarkRectangle(layout); this.LayoutTextAndImage(layout); if (this.maxFocus) { layout.focus = layout.field; layout.focus.Inflate(-1, -1); layout.focus = LayoutUtils.InflateRect(layout.focus, this.padding); } else { Rectangle a = new Rectangle(layout.textBounds.X - 1, layout.textBounds.Y - 1, layout.textBounds.Width + 2, layout.textBounds.Height + 3); if (this.imageSize != Size.Empty) { layout.focus = Rectangle.Union(a, layout.imageBounds); } else { layout.focus = a; } } if (this.focusOddEvenFixup) { if ((layout.focus.Height % 2) == 0) { layout.focus.Y++; layout.focus.Height--; } if ((layout.focus.Width % 2) == 0) { layout.focus.X++; layout.focus.Width--; } } return layout; }