+
+ ::SetTextColor(GetHdc(), old_textground);
+ ::SetBkColor(GetHdc(), old_background);
+ }
+}
+
+void wxDC::DoDrawText(const wxString& text, wxCoord x, wxCoord y)
+{
+#ifdef __WXMICROWIN__
+ if (!GetHDC()) return;
+#endif
+
+ DrawAnyText(text, x, y);
+
+ // update the bounding box
+ CalcBoundingBox(x, y);
+
+ wxCoord w, h;
+ GetTextExtent(text, &w, &h);
+ CalcBoundingBox(x + w, y + h);
+}
+
+void wxDC::DrawAnyText(const wxString& text, wxCoord x, wxCoord y)
+{
+#ifdef __WXMICROWIN__
+ if (!GetHDC()) return;
+#endif
+
+ // prepare for drawing the text
+ if ( m_textForegroundColour.Ok() )
+ SetTextColor(GetHdc(), m_textForegroundColour.GetPixel());
+
+ DWORD old_background = 0;
+ if ( m_textBackgroundColour.Ok() )
+ {
+ old_background = SetBkColor(GetHdc(), m_textBackgroundColour.GetPixel() );
+ }
+
+ SetBkMode(GetHdc(), m_backgroundMode == wxTRANSPARENT ? TRANSPARENT
+ : OPAQUE);
+
+ if ( ::TextOut(GetHdc(), XLOG2DEV(x), YLOG2DEV(y),
+ text.c_str(), text.length()) == 0 )
+ {
+ wxLogLastError(wxT("TextOut"));
+ }
+
+ // restore the old parameters (text foreground colour may be left because
+ // it never is set to anything else, but background should remain
+ // transparent even if we just drew an opaque string)
+ if ( m_textBackgroundColour.Ok() )
+ (void)SetBkColor(GetHdc(), old_background);
+
+ SetBkMode(GetHdc(), TRANSPARENT);
+}
+
+void wxDC::DoDrawRotatedText(const wxString& text,
+ wxCoord x, wxCoord y,
+ double angle)
+{
+#ifdef __WXMICROWIN__
+ if (!GetHDC()) return;
+#endif
+
+ // 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.Ok() )
+ {
+ DoDrawText(text, x, y);