WinXP and GroupBox painting problem

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

I must be missing something or there is a bug in control... GroupBox text is
not painted correctly if located in another GroupBox when visual styles are
enabled (Application.EnableVisualStyles()). FlatStyle was set to System and
font size 8.25pt, however text is painted like font size was ~16pt, and
trimmed to width of 8.25pt text. If I set FlatStyle of parent GroupBox to
Standard, child GroupBox is painted correctly.

Any tips/workarounds for this problem?
Btw. It's Framework1.1 + SP1.

Thanks,
Tom
 
Mattias said:
FIX: The captions of the GroupBox controls in your Windows Forms
application may be truncated and may appear in the wrong font after
you install the .NET Framework 1.1 Service Pack 1
http://support.microsoft.com/?kbid=890828

Somehow I missed that, thanks ;)
Just a side-note, I had this problem before SP1 but in too few cases to even
bother with it, so it might be caused by some other windows update/hot fix.

Regards,
Tom
 
If you have clients experiencing this problem and you can't get them to
install the hotfix, you can subclass the group box and use the following code
to fix the problem (fingers crossed it doesn't screw up the code formatting):

private const int WM_PRINTCLIENT = 0x0318;

protected override void WndProc(ref Message m)
{
if (m.Msg == WM_PRINTCLIENT)
{
m.Result = new IntPtr(1);
}
else
{
base.WndProc(ref m);
}
}
 
Back
Top