diff --git a/samples/widgets/static.cpp b/samples/widgets/static.cpp index c305c4db8e..abeff873bf 100644 --- a/samples/widgets/static.cpp +++ b/samples/widgets/static.cpp @@ -308,7 +308,7 @@ void StaticWidgetsPage::CreateContent() // NB: must be done _before_ calling CreateStatic() Reset(); - m_textBox->SetValue(wxT("This is a box")); + m_textBox->SetValue(wxT("This is a &box")); m_textLabel->SetValue(wxT("And this is a\n\tlabel inside the box with a &mnemonic.\n") wxT("Only this text is affected by the ellipsize settings.")); m_textLabelWithMarkup->SetValue(wxT("Another label, this time decorated ") diff --git a/src/msw/statbox.cpp b/src/msw/statbox.cpp index 55f3b79cd1..1058f381b9 100644 --- a/src/msw/statbox.cpp +++ b/src/msw/statbox.cpp @@ -512,18 +512,32 @@ void wxStaticBox::PaintForeground(wxDC& dc, const RECT& rc) PaintBackground(dc, dimensions); } + UINT drawTextFlags = DT_SINGLELINE | DT_VCENTER; + + // determine the state of UI queues to draw the text correctly under XP + // and later systems + static const bool isXPorLater = wxGetWinVersion() >= wxWinVersion_XP; + if ( isXPorLater ) + { + if ( ::SendMessage(GetHwnd(), WM_QUERYUISTATE, 0, 0) & + UISF_HIDEACCEL ) + { + drawTextFlags |= DT_HIDEPREFIX; + } + } + // now draw the text if ( !rtl ) { RECT rc2 = { x, 0, x + width, y }; ::DrawText(hdc, label.wx_str(), label.length(), &rc2, - DT_SINGLELINE | DT_VCENTER); + drawTextFlags); } else // RTL { RECT rc2 = { x, 0, x - width, y }; ::DrawText(hdc, label.wx_str(), label.length(), &rc2, - DT_SINGLELINE | DT_VCENTER | DT_RTLREADING); + drawTextFlags | DT_RTLREADING); } } }