Click here to Skip to main content
15,922,015 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to take data from Combobox and displaying it in edit box which is read only with transparent background. My entered data is overlapping aftter keep selecting new data from Combobox.

what to do in this scenario for avoid overlapping? I am using MFC SDI application with CFormview.
Posted

Wold be a static control an altenative solution for you ?

Elsewise you should take care
of repainting of your form behind... :)
 
Share this answer
 
Comments
Michael Haephrati 23-May-21 13:12pm    
That worked!
when i am selecting say "FAST". it is ok. now i am selecting "Version" so now "Version" is getting overlapped on "FAST" and "Version" is not clear because of blurring.

Hoping u can understand this.
 
Share this answer
 
Is it the problem with the transparent style?
If so, remove the transparent style, set the new text and then set the transparent style back.
 
Share this answer
 
I think this is problem with transparent style, but i can not remove it. because i do want background color of form and have to display text in edit box which is Read Only & Transparent.

Here is the piece of code.
<
HBRUSH CCommandMode::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CFormView::OnCtlColor(pDC, pWnd, nCtlColor);
bool bSetBkTransparent = true;
if(bSetBkTransparent)
{
if (pWnd->GetDlgCtrlID() == IDC_TXT_COMMAND)
{
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(255, 255, 255));
hbr = (HBRUSH)GetStockObject(NULL_BRUSH);
}
}
if (pWnd->GetDlgCtrlID() == IDC_ADVANCED_EDIT)
{
pDC->SetBkMode(TRANSPARENT);
pDC->SetBkColor(RGB(255, 255, 255));
pDC->SetTextColor(RGB(0, 0, 0));
hbr = (HBRUSH)GetStockObject(NULL_BRUSH);
}
switch(nCtlColor)
{
case CTLCOLOR_EDIT:
pDC->SetTextColor(RGB(0, 0, 0));
return (HBRUSH)(m_ptrBrush->GetSafeHandle());
}
return hbr;
}
>
 
Share this answer
 
when i am selecting say "FAST". it is ok. but when i am again selecting "Version" so now "Version" is getting overlapped on "FAST" and "Version" is not clear because of blurring or overlapping of "FAST" on "VERSION".

Hoping u can understand this.
 
Share this answer
 
Saurabh, please do have a look on my Answer-5, which is an answer of your question.
 
Share this answer
 
Can you explain what do you mean by overlapping?

-Saurabh
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900