+ WXMICROWIN_CHECK_HDC
+
+ wxASSERT_MSG( points, wxT("NULL pointer to spline points?") );
+
+ const size_t n_points = points->GetCount();
+ wxASSERT_MSG( n_points > 2 , wxT("incomplete list of spline points?") );
+
+ const size_t n_bezier_points = n_points * 3 + 1;
+ POINT *lppt = (POINT *)malloc(n_bezier_points*sizeof(POINT));
+ size_t bezier_pos = 0;
+ wxCoord x1, y1, x2, y2, cx1, cy1, cx4, cy4;
+
+ wxPointList::compatibility_iterator node = points->GetFirst();
+ wxPoint *p = node->GetData();
+ lppt[ bezier_pos ].x = x1 = p->x;
+ lppt[ bezier_pos ].y = y1 = p->y;
+ bezier_pos++;
+ lppt[ bezier_pos ] = lppt[ bezier_pos-1 ];
+ bezier_pos++;
+
+ node = node->GetNext();
+ p = node->GetData();
+
+ x2 = p->x;
+ y2 = p->y;
+ cx1 = ( x1 + x2 ) / 2;
+ cy1 = ( y1 + y2 ) / 2;
+ lppt[ bezier_pos ].x = XLOG2DEV(cx1);
+ lppt[ bezier_pos ].y = YLOG2DEV(cy1);
+ bezier_pos++;
+ lppt[ bezier_pos ] = lppt[ bezier_pos-1 ];
+ bezier_pos++;
+
+#if !wxUSE_STD_CONTAINERS
+ while ((node = node->GetNext()) != NULL)
+#else
+ while ((node = node->GetNext()))
+#endif // !wxUSE_STD_CONTAINERS
+ {
+ p = (wxPoint *)node->GetData();
+ x1 = x2;
+ y1 = y2;
+ x2 = p->x;
+ y2 = p->y;
+ cx4 = (x1 + x2) / 2;
+ cy4 = (y1 + y2) / 2;
+ // B0 is B3 of previous segment
+ // B1:
+ lppt[ bezier_pos ].x = XLOG2DEV((x1*2+cx1)/3);
+ lppt[ bezier_pos ].y = YLOG2DEV((y1*2+cy1)/3);
+ bezier_pos++;
+ // B2:
+ lppt[ bezier_pos ].x = XLOG2DEV((x1*2+cx4)/3);
+ lppt[ bezier_pos ].y = YLOG2DEV((y1*2+cy4)/3);
+ bezier_pos++;
+ // B3:
+ lppt[ bezier_pos ].x = XLOG2DEV(cx4);
+ lppt[ bezier_pos ].y = YLOG2DEV(cy4);
+ bezier_pos++;
+ cx1 = cx4;
+ cy1 = cy4;
+ }
+
+ lppt[ bezier_pos ] = lppt[ bezier_pos-1 ];
+ bezier_pos++;
+ lppt[ bezier_pos ].x = XLOG2DEV(x2);
+ lppt[ bezier_pos ].y = YLOG2DEV(y2);
+ bezier_pos++;
+ lppt[ bezier_pos ] = lppt[ bezier_pos-1 ];
+ bezier_pos++;
+
+ ::PolyBezier( GetHdc(), lppt, bezier_pos );
+
+ free(lppt);
+}
+#endif // wxUSE_SPLINES
+
+// Chris Breeze 20/5/98: first implementation of DrawEllipticArc on Windows
+void wxMSWDCImpl::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea)
+{
+#ifdef __WXWINCE__
+ DoDrawEllipticArcRot( x, y, w, h, sa, ea );
+#else
+
+ WXMICROWIN_CHECK_HDC
+
+ wxBrushAttrsSetter cc(*this); // needed for wxSTIPPLE_MASK_OPAQUE handling
+
+ wxCoord x2 = x + w;
+ wxCoord y2 = y + h;
+
+ int rx1 = XLOG2DEV(x+w/2);
+ int ry1 = YLOG2DEV(y+h/2);
+ int rx2 = rx1;
+ int ry2 = ry1;
+
+ sa = DegToRad(sa);
+ ea = DegToRad(ea);
+
+ rx1 += (int)(100.0 * abs(w) * cos(sa));
+ ry1 -= (int)(100.0 * abs(h) * m_signY * sin(sa));
+ rx2 += (int)(100.0 * abs(w) * cos(ea));
+ ry2 -= (int)(100.0 * abs(h) * m_signY * sin(ea));
+
+ // Swap start and end positions if the end angle is less than the start angle.
+ if (ea < sa) {
+ int temp;
+ temp = rx2;
+ rx2 = rx1;
+ rx1 = temp;
+ temp = ry2;
+ ry2 = ry1;
+ ry1 = temp;
+ }
+
+ // draw pie with NULL_PEN first and then outline otherwise a line is
+ // drawn from the start and end points to the centre
+ HPEN hpenOld = (HPEN) ::SelectObject(GetHdc(), (HPEN) ::GetStockObject(NULL_PEN));
+ if (m_signY > 0)
+ {
+ (void)Pie(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), XLOG2DEV(x2)+1, YLOG2DEV(y2)+1,
+ rx1, ry1, rx2, ry2);
+ }
+ else
+ {
+ (void)Pie(GetHdc(), XLOG2DEV(x), YLOG2DEV(y)-1, XLOG2DEV(x2)+1, YLOG2DEV(y2),
+ rx1, ry1-1, rx2, ry2-1);
+ }
+
+ ::SelectObject(GetHdc(), hpenOld);
+
+ (void)Arc(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), XLOG2DEV(x2), YLOG2DEV(y2),
+ rx1, ry1, rx2, ry2);
+
+ CalcBoundingBox(x, y);
+ CalcBoundingBox(x2, y2);
+#endif
+}
+
+void wxMSWDCImpl::DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y)
+{
+ WXMICROWIN_CHECK_HDC
+
+ wxCHECK_RET( icon.IsOk(), wxT("invalid icon in DrawIcon") );
+
+#ifdef __WIN32__
+ ::DrawIconEx(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), GetHiconOf(icon), icon.GetWidth(), icon.GetHeight(), 0, NULL, DI_NORMAL);
+#else
+ ::DrawIcon(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), GetHiconOf(icon));
+#endif
+
+ CalcBoundingBox(x, y);
+ CalcBoundingBox(x + icon.GetWidth(), y + icon.GetHeight());
+}
+
+void wxMSWDCImpl::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask )
+{
+ WXMICROWIN_CHECK_HDC
+
+ wxCHECK_RET( bmp.IsOk(), wxT("invalid bitmap in wxMSWDCImpl::DrawBitmap") );
+
+ int width = bmp.GetWidth(),
+ height = bmp.GetHeight();
+
+ HBITMAP hbmpMask = 0;
+
+#if wxUSE_PALETTE
+ HPALETTE oldPal = 0;
+#endif // wxUSE_PALETTE
+
+ if ( bmp.HasAlpha() )
+ {
+ MemoryHDC hdcMem;
+ SelectInHDC select(hdcMem, GetHbitmapOf(bmp));
+
+ if ( AlphaBlt(GetHdc(), x, y, width, height, 0, 0, width, height, hdcMem, bmp) )
+ return;
+ }
+
+ SET_STRETCH_BLT_MODE(GetHdc());
+
+ if ( useMask )
+ {
+ wxMask *mask = bmp.GetMask();
+ if ( mask )
+ hbmpMask = (HBITMAP)mask->GetMaskBitmap();
+
+ if ( !hbmpMask )
+ {
+ // don't give assert here because this would break existing
+ // programs - just silently ignore useMask parameter
+ useMask = false;
+ }
+ }
+ if ( useMask )
+ {
+#ifdef __WIN32__
+ // use MaskBlt() with ROP which doesn't do anything to dst in the mask
+ // points
+ bool ok = false;
+
+#if wxUSE_SYSTEM_OPTIONS
+ // On some systems, MaskBlt succeeds yet is much much slower
+ // than the wxWidgets fall-back implementation. So we need
+ // to be able to switch this on and off at runtime.
+ //
+ // NB: don't query the value of the option every time but do it only
+ // once as otherwise it can have real (and bad) performance
+ // implications (see #11172)
+ static bool
+ s_maskBltAllowed = wxSystemOptions::GetOptionInt("no-maskblt") == 0;
+ if ( s_maskBltAllowed )
+#endif // wxUSE_SYSTEM_OPTIONS
+ {
+ HDC cdc = GetHdc();
+ HDC hdcMem = wxMSW::CreateCompatibleDCWithLayout(cdc);
+ HGDIOBJ hOldBitmap = ::SelectObject(hdcMem, GetHbitmapOf(bmp));
+#if wxUSE_PALETTE
+ wxPalette *pal = bmp.GetPalette();
+ if ( pal && ::GetDeviceCaps(cdc,BITSPIXEL) <= 8 )
+ {
+ oldPal = ::SelectPalette(hdcMem, GetHpaletteOf(*pal), FALSE);
+ ::RealizePalette(hdcMem);
+ }
+#endif // wxUSE_PALETTE
+
+ ok = ::MaskBlt(cdc, x, y, width, height,
+ hdcMem, 0, 0,
+ hbmpMask, 0, 0,
+ MAKEROP4(SRCCOPY, DSTCOPY)) != 0;
+
+#if wxUSE_PALETTE
+ if (oldPal)
+ ::SelectPalette(hdcMem, oldPal, FALSE);
+#endif // wxUSE_PALETTE
+
+ ::SelectObject(hdcMem, hOldBitmap);
+ ::DeleteDC(hdcMem);
+ }
+
+ if ( !ok )
+#endif // Win32
+ {
+ // Rather than reproduce wxMSWDCImpl::Blit, let's do it at the wxWin API
+ // level
+ wxMemoryDC memDC;
+
+ memDC.SetLayoutDirection(GetLayoutDirection());
+ memDC.SelectObjectAsSource(bmp);
+
+ GetOwner()->Blit(x, y, width, height, &memDC, 0, 0, wxCOPY, useMask);
+ }
+ }
+ else // no mask, just use BitBlt()
+ {
+ HDC cdc = GetHdc();
+ HDC memdc = wxMSW::CreateCompatibleDCWithLayout( cdc );
+ HBITMAP hbitmap = (HBITMAP) bmp.GetHBITMAP( );
+
+ wxASSERT_MSG( hbitmap, wxT("bitmap is ok but HBITMAP is NULL?") );
+
+ wxTextColoursChanger textCol(GetHdc(), *this);
+
+#if wxUSE_PALETTE
+ wxPalette *pal = bmp.GetPalette();
+ if ( pal && ::GetDeviceCaps(cdc,BITSPIXEL) <= 8 )
+ {
+ oldPal = ::SelectPalette(memdc, GetHpaletteOf(*pal), FALSE);
+ ::RealizePalette(memdc);
+ }
+#endif // wxUSE_PALETTE
+
+ HGDIOBJ hOldBitmap = ::SelectObject( memdc, hbitmap );
+ ::BitBlt( cdc, x, y, width, height, memdc, 0, 0, SRCCOPY);
+
+#if wxUSE_PALETTE
+ if (oldPal)
+ ::SelectPalette(memdc, oldPal, FALSE);
+#endif // wxUSE_PALETTE
+
+ ::SelectObject( memdc, hOldBitmap );
+ ::DeleteDC( memdc );
+ }
+}
+
+void wxMSWDCImpl::DoDrawText(const wxString& text, wxCoord x, wxCoord y)
+{
+ // For compatibility with other ports (notably wxGTK) and because it's
+ // genuinely useful, we allow passing multiline strings to DrawText().
+ // However there is no native MSW function to draw them directly so we
+ // instead reuse the generic DrawLabel() method to render them. Of course,
+ // DrawLabel() itself will call back to us but with single line strings
+ // only so there won't be any infinite recursion here.
+ if ( text.find('\n') != wxString::npos )
+ {
+ GetOwner()->DrawLabel(text, wxRect(x, y, 0, 0));
+ return;
+ }
+
+ WXMICROWIN_CHECK_HDC
+
+ DrawAnyText(text, x, y);
+
+ // update the bounding box
+ CalcBoundingBox(x, y);
+
+ wxCoord w, h;
+ GetOwner()->GetTextExtent(text, &w, &h);
+ CalcBoundingBox(x + w, y + h);
+}
+
+void wxMSWDCImpl::DrawAnyText(const wxString& text, wxCoord x, wxCoord y)
+{
+ WXMICROWIN_CHECK_HDC
+
+ // prepare for drawing the text
+ wxTextColoursChanger textCol(GetHdc(), *this);
+
+ wxBkModeChanger bkMode(GetHdc(), m_backgroundMode);
+
+ if ( ::ExtTextOut(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), 0, NULL,
+ text.c_str(), text.length(), NULL) == 0 )
+ {
+ wxLogLastError(wxT("TextOut"));
+ }
+}
+
+void wxMSWDCImpl::DoDrawRotatedText(const wxString& text,
+ wxCoord x, wxCoord y,
+ double angle)
+{
+ WXMICROWIN_CHECK_HDC
+
+ // we test that we have some font because otherwise we should still use the
+ // "else" part below to avoid that DrawRotatedText(angle = 180) and
+ // DrawRotatedText(angle = 0) use different fonts (we can't use the default
+ // font for drawing rotated fonts unfortunately)
+ if ( (angle == 0.0) && m_font.IsOk() )
+ {
+ DoDrawText(text, x, y);
+ }
+#ifndef __WXMICROWIN__
+ else
+ {
+ // NB: don't take DEFAULT_GUI_FONT (a.k.a. wxSYS_DEFAULT_GUI_FONT)
+ // because it's not TrueType and so can't have non zero
+ // orientation/escapement under Win9x
+ wxFont font = m_font.IsOk() ? m_font : *wxSWISS_FONT;
+ HFONT hfont = (HFONT)font.GetResourceHandle();
+ LOGFONT lf;
+ if ( ::GetObject(hfont, sizeof(lf), &lf) == 0 )
+ {
+ wxLogLastError(wxT("GetObject(hfont)"));
+ }
+
+ // GDI wants the angle in tenth of degree
+ long angle10 = (long)(angle * 10);
+ lf.lfEscapement = angle10;
+ lf. lfOrientation = angle10;
+
+ hfont = ::CreateFontIndirect(&lf);
+ if ( !hfont )
+ {
+ wxLogLastError(wxT("CreateFont"));
+ }
+ else
+ {
+ HFONT hfontOld = (HFONT)::SelectObject(GetHdc(), hfont);
+
+ DrawAnyText(text, x, y);
+
+ (void)::SelectObject(GetHdc(), hfontOld);
+ (void)::DeleteObject(hfont);
+ }
+
+ // call the bounding box by adding all four vertices of the rectangle
+ // containing the text to it (simpler and probably not slower than
+ // determining which of them is really topmost/leftmost/...)
+ wxCoord w, h;
+ GetOwner()->GetTextExtent(text, &w, &h);
+
+ double rad = DegToRad(angle);
+
+ // "upper left" and "upper right"
+ CalcBoundingBox(x, y);
+ CalcBoundingBox(x + wxCoord(w*cos(rad)), y - wxCoord(w*sin(rad)));
+
+ // "bottom left" and "bottom right"
+ x += (wxCoord)(h*sin(rad));
+ y += (wxCoord)(h*cos(rad));
+ CalcBoundingBox(x, y);
+ CalcBoundingBox(x + wxCoord(w*cos(rad)), y - wxCoord(w*sin(rad)));
+ }
+#endif
+}
+
+// ---------------------------------------------------------------------------
+// set GDI objects
+// ---------------------------------------------------------------------------
+
+#if wxUSE_PALETTE
+
+void wxMSWDCImpl::DoSelectPalette(bool realize)
+{
+ WXMICROWIN_CHECK_HDC
+
+ // Set the old object temporarily, in case the assignment deletes an object
+ // that's not yet selected out.
+ if (m_oldPalette)
+ {
+ ::SelectPalette(GetHdc(), (HPALETTE) m_oldPalette, FALSE);
+ m_oldPalette = 0;
+ }
+
+ if ( m_palette.IsOk() )
+ {
+ HPALETTE oldPal = ::SelectPalette(GetHdc(),
+ GetHpaletteOf(m_palette),
+ false);
+ if (!m_oldPalette)
+ m_oldPalette = (WXHPALETTE) oldPal;
+
+ if (realize)
+ ::RealizePalette(GetHdc());
+ }
+}
+
+void wxMSWDCImpl::SetPalette(const wxPalette& palette)
+{
+ if ( palette.IsOk() )
+ {
+ m_palette = palette;
+ DoSelectPalette(true);
+ }
+}
+
+void wxMSWDCImpl::InitializePalette()
+{
+ if ( wxDisplayDepth() <= 8 )
+ {
+ // look for any window or parent that has a custom palette. If any has
+ // one then we need to use it in drawing operations
+ wxWindow *win = m_window->GetAncestorWithCustomPalette();
+
+ m_hasCustomPalette = win && win->HasCustomPalette();
+ if ( m_hasCustomPalette )
+ {
+ m_palette = win->GetPalette();
+
+ // turn on MSW translation for this palette
+ DoSelectPalette();
+ }
+ }
+}
+
+#endif // wxUSE_PALETTE
+
+// SetFont/Pen/Brush() really ask to be implemented as a single template
+// function... but doing it is not worth breaking OpenWatcom build <sigh>
+
+void wxMSWDCImpl::SetFont(const wxFont& font)
+{
+ WXMICROWIN_CHECK_HDC
+
+ if ( font == m_font )
+ return;
+
+ if ( font.IsOk() )
+ {
+ HGDIOBJ hfont = ::SelectObject(GetHdc(), GetHfontOf(font));
+ if ( hfont == HGDI_ERROR )
+ {
+ wxLogLastError(wxT("SelectObject(font)"));
+ }
+ else // selected ok
+ {
+ if ( !m_oldFont )
+ m_oldFont = (WXHFONT)hfont;
+
+ m_font = font;
+ }
+ }
+ else // invalid font, reset the current font
+ {
+ if ( m_oldFont )
+ {
+ if ( ::SelectObject(GetHdc(), (HPEN) m_oldFont) == HGDI_ERROR )
+ {
+ wxLogLastError(wxT("SelectObject(old font)"));
+ }
+
+ m_oldFont = 0;
+ }
+
+ m_font = wxNullFont;
+ }
+}
+
+void wxMSWDCImpl::SetPen(const wxPen& pen)
+{
+ WXMICROWIN_CHECK_HDC
+
+ if ( pen == m_pen )
+ return;
+
+ if ( pen.IsOk() )
+ {
+ HGDIOBJ hpen = ::SelectObject(GetHdc(), GetHpenOf(pen));
+ if ( hpen == HGDI_ERROR )
+ {
+ wxLogLastError(wxT("SelectObject(pen)"));
+ }
+ else // selected ok
+ {
+ if ( !m_oldPen )
+ m_oldPen = (WXHPEN)hpen;
+
+ m_pen = pen;
+ }
+ }
+ else // invalid pen, reset the current pen
+ {
+ if ( m_oldPen )
+ {
+ if ( ::SelectObject(GetHdc(), (HPEN) m_oldPen) == HGDI_ERROR )
+ {
+ wxLogLastError(wxT("SelectObject(old pen)"));
+ }
+
+ m_oldPen = 0;
+ }
+
+ m_pen = wxNullPen;
+ }
+}
+
+void wxMSWDCImpl::SetBrush(const wxBrush& brush)
+{
+ WXMICROWIN_CHECK_HDC
+
+ if ( brush == m_brush )
+ return;
+
+ if ( brush.IsOk() )
+ {
+ // we must make sure the brush is aligned with the logical coordinates
+ // before selecting it or using the same brush for the background of
+ // different windows would result in discontinuities
+ wxSize sizeBrushBitmap = wxDefaultSize;
+ wxBitmap *stipple = brush.GetStipple();
+ if ( stipple && stipple->IsOk() )
+ sizeBrushBitmap = stipple->GetSize();
+ else if ( brush.IsHatch() )
+ sizeBrushBitmap = wxSize(8, 8);
+
+ if ( sizeBrushBitmap.IsFullySpecified() )
+ {
+ if ( !::SetBrushOrgEx
+ (
+ GetHdc(),
+ m_deviceOriginX % sizeBrushBitmap.x,
+ m_deviceOriginY % sizeBrushBitmap.y,
+ NULL // [out] previous brush origin
+ ) )
+ {
+ wxLogLastError(wxT("SetBrushOrgEx()"));
+ }
+ }
+
+ HGDIOBJ hbrush = ::SelectObject(GetHdc(), GetHbrushOf(brush));
+ if ( hbrush == HGDI_ERROR )
+ {
+ wxLogLastError(wxT("SelectObject(brush)"));
+ }
+ else // selected ok
+ {
+ if ( !m_oldBrush )
+ m_oldBrush = (WXHBRUSH)hbrush;
+
+ m_brush = brush;
+ }
+ }
+ else // invalid brush, reset the current brush
+ {
+ if ( m_oldBrush )
+ {
+ if ( ::SelectObject(GetHdc(), (HPEN) m_oldBrush) == HGDI_ERROR )
+ {
+ wxLogLastError(wxT("SelectObject(old brush)"));
+ }
+
+ m_oldBrush = 0;
+ }
+
+ m_brush = wxNullBrush;
+ }
+}
+
+void wxMSWDCImpl::SetBackground(const wxBrush& brush)
+{
+ WXMICROWIN_CHECK_HDC
+
+ m_backgroundBrush = brush;
+
+ if ( m_backgroundBrush.IsOk() )
+ {
+ (void)SetBkColor(GetHdc(), m_backgroundBrush.GetColour().GetPixel());
+ }
+}
+
+void wxMSWDCImpl::SetBackgroundMode(int mode)
+{
+ WXMICROWIN_CHECK_HDC
+
+ m_backgroundMode = mode;
+
+ // SetBackgroundColour now only refers to text background
+ // and m_backgroundMode is used there
+}
+
+void wxMSWDCImpl::SetLogicalFunction(wxRasterOperationMode function)
+{
+ WXMICROWIN_CHECK_HDC
+
+ m_logicalFunction = function;
+
+ SetRop(m_hDC);
+}
+
+void wxMSWDCImpl::SetRop(WXHDC dc)
+{
+ if ( !dc || m_logicalFunction < 0 )
+ return;
+
+ int rop;
+
+ switch (m_logicalFunction)
+ {
+ case wxCLEAR: rop = R2_BLACK; break;
+ case wxXOR: rop = R2_XORPEN; break;
+ case wxINVERT: rop = R2_NOT; break;
+ case wxOR_REVERSE: rop = R2_MERGEPENNOT; break;
+ case wxAND_REVERSE: rop = R2_MASKPENNOT; break;
+ case wxCOPY: rop = R2_COPYPEN; break;
+ case wxAND: rop = R2_MASKPEN; break;
+ case wxAND_INVERT: rop = R2_MASKNOTPEN; break;
+ case wxNO_OP: rop = R2_NOP; break;
+ case wxNOR: rop = R2_NOTMERGEPEN; break;
+ case wxEQUIV: rop = R2_NOTXORPEN; break;
+ case wxSRC_INVERT: rop = R2_NOTCOPYPEN; break;
+ case wxOR_INVERT: rop = R2_MERGENOTPEN; break;
+ case wxNAND: rop = R2_NOTMASKPEN; break;
+ case wxOR: rop = R2_MERGEPEN; break;
+ case wxSET: rop = R2_WHITE; break;
+ default:
+ wxFAIL_MSG( wxS("unknown logical function") );
+ return;
+ }
+
+ SetROP2(GetHdc(), rop);
+}
+
+bool wxMSWDCImpl::StartDoc(const wxString& WXUNUSED(message))
+{
+ // We might be previewing, so return true to let it continue.
+ return true;
+}
+
+void wxMSWDCImpl::EndDoc()
+{
+}
+
+void wxMSWDCImpl::StartPage()
+{
+}
+
+void wxMSWDCImpl::EndPage()
+{
+}
+
+// ---------------------------------------------------------------------------
+// text metrics
+// ---------------------------------------------------------------------------
+
+wxCoord wxMSWDCImpl::GetCharHeight() const
+{
+ WXMICROWIN_CHECK_HDC_RET(0)
+
+ TEXTMETRIC lpTextMetric;
+
+ GetTextMetrics(GetHdc(), &lpTextMetric);
+
+ return lpTextMetric.tmHeight;
+}
+
+wxCoord wxMSWDCImpl::GetCharWidth() const
+{
+ WXMICROWIN_CHECK_HDC_RET(0)
+
+ TEXTMETRIC lpTextMetric;
+
+ GetTextMetrics(GetHdc(), &lpTextMetric);
+
+ return lpTextMetric.tmAveCharWidth;