CPen
-
I want to write Bold data (28 points) on a Dialog...against a buutton click here is code snippet { CPen pen; pen.CreatePen(PS_SOLID,28,RGB(255,0,0)); CDC* pDC=GetDC(); pDC->SelectObject(&pen); pDC->TextOut("Computer is the killer of nature"); } it writes data but not bold and Selected color.. Can any one tell where I am doing wrong
-
I want to write Bold data (28 points) on a Dialog...against a buutton click here is code snippet { CPen pen; pen.CreatePen(PS_SOLID,28,RGB(255,0,0)); CDC* pDC=GetDC(); pDC->SelectObject(&pen); pDC->TextOut("Computer is the killer of nature"); } it writes data but not bold and Selected color.. Can any one tell where I am doing wrong
It is not the pen you should change, but the font. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
-
It is not the pen you should change, but the font. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
-
for example :
// m_Font is a class member of a dialog.
m_Font.CreateFont( 15, 0, 0, 0, FW_BOLD, FALSE, FALSE, 0,
DEFAULT_CHARSET, OUT_CHARACTER_PRECIS,
CLIP_CHARACTER_PRECIS, DEFAULT_QUALITY,
DEFAULT_PITCH | FF_DONTCARE, _T("Arial") );
...
// somewhere in the paint.
HFONT hfontOld;
hfontOld = (HFONT)SelectObject(dc.m_hDC, m_Font);
// do something... with the DC ( draw the text.
::SelectObject(dc.m_hDC, hfontOld);
...Also, you can maybe search and enumerate the font name just in case "Arial" does not exists. Max.