Posted June 19, 201213 yr I subclassed a label(static text) control to avoid text flicking,and dealed with WM_SETTEXT of label's message,however, the bitblt function didn't work.Thank you. Attachment is the c++ source.//label's subclass wndProcchar szBuf[512]={0};HDC hdc, hdcMem;if(message == WM_SETTEXT) {strcpy(szBuf, (char *)lParam);lParam = 0;hdc = GetDC(hLabel);hdcMem = CreateCompatibleDC(hdc);SetTextColor(hdcMem, RGB(255,0,0)); TextOut(hdcMem, 0, 0, szBuf, strlen(szBuf));BitBlt(hdc, 0, 0, 300, 300, hdcMem, 0, 0, SRCCOPY);DeleteDC(hdcMem);ReleaseDC(hLabel, hdc);return 0;}flickerLabel.zip Edited June 20, 201213 yr by alaphate
June 19, 201213 yr Hmm,I don't know about the flicker... Maybe you should handle the WM_CTLCOLORSTATIC message.Look here for an example of how to do that...Greetings,Mr. eXoDia
June 20, 201213 yr Author Mr. eXoDia,Thank you for the example, WM_CTLCOLORSTATIC is used to changeStatic Text or readonly Edit Box's font color and background.To avoid text blinking when it is updated very frequently, double buffer HDCshould be used.The problem is that I couldn't make BitBlt take effect.
June 20, 201213 yr Author If I select a bitmap to hdcMem and draw text on it, BitBlt will work. It's resolved Edited June 20, 201213 yr by alaphate
Create an account or sign in to comment