Thomas,
I going to assume you ment a WinForm CheckBox.
With that said here is how I would do it.
Add an ImageList Control to the Form. To hold the 16x16 images used as
the check box area of the control.
Image 1: Image of an Unchecked box
Image 2: Image of a box with a check in it
Image 3: Image of a Indeterminate Box with a check in it (Only if 3
state)
Add a Paint Event to the check box the the following code.
private void CheckBox1_Paint(object sender, PaintEventArgs e)
{
if( CheckBox1.Checked )
e.Graphics.DrawImageUnscaled( ImageList1.Images[1],
0, // X start point
0 ); // Y start point
else
e.Graphics.DrawImageUnscaled( ImageList1.Images[0],
0, // X start point
0 ); // Y start point
}
Note: Forms will be slowed during load the more check boxes you have
to draw.
Hopes this helps.
Glen Jones MCSD
From: "Thomas Kehl" <t.kehl (at) heeb.com>
Subject: Create OwnerDraw CheckBox
Date: Tue, 16 Dec 2003 18:56:54 +0100
Lines: 11
Hi.
Does anybody have a sample, how does I can make a checkBox
ownerdrawn? Ineed to change the color inside of the box.
Can anyone help me, how does I have to do this?
Thanks
Thomas