Re: Changing color and Font of CString



AnuBala wrote:

Hi,
iam copying a text to a CString variable,Here can i change the color
and font of the text in my coding.
Like strcpy(czVal,"MAN");
here MAN should be bold and underline...
How can i chnge this,,Is thre anyway?


AnuBala:

CString can hold only text, not other attributes. You could make a struct, something like this:

struct FormattedString
{
CString text;
COLORREF color;
CFont* pFont;
};

David Wilkinson
.



Relevant Pages

  • Changing color and Font of CString
    ... iam copying a text to a CString variable,Here can i change the color ... and font of the text in my coding. ...
    (microsoft.public.vc.mfc)
  • Re: Changing color and Font of CString
    ... You might as well try to change the font and color of an integer. ... A CString is just that: a sequence of characters. ... Now, that said, it *is* possible to encode font and color information in a string, but I ...
    (microsoft.public.vc.mfc)
  • Re: CListCtrl unicode doesnt display korean characters correctly
    ... Your assumptions are ok about the not described types, Strings are CString, not arrays of TCHARs ... It is a font from Microsoft. ... The korean string is in case 2. ... The LoadString method gets it from the resources. ...
    (microsoft.public.vc.mfc)
  • Re: LBUTTONDOWN() problem
    ... I have written a piece of code to increment the font size of text ... int x1=point.x; ... lbuttondown's CPoint point argument, but on second button click it ... TextTuple(CPoint p, int sz, const CString & t, const CString & fn) ...
    (microsoft.public.vc.mfc)
  • Re: about font
    ... is whatever char you want ... If using CString you can use: ... Uses the currently selected Font, so if you want it for a different one you'd need to select that font into the DC first.... ... font characters. ...
    (microsoft.public.vc.mfc)

Loading