private Image getCheckBoxImage(bool isChecked)
{
if (isChecked && this.checkedCheckBoxImage != null)
{
return checkedCheckBoxImage;
}
else if (!isChecked && this.uncheckedCheckBoxImage != null)
{
return uncheckedCheckBoxImage;
}
CheckBox chk = new CheckBox();
chk.Checked = isChecked;
chk.Text = "";
chk.Margin = new Padding(3, 3, 3, 3);
chk.Width = 14;
chk.Height = 14;
chk.BackColor = Color.Transparent;
Bitmap bitmap = new Bitmap(chk.Width, chk.Height);
Rectangle rect = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
chk.DrawToBitmap(bitmap, rect);
if (isChecked)
{
checkedCheckBoxImage = bitmap;
}
else
{
uncheckedCheckBoxImage = bitmap;
}
return bitmap;
}