]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/textctrl.cpp
Document the default size of new wxMemoryBuffer correctly.
[wxWidgets.git] / src / msw / textctrl.cpp
index c963a170b35e2333a29be145e8fbcb06df70fab5..659cf210775db924a1d959d38f9a31ff1c47672c 100644 (file)
@@ -30,6 +30,7 @@
     #include "wx/textctrl.h"
     #include "wx/settings.h"
     #include "wx/brush.h"
+    #include "wx/dcclient.h"
     #include "wx/utils.h"
     #include "wx/intl.h"
     #include "wx/log.h"
@@ -2396,9 +2397,7 @@ bool wxTextCtrl::SetForegroundColour(const wxColour& colour)
     if ( IsRich() )
     {
         // change the colour of everything
-        CHARFORMAT cf;
-        wxZeroMemory(cf);
-        cf.cbSize = sizeof(cf);
+        WinStruct<CHARFORMAT> cf;
         cf.dwMask = CFM_COLOR;
         cf.crTextColor = wxColourToRGB(colour);
         ::SendMessage(GetHwnd(), EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
@@ -2743,7 +2742,7 @@ bool wxTextCtrl::GetStyle(long position, wxTextAttr& style)
     // Convert the height from the units of 1/20th of the point in which
     // CHARFORMAT stores it to pixel-based units used by LOGFONT.
     const wxCoord ppi = wxClientDC(this).GetPPI().y;
-    lf.lfHeight = -MulDiv(cf.yHeight/2, ppi, 72);
+    lf.lfHeight = -MulDiv(cf.yHeight/20, ppi, 72);
     lf.lfWidth = 0;
     lf.lfCharSet = ANSI_CHARSET; // FIXME: how to get correct charset?
     lf.lfClipPrecision = 0;