Changing the BG color of a multiline edit box
-
Hi all, I have three questions about changing an edit box BG color: I am trying to change the background color of a multi line edit box, I use the WM_CTLCOLOR message and it works but: First: initially, when the color changes, the area that changes is only the first line of the edit box (the first line has the desired background color, while the other lines have the white(default) background color), and as I add lines (Enter Key) the following line changes color and so on. how to solve this situation? I want the whole control to be painted with the desired bg color. Second, Even when I change the color of a single line edit box, the color changes, but there still small rectangles of the default bg color in the bottom and the right side of the edit box, it really doesnt exactly have the same effect as writing in VB: Text1.BGColor=vbBlack Why?!!! Thrid and last, When I use the WM_CTLCOLOR message to change my edit box bg color, if the Locked state of the edit box is set, the color is not changed at all, I dont think its wrong to have a locked edit box with a black bg color. how to solve this? I hope I will find some help here. Regards, Mohammad Gdeisat
-
Hi all, I have three questions about changing an edit box BG color: I am trying to change the background color of a multi line edit box, I use the WM_CTLCOLOR message and it works but: First: initially, when the color changes, the area that changes is only the first line of the edit box (the first line has the desired background color, while the other lines have the white(default) background color), and as I add lines (Enter Key) the following line changes color and so on. how to solve this situation? I want the whole control to be painted with the desired bg color. Second, Even when I change the color of a single line edit box, the color changes, but there still small rectangles of the default bg color in the bottom and the right side of the edit box, it really doesnt exactly have the same effect as writing in VB: Text1.BGColor=vbBlack Why?!!! Thrid and last, When I use the WM_CTLCOLOR message to change my edit box bg color, if the Locked state of the edit box is set, the color is not changed at all, I dont think its wrong to have a locked edit box with a black bg color. how to solve this? I hope I will find some help here. Regards, Mohammad Gdeisat
You should be using WM_CTLCOLOREDIT. Also you should return the handle of the brush that Windows should use to paint the background of the control. If you just use SetBkColor and don't return a brush handle then I seem to recall that you get the results you describe. Hope that's of some help.