[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] pnetlib/System.Windows.Forms/Themes DefaultThemePa
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] pnetlib/System.Windows.Forms/Themes DefaultThemePainter.cs, 1.21, 1.22 Glyphs.cs, 1.1, 1.2 |
Date: |
Fri, 21 Nov 2003 06:47:37 +0000 |
Update of /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/Themes
In directory subversions:/tmp/cvs-serv15371/System.Windows.Forms/Themes
Modified Files:
DefaultThemePainter.cs Glyphs.cs
Log Message:
Implement glyph-based drawing of checkboxes; fix some drawing/logic bugs
in "CheckBox" and "ButtonBase".
Index: DefaultThemePainter.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/Themes/DefaultThemePainter.cs,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** DefaultThemePainter.cs 20 Nov 2003 23:52:36 -0000 1.21
--- DefaultThemePainter.cs 21 Nov 2003 06:47:35 -0000 1.22
***************
*** 970,977 ****
// Draw a check box control.
- // TODO: antialiased checkmark
public virtual void DrawCheckBox(Graphics graphics, int x, int y,
int width,
int height, ButtonState state)
{
Brush brush = new SolidBrush(Color.White);
ControlPaint.DrawBorder3D(graphics, x, y,
width, height, Border3DStyle.Sunken, Border3DSide.All);
--- 970,1036 ----
// Draw a check box control.
public virtual void DrawCheckBox(Graphics graphics, int x, int y,
int width,
int height, ButtonState state)
{
+ // Draw the border around the outside of the
checkbox.
+ if((state & ButtonState.Flat) == 0)
+ {
+ ControlPaint.DrawBorder3D
+ (graphics, x, y, width, height,
+ Border3DStyle.Sunken,
Border3DSide.All);
+ x += 2;
+ y += 2;
+ width -= 4;
+ height -= 4;
+ }
+ else
+ {
+ if((state & ButtonState.Inactive) != 0)
+ {
+ graphics.DrawRectangle
+
(SystemPens.ControlDark, x, y, width, height);
+ }
+ else
+ {
+ graphics.DrawRectangle
+
(SystemPens.ControlText, x, y, width, height);
+ }
+ x += 1;
+ y += 1;
+ width -= 2;
+ height -= 2;
+ }
+
+ // Fill the background of the checkbox.
+ if((state & (ButtonState.Inactive |
ButtonState.Pushed)) != 0)
+ {
+ graphics.FillRectangle
+ (SystemBrushes.Control, x, y,
width, height);
+ }
+ else
+ {
+ graphics.FillRectangle
+ (SystemBrushes.Window, x, y,
width, height);
+ }
+
+ // Draw the checkmark in the checkbox.
+ if((state & ButtonState.Checked) != 0)
+ {
+ Color color;
+ if((state & ButtonState.Inactive) != 0)
+ {
+ color =
SystemColors.ControlDark;
+ }
+ else
+ {
+ color =
SystemColors.ControlText;
+ }
+ DrawGlyph(graphics, x, y, width, height,
+ Glyphs.checkmark_bits,
+
Glyphs.checkmark_width,
+
Glyphs.checkmark_height, color);
+ }
+
+ #if false // May need later for non-standard glyph sizes.
Brush brush = new SolidBrush(Color.White);
ControlPaint.DrawBorder3D(graphics, x, y,
width, height, Border3DStyle.Sunken, Border3DSide.All);
***************
*** 991,994 ****
--- 1050,1054 ----
pen.Dispose();
}
+ #endif
}
Index: Glyphs.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/Themes/Glyphs.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Glyphs.cs 20 Nov 2003 10:25:19 -0000 1.1
--- Glyphs.cs 21 Nov 2003 06:47:35 -0000 1.2
***************
*** 77,80 ****
--- 77,86 ----
{0x7f, 0x3e, 0x1c, 0x08};
+ // Checkmark within a checkbox.
+ public const int checkmark_width = 7;
+ public const int checkmark_height = 7;
+ public static readonly byte[] checkmark_bits =
+ {0x40, 0x60, 0x71, 0x3b, 0x1f, 0x0e, 0x04};
+
}; // class Glyphs
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] pnetlib/System.Windows.Forms/Themes DefaultThemePainter.cs, 1.21, 1.22 Glyphs.cs, 1.1, 1.2,
Rhys Weatherley <address@hidden> <=