Help!! How to change the ListBox and EditBox background & text color without using MFC!! Thanks..
-
Hi. I had tried using LBS_OWNERDRAWFIXED function when I create a new window for LISTBOX. I can received the WM_DRAWITEM message and changed the text with background color then send text to display (I used 'TextOut' function.) as far, the work is find , there will be able display which one message with color I want to display on listbox window, but when next message "WM_PAINT" will clear all, let the window blank. can you tell me what's wrong I got?? If possible that I can got the Listbox item HDC directly without using LBS_OWNERDRAWFIXED?? If can then how about the EditBox HDC?? Thanks for you helps. Jason.
-
Hi. I had tried using LBS_OWNERDRAWFIXED function when I create a new window for LISTBOX. I can received the WM_DRAWITEM message and changed the text with background color then send text to display (I used 'TextOut' function.) as far, the work is find , there will be able display which one message with color I want to display on listbox window, but when next message "WM_PAINT" will clear all, let the window blank. can you tell me what's wrong I got?? If possible that I can got the Listbox item HDC directly without using LBS_OWNERDRAWFIXED?? If can then how about the EditBox HDC?? Thanks for you helps. Jason.
The WM_CTLCOLORLISTBOX message is sent to the parent window of a list box before the system draws the list box. WM_CTCOLOREDIT too. By responding to this message, the parent window can set the text and background colors of the list box by using the given display device context handle. WM_CTLCOLORLISTBOX hdcLB = (HDC) wParam;// handle to list box display context hwndLB = (HWND) lParam; // handle to list box This is for 32 bit only for 16 you have just WM_CTLCOLOR and then need to switch on the WPARAM