Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>A simple one :</p> <p>overrides check box <code>OnPaint(PaintEventArgs e)</code> as below:</p> <pre><code>Graphics g = e.Graphics; base.OnPaint(e); //// Fill the background //SetControlSizes(); // Paint the outer rounded rectangle g.SmoothingMode = SmoothingMode.AntiAlias; using (GraphicsPath outerPath = GeneralUtilities.RoundedRectangle(mLabelRect, 1, 0)) { using (LinearGradientBrush outerBrush = new LinearGradientBrush(mLabelRect, mGradientTop, mGradientBottom, LinearGradientMode.Vertical)) { g.FillPath(outerBrush, outerPath); } using (Pen outlinePen = new Pen(mGradientTop, mRectOutlineWidth)) { outlinePen.Alignment = PenAlignment.Inset; g.DrawPath(outlinePen, outerPath); } } //// Paint the gel highlight using (GraphicsPath innerPath = GeneralUtilities.RoundedRectangle(mHighlightRect, mRectCornerRadius, mHighlightRectOffset)) { using (LinearGradientBrush innerBrush = new LinearGradientBrush(mHighlightRect, Color.FromArgb(mHighlightAlphaTop, Color.White), Color.FromArgb(mHighlightAlphaBottom, Color.White), LinearGradientMode.Vertical)) { g.FillPath(innerBrush, innerPath); } } // Paint the text TextRenderer.DrawText(g, Text, Font, mLabelRect, Color.White, Color.Transparent, TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.EndEllipsis); </code></pre> <p>But if you want to have a good one you have to use <a href="http://msdn.microsoft.com/en-us/library/ms752319%28v=vs.85%29.aspx" rel="nofollow">wpf CheckBox ControlTemplate Example</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload