My aim is to display radio buttons instead of check boxes in some or all the
nodes in a tree view, and also to sometimes make them look disabled. Does
anyone know an easy way to do this?
I believe I can do this my using the StateImageList for the tree view, but
I'm having problems creating the image list at runtime, which I think I need
to do to be able to support visual styles.
I have tried to create a new bitmap and then draw on it using a
CheckBoxRenderer or a RadioButtonRenderer. This works perfectly for a check
box, but for a radio button the colours are not quite right. This might be
something to do with the way I create my Bitmap object - I just use the
constructor that takes a width and height.
I'm doing something like this to create my bitmap:
Bitmap bitmap = new Bitmap(16, 16);
using (Graphics g = Graphics.FromImage(bitmap))
{
Point gp = new Point(2, 2);
RadioButtonRenderer.DrawRadioButton(g, gp,
RadioButtonState.UncheckedNormal);
}
But what I get is a much darker edge to the radio button.
Can anyone tell me why this happens? Like I say, it works ok for a
CheckBoxRenderer, or at least it appears to....