透明背景下的“编辑框"中的数据重叠 [英] Overlapping data in Edit Box with transparent background

查看:52
本文介绍了透明背景下的“编辑框"中的数据重叠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从组合框获取数据并将其显示在仅具有透明背景的编辑框中.我输入的数据重叠后,请继续从组合框选择新数据.

在这种情况下该如何避免重叠?当我选择说快速"时,我正在将MFC SDI应用程序与CFormview一起使用.

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.

推荐答案

没关系.现在我选择版本",所以现在版本"在快速"上重叠,并且由于模糊而无法清晰地显示版本".

希望您能理解这一点.
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.


透明样式是否有问题?
如果是这样,请删除透明样式,设置新文本,然后再设置透明样式.
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.


我认为这是透明样式的问题,但我无法删除它.因为我确实想要表单的背景色,并且必须在只读和透明的编辑框中显示文本.

这是一段代码.
<
HBRUSH CCommandMode :: OnCtlColor(CDC * pDC,CWnd * pWnd,UINT nCtlColor)
{
HBRUSH hbr = CFormView :: OnCtlColor(pDC,pWnd,nCtlColor);
bool bSetBkTransparent = true;
if(bSetBkTransparent)
{
如果(pWnd-> GetDlgCtrlID()== IDC_TXT_COMMAND)
{
pDC-> SetBkMode(TRANSPARENT);
pDC-> SetTextColor(RGB(255,255,255));
hbr =(HBRUSH)GetStockObject(NULL_BRUSH);
}
}
如果(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);
}
开关(nCtlColor)
{
案例CTLCOLOR_
pDC-> SetTextColor(RGB(0,0,0));
return(HBRUSH)(m_ptrBrush-> GetSafeHandle());
}
return hbr;
}
>
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_
pDC->SetTextColor(RGB(0, 0, 0));
return (HBRUSH)(m_ptrBrush->GetSafeHandle());
}
return hbr;
}
>


这篇关于透明背景下的“编辑框"中的数据重叠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆