I got a problem with a multiline read only edit control. I use lcc-win32 as ide and placed a multiline edit control on a dialog. The edit control is set to read only and I create the white background with:
This works ok. But the problem starts when I use the scrollbars to move the edit box horizontal en vertical. Because of the colorstatic event the text gets mangled and therefore I useCode://-------------------------------------------- // Set background white of read only edits //-------------------------------------------- case WM_CTLCOLORSTATIC: if (IDC_TXTEMAIL == GetDlgCtrlID((HWND)lParam)) { SetTextColor((HDC)wParam, RGB(0, 0, 0)); SetBkMode((HDC)wParam, TRANSPARENT); return (LRESULT)GetStockObject(WHITE } break;
In the WM_COMMAND section of the dialog handler. When the edit control gets a EN_VSCROLL or EN_HSCROLL I make a call to invalidaterect and the scrolling looks ok. This only works when I move around in the edit with the cursor. So I need to invalidaterect when the scrollbars are moved. First I tried catching WM_VSCROLL and WM_HSCROLL messages in the dialog handler. But these events don't get triggered. After that I subclassed the edit control and catch WM_VSCROLL and WM_HSCROLL messages.Code:InvalidateRect(GetDlgItem(hwndDlg, IDC_TXTEMAIL), NULL, TRUE);
It almost works now but the text still gets mangled in the edit on the last (if I scroll down) or the first line (if I scroll up) with the scrollbars. When I release the scrollbar/mouse everything looks ok (because of the SB_ENDSCROLL trigger). I also tried calling UpdateWindow right after InvalidateRect but this gives the same result.
Is there anyone who can tell me how I can prevent the first/last line scrambled text in this case when I scroll up or down (and a little left to right).



LinkBack URL
About LinkBacks


