SetTextColor
The SetTextColor function sets the text color for the specified device context to the specified color. COLORREF SetTextColor(
  HDC hdc,           // handle to device context
  COLORREF crColor   // text color
);
 
Parameters
hdc 
Handle to the device context. 
crColor 
Specifies the color of the text. 
Return Values
If the function succeeds, the return value is a color reference for the previous text color.If the function fails, the return value is CLR_INVALID. Windows NT: To get extended error information, callGetLastError. Res
The text color is used to draw the face of each character written by the TextOut and ExtTextOut functions. The text color is also used in converting bitmaps from color to monochrome and vice versa. QuickInfo
  Windows NT: Requires version 3.1 or later.
  Windows: Requires Windows 95 or later.
  Windows CE: Requires version 1.0 or later.
  Header: Declared in wingdi.h.
  Import Library: Use gdi32.lib.See Also
Fonts and Text Overview, Font and Text Functions, BitBlt, ExtTextOut, GetTextColor, RGB, SetBkColor, StretchBlt, TextOut  

解决方案 »

  1.   

    //////       CView::OnChar(nChar, nRepCnt, nFlags);  
      

  2.   

    CDC::SetTextColor 
    virtual COLORREF SetTextColor( COLORREF crColor );Return ValueAn RGB value for the previous text color.ParameterscrColorSpecifies the color of the text as an RGB color value.ResSets the text color to the specified color. The system will use this text color when writing text to this device context and also when converting bitmaps between color and monochrome device contexts. If the device cannot represent the specified color, the system sets the text color to the nearest physical color. The background color for a character is specified by the SetBkColor and SetBkMode member functions.CDC Overview |  Class Members |  Hierarchy ChartSee Also   CDC::GetTextColor, CDC::BitBlt, CDC::SetBkColor, CDC::SetBkMode,::SetTextColor
      

  3.   

    汗它返回的是上一个值,就跟HGDIOBJ SelectObject(__in HDC hdc, __in HGDIOBJ h)一样