+ ::WinSetPresParam( m_hWnd
+ ,PP_BACKGROUNDCOLOR
+ ,sizeof(LONG)
+ ,(PVOID)&lColor
+ );
+
+ SubclassWin(m_hWnd);
+ wxFont* pTextFont = new wxFont( 10
+ ,wxMODERN
+ ,wxNORMAL
+ ,wxNORMAL
+ );
+ wxControl::SetFont(*pTextFont);
+ SetSize( nX
+ ,nY
+ ,nWidth
+ ,nHeight
+ );
+ delete pTextFont;
+ return TRUE;
+} // end of wxStaticText::Create
+
+wxSize wxStaticText::DoGetBestSize() const
+{
+ wxString sText(wxGetWindowText(GetHWND()));
+ int nWidthTextMax = 0;
+ int nWidthLine = 0;
+ int nHeightTextTotal = 0;
+ int nHeightLineDefault = 0;
+ int nHeightLine = 0;
+ wxString sCurLine;
+
+ for (const wxChar *pc = sText; ; pc++)
+ {
+ if ( *pc == wxT('\n') || *pc == wxT('\0') )
+ {
+ if (!sCurLine )
+ {
+ //
+ // We can't use GetTextExtent - it will return 0 for both width
+ // and height and an empty line should count in height
+ // calculation
+ //
+ if (!nHeightLineDefault)
+ nHeightLineDefault = nHeightLine;
+ if (!nHeightLineDefault)
+ GetTextExtent(_T("W"), NULL, &nHeightLineDefault);
+ nHeightTextTotal += nHeightLineDefault;
+ }
+ else
+ {
+ GetTextExtent( sCurLine
+ ,&nWidthLine
+ ,&nHeightLine
+ );
+ if (nWidthLine > nWidthTextMax)
+ nWidthTextMax = nWidthLine;
+ nHeightTextTotal += nHeightLine;
+ }
+
+ if ( *pc == wxT('\n') )
+ {
+ sCurLine.Empty();
+ }
+ else
+ {
+ break;
+ }
+ }
+ else
+ {
+ sCurLine += *pc;
+ }
+ }
+ return wxSize( nWidthTextMax
+ ,nHeightTextTotal
+ );
+} // end of wxStaticText::DoGetBestSize
+
+void wxStaticText::DoSetSize(
+ int nX
+, int nY
+, int nWidth
+, int nHeight
+, int nSizeFlags
+)