I have a control that is modelled on a ComboBox. I want to render the control so that the control border looks like that of a standard
I'm not 100% sure if this is what you are looking for but you should check out the VisualStyleRenderer in the System.Windows.Forms.VisualStyles-namespace.
Since VisualStyleRenderer won't work if the user don't have visual styles enabled (he/she might be running 'classic mode' or an operative system prior to Windows XP) you should always have a fallback to the ControlPaint class.
// Create the renderer.
if (VisualStyleInformation.IsSupportedByOS
&& VisualStyleInformation.IsEnabledByUser)
{
renderer = new VisualStyleRenderer(
VisualStyleElement.ComboBox.DropDownButton.Disabled);
}
and then do like this when drawing:
if(renderer != null)
{
// Use visual style renderer.
}
else
{
// Use ControlPaint renderer.
}
Hope it helps!
Are any of the ControlPaint methods useful for this? That's what I usually use for custom-rendered controls.