alaphate Posted June 19, 2012 Share Posted June 19, 2012 (edited) 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, 2012 by alaphate Link to comment
mrexodia Posted June 19, 2012 Share Posted June 19, 2012 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 Link to comment
alaphate Posted June 20, 2012 Author Share Posted June 20, 2012 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. Link to comment
alaphate Posted June 20, 2012 Author Share Posted June 20, 2012 (edited) If I select a bitmap to hdcMem and draw text on it, BitBlt will work. It's resolved Edited June 20, 2012 by alaphate Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now