bind
IS-IT--Management
- Dec 13, 2004
- 25
Hello Experts,
I'm experiencing an issue I've spent hours on google researching a solution for and have come up with nothing of use.
I'm capturing the following events for two textboxes and attempting to make the background of the textbox (IEdBoxEditor) transparent.
case WM_CTLCOLORSTATIC:
ret = (HBRUSH)GetStockObject(NULL_BRUSH);
SetBkMode((HDC)wParam,TRANSPARENT);
SetTextColor((HDC)wParam, RGB(255, 255, 255));
return (LRESULT)ret;
break;
case WM_CTLCOLOREDIT:
ret = (HBRUSH)GetStockObject(NULL_BRUSH);
SetBkMode((HDC)wParam,TRANSPARENT);
SetTextColor((HDC)wParam, RGB(255, 255, 255));
return (LRESULT)ret;
break;
The issue with doing this alone is, whenever I'd type anything in the boxes and backspace to delete the text, it would overlap and create this blurry chunk of unreadable text.
After a little research I found that after setting the text on the boxes using:
SetDlgItemText(hWnd, IDC_Text, "Random string here");
I should use InvalidateRect right after to redraw the textbox.
So right below the SetDlgItemText, I did:
InvalidateRect(hWnd, NULL, TRUE);
I am also handling the WM_ERASEBKGND event
case WM_ERASEBKGND:
return TRUE;
break;
That fixed the issue with the overlapping text issue I was having but sparked a new issue, flickering when data is typed into the textbox and another strange issue, when I highlight any text contained in the textbox, after clicking outside of the textbox, the highlight of the text stays and doesn't dissapear like it should.
Now, this isn't a MFC application, I'm building the dialog and buttons / textboxes by hand.
I've searched high and low for a solution to this issue and am hoping someone here has stumbled upon this issue before in the past and can lend a helping hand.
Thanks Experts, any assistance on this matter would be greatly appreciated.
I'm experiencing an issue I've spent hours on google researching a solution for and have come up with nothing of use.
I'm capturing the following events for two textboxes and attempting to make the background of the textbox (IEdBoxEditor) transparent.
case WM_CTLCOLORSTATIC:
ret = (HBRUSH)GetStockObject(NULL_BRUSH);
SetBkMode((HDC)wParam,TRANSPARENT);
SetTextColor((HDC)wParam, RGB(255, 255, 255));
return (LRESULT)ret;
break;
case WM_CTLCOLOREDIT:
ret = (HBRUSH)GetStockObject(NULL_BRUSH);
SetBkMode((HDC)wParam,TRANSPARENT);
SetTextColor((HDC)wParam, RGB(255, 255, 255));
return (LRESULT)ret;
break;
The issue with doing this alone is, whenever I'd type anything in the boxes and backspace to delete the text, it would overlap and create this blurry chunk of unreadable text.
After a little research I found that after setting the text on the boxes using:
SetDlgItemText(hWnd, IDC_Text, "Random string here");
I should use InvalidateRect right after to redraw the textbox.
So right below the SetDlgItemText, I did:
InvalidateRect(hWnd, NULL, TRUE);
I am also handling the WM_ERASEBKGND event
case WM_ERASEBKGND:
return TRUE;
break;
That fixed the issue with the overlapping text issue I was having but sparked a new issue, flickering when data is typed into the textbox and another strange issue, when I highlight any text contained in the textbox, after clicking outside of the textbox, the highlight of the text stays and doesn't dissapear like it should.
Now, this isn't a MFC application, I'm building the dialog and buttons / textboxes by hand.
I've searched high and low for a solution to this issue and am hoping someone here has stumbled upon this issue before in the past and can lend a helping hand.
Thanks Experts, any assistance on this matter would be greatly appreciated.