Home > Software engineering >  CFont CDC write font how vague and colored
CFont CDC write font how vague and colored

Time:09-19

Received, how is this not clear font, as the chart, the following code
CFont newfont;//used to save the new font
CFont * oldFont;//is used to store the old font
Newfont. CreateFont (
12,
5,
0,
0,
0,//FW_THIN, FW_NORMAL
FALSE,
FALSE,
0,
ANSI_CHARSET.
OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,
PROOF_QUALITY,//DRAFT_QUALITY,//DEFAULT_QUALITY,
DEFAULT_PITCH | FF_SWISS,
_T (" Arial ")
);//create a new font
OldFont=pDC - & gt; SelectObject (& amp; Newfont);//select a new font
PDC - & gt; SetTextColor (RGB (0, 0));//set the font color

//...
DrawAccelerationX (pDC);
DrawAccelerationY (pDC);
DrawVelocityX (pDC);
DrawVelocityY (pDC);
//...

PDC - & gt; SelectObject (oldFont);//choice back to the old font
Newfont. DeleteObject ();//delete the new font

CodePudding user response:

PDC - & gt; SetBkMode (TRANSPARENT);//set the background transparent

CodePudding user response:

reference 1st floor zgl7903 response:
pDC - & gt; SetBkMode (TRANSPARENT);//set the background transparent


Has already been set up in a child function, not the problem,
You see in the picture, is the clear word

CodePudding user response:

Change the font height try
Newfont. CreateFont (- MulDiv (12, pDC - & gt; GetDeviceCaps (LOGPIXELSY), 72),


CodePudding user response:

No, no

CodePudding user response:

Repeat made?

CodePudding user response:

This code is written in the book where you the OnPaint?

CodePudding user response:

refer to 6th floor to the appointed day response:
where you write the code is the OnPaint?


Only the last paste a bitmap a OnPaint

CodePudding user response:

Similar thing I ever did, didn't appear such problems
Refer to https://blog.csdn.net/xianglitian/article/details/6100767
  • Related