有什么方法可以实现?谢谢 必须自汇么?谁有源码给看下
20 个解决方案
#1
http://blog.csdn.net/visualeleven/article/details/6072404
#2
开发环境是VS2010
#3
不是可以用自绘实现吗,我也在找这和方法
#4
你好 ,我试了下 程序运行到下面的地方时会报错,程序崩溃,为什么呢
CMulitLineListBox m_listBox; // 成员变量
#define IDC_LISTBOX 0x11
CRect rc;
GetClientRect(&rc);
rc.bottom -= 35;
rc.DeflateRect(CSize(10, 10));
m_listBox.Create(WS_CHILD | WS_VISIBLE | WS_BORDER | WS_HSCROLL | WS_VSCROLL |
LBS_OWNERDRAWVARIABLE | LBS_HASSTRINGS, rc, this, IDC_LISTBOX);
#5
你好,这个是LISTBOX的 能给个Combox的吗
#6
"文字都很多"
多到什么程度 ?
多到什么程度 ?
#7
#8
“而在资源里的combox的长度不能再长了” 200 不算长吧
#9
在 资源中 加 数据 220 也没问题
“qaqaqaqaqaqaqaqaqaqaqaqaqaqaqaqaqaqasxcasdccccccccccccccccccccccccccccccccccccccccccasdawssssssssssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxssssssssssssssssssszzzzzzzzzzzzzzaaaasdc”
这样也行 214 个
m_ComboTest.AddString("qaqaqaqaqaqaqaqaqaqaqewdfereterthgerthefgefertherewwwwwwwwwwwwwwwwwwwwcccccccccccccccwrtgerrgefrvgerfgezzzzzzzzzzzzzzzzqaqaqaqaqaqaqaqaqaqaqewdfereterthgerthefgefertherewrtgerrgefrvgerfgezzzzzzzzzzzzzzzzxxxx");
m_ComboTest.AddString("qaqaqaqaqaqaqaqaqaqaqyhertherthyrtujrnjyhjjerthqaqadddddddddddddddqaqaqaqaqaqaqaqaqewdfereterthgerthefgefertherewrtgerrgefrvgerfgezzzzzzzzzzzzzzzzgerthertheyhnyjnuyecevrghzzzzzddddddddddddddddddddzzzzzzzzzzz");
“qaqaqaqaqaqaqaqaqaqaqaqaqaqaqaqaqaqasxcasdccccccccccccccccccccccccccccccccccccccccccasdawssssssssssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxssssssssssssssssssszzzzzzzzzzzzzzaaaasdc”
这样也行 214 个
m_ComboTest.AddString("qaqaqaqaqaqaqaqaqaqaqewdfereterthgerthefgefertherewwwwwwwwwwwwwwwwwwwwcccccccccccccccwrtgerrgefrvgerfgezzzzzzzzzzzzzzzzqaqaqaqaqaqaqaqaqaqaqewdfereterthgerthefgefertherewrtgerrgefrvgerfgezzzzzzzzzzzzzzzzxxxx");
m_ComboTest.AddString("qaqaqaqaqaqaqaqaqaqaqyhertherthyrtujrnjyhjjerthqaqadddddddddddddddqaqaqaqaqaqaqaqaqewdfereterthgerthefgefertherewrtgerrgefrvgerfgezzzzzzzzzzzzzzzzgerthertheyhnyjnuyecevrghzzzzzddddddddddddddddddddzzzzzzzzzzz");
#10
200多个是没问题,我的问题是框体长度只能留100个字符的长度,太长了都显示到外面了 需要重载,让里面字符换行显示
#11
有一种叫 “TitleTip”(请搜索) 方法 可以 用 Tip 展开 combo 中的 内容
#12
1.
http://blog.csdn.net/visualeleven/article/details/6072404
里 ‘'\' 写反了(/r/n); 应该是
strText = _T("Hello, World!\r\nHello, World!");
2. 有了这个 CMulitLineListBox 就 可以 把 combo 里 Listbox 替换 为 CMulitLineListBox
里 ‘'\' 写反了(/r/n); 应该是
strText = _T("Hello, World!\r\nHello, World!");
2. 有了这个 CMulitLineListBox 就 可以 把 combo 里 Listbox 替换 为 CMulitLineListBox
#13
另外即使 Combo 的 list 可以 多行, 那么 combo 的 edit 怎么 多行 ?
#14
这个帖子是CListBox的自绘 我需要CComboBox的自绘 把CListBox改为CComboBox的话,MeasureItem函数中的GetItemRect报错,不支持这个函数
#15
你说的是Xtreme ToolkitPro吗 我找了 没有COMBO Box的啊
#16
"CComboBox的自绘"代码如下:
不过 选择到 edit 后 多行怎么办?
void CMulitLineComBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
if(lpDrawItemStruct->CtlType==ODT_COMBOBOX)
{
CDC dc;
dc.Attach(lpDrawItemStruct->hDC);
CRect rcClient = lpDrawItemStruct->rcItem;
UINT state = lpDrawItemStruct->itemState;
CBrush br;
if(state&ODS_SELECTED)
{
br.CreateSolidBrush(RGB(51,153,255));
}
else
{
br.CreateSolidBrush(RGB(255,255,128));
}
dc.FillRect(&rcClient,&br);
dc.SetBkMode(TRANSPARENT);
dc.SetTextColor(RGB(255,0,255));
//如果不是空项
if(lpDrawItemStruct->itemID!=(UINT)-1)
{
UINT id = lpDrawItemStruct->itemID;
CString strText;
GetLBText(id,strText);
rcClient.DeflateRect(1,1);
dc.DrawText(strText, strText.GetLength(),&lpDrawItemStruct->rcItem, DT_WORDBREAK);
}
dc.Detach();
}
}
void CMulitLineComBox::MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct)
{
if( (lpMeasureItemStruct->CtlType==ODT_COMBOBOX)&&
(lpMeasureItemStruct->itemID!=(UINT)-1))
{
CString strText;
GetLBText(lpMeasureItemStruct->itemID,strText);
CRect rect(0,0,100,100);
CDC* pDC = GetDC();
lpMeasureItemStruct->itemHeight = pDC->DrawText(strText, -1, rect, DT_WORDBREAK | DT_CALCRECT);
ReleaseDC(pDC);
}
}
不过 选择到 edit 后 多行怎么办?
#17
换行这个我不会写。。。 那个用tooltip显示额外文本的代码你有吗 怎么给每个下拉项用tooltip添加文本?
#18
windows 使用 “回车 \r (0x0D return; 换行\n 0x0A newline”.
#20
已解决 多谢大家
#21
#1
http://blog.csdn.net/visualeleven/article/details/6072404
#2
开发环境是VS2010
#3
不是可以用自绘实现吗,我也在找这和方法
#4
你好 ,我试了下 程序运行到下面的地方时会报错,程序崩溃,为什么呢
CMulitLineListBox m_listBox; // 成员变量
#define IDC_LISTBOX 0x11
CRect rc;
GetClientRect(&rc);
rc.bottom -= 35;
rc.DeflateRect(CSize(10, 10));
m_listBox.Create(WS_CHILD | WS_VISIBLE | WS_BORDER | WS_HSCROLL | WS_VSCROLL |
LBS_OWNERDRAWVARIABLE | LBS_HASSTRINGS, rc, this, IDC_LISTBOX);
#5
你好,这个是LISTBOX的 能给个Combox的吗
#6
"文字都很多"
多到什么程度 ?
多到什么程度 ?
#7
#8
“而在资源里的combox的长度不能再长了” 200 不算长吧
#9
在 资源中 加 数据 220 也没问题
“qaqaqaqaqaqaqaqaqaqaqaqaqaqaqaqaqaqasxcasdccccccccccccccccccccccccccccccccccccccccccasdawssssssssssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxssssssssssssssssssszzzzzzzzzzzzzzaaaasdc”
这样也行 214 个
m_ComboTest.AddString("qaqaqaqaqaqaqaqaqaqaqewdfereterthgerthefgefertherewwwwwwwwwwwwwwwwwwwwcccccccccccccccwrtgerrgefrvgerfgezzzzzzzzzzzzzzzzqaqaqaqaqaqaqaqaqaqaqewdfereterthgerthefgefertherewrtgerrgefrvgerfgezzzzzzzzzzzzzzzzxxxx");
m_ComboTest.AddString("qaqaqaqaqaqaqaqaqaqaqyhertherthyrtujrnjyhjjerthqaqadddddddddddddddqaqaqaqaqaqaqaqaqewdfereterthgerthefgefertherewrtgerrgefrvgerfgezzzzzzzzzzzzzzzzgerthertheyhnyjnuyecevrghzzzzzddddddddddddddddddddzzzzzzzzzzz");
“qaqaqaqaqaqaqaqaqaqaqaqaqaqaqaqaqaqasxcasdccccccccccccccccccccccccccccccccccccccccccasdawssssssssssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxssssssssssssssssssszzzzzzzzzzzzzzaaaasdc”
这样也行 214 个
m_ComboTest.AddString("qaqaqaqaqaqaqaqaqaqaqewdfereterthgerthefgefertherewwwwwwwwwwwwwwwwwwwwcccccccccccccccwrtgerrgefrvgerfgezzzzzzzzzzzzzzzzqaqaqaqaqaqaqaqaqaqaqewdfereterthgerthefgefertherewrtgerrgefrvgerfgezzzzzzzzzzzzzzzzxxxx");
m_ComboTest.AddString("qaqaqaqaqaqaqaqaqaqaqyhertherthyrtujrnjyhjjerthqaqadddddddddddddddqaqaqaqaqaqaqaqaqewdfereterthgerthefgefertherewrtgerrgefrvgerfgezzzzzzzzzzzzzzzzgerthertheyhnyjnuyecevrghzzzzzddddddddddddddddddddzzzzzzzzzzz");
#10
200多个是没问题,我的问题是框体长度只能留100个字符的长度,太长了都显示到外面了 需要重载,让里面字符换行显示
#11
有一种叫 “TitleTip”(请搜索) 方法 可以 用 Tip 展开 combo 中的 内容
#12
1.
http://blog.csdn.net/visualeleven/article/details/6072404
里 ‘'\' 写反了(/r/n); 应该是
strText = _T("Hello, World!\r\nHello, World!");
2. 有了这个 CMulitLineListBox 就 可以 把 combo 里 Listbox 替换 为 CMulitLineListBox
里 ‘'\' 写反了(/r/n); 应该是
strText = _T("Hello, World!\r\nHello, World!");
2. 有了这个 CMulitLineListBox 就 可以 把 combo 里 Listbox 替换 为 CMulitLineListBox
#13
另外即使 Combo 的 list 可以 多行, 那么 combo 的 edit 怎么 多行 ?
#14
这个帖子是CListBox的自绘 我需要CComboBox的自绘 把CListBox改为CComboBox的话,MeasureItem函数中的GetItemRect报错,不支持这个函数
#15
你说的是Xtreme ToolkitPro吗 我找了 没有COMBO Box的啊
#16
"CComboBox的自绘"代码如下:
不过 选择到 edit 后 多行怎么办?
void CMulitLineComBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
if(lpDrawItemStruct->CtlType==ODT_COMBOBOX)
{
CDC dc;
dc.Attach(lpDrawItemStruct->hDC);
CRect rcClient = lpDrawItemStruct->rcItem;
UINT state = lpDrawItemStruct->itemState;
CBrush br;
if(state&ODS_SELECTED)
{
br.CreateSolidBrush(RGB(51,153,255));
}
else
{
br.CreateSolidBrush(RGB(255,255,128));
}
dc.FillRect(&rcClient,&br);
dc.SetBkMode(TRANSPARENT);
dc.SetTextColor(RGB(255,0,255));
//如果不是空项
if(lpDrawItemStruct->itemID!=(UINT)-1)
{
UINT id = lpDrawItemStruct->itemID;
CString strText;
GetLBText(id,strText);
rcClient.DeflateRect(1,1);
dc.DrawText(strText, strText.GetLength(),&lpDrawItemStruct->rcItem, DT_WORDBREAK);
}
dc.Detach();
}
}
void CMulitLineComBox::MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct)
{
if( (lpMeasureItemStruct->CtlType==ODT_COMBOBOX)&&
(lpMeasureItemStruct->itemID!=(UINT)-1))
{
CString strText;
GetLBText(lpMeasureItemStruct->itemID,strText);
CRect rect(0,0,100,100);
CDC* pDC = GetDC();
lpMeasureItemStruct->itemHeight = pDC->DrawText(strText, -1, rect, DT_WORDBREAK | DT_CALCRECT);
ReleaseDC(pDC);
}
}
不过 选择到 edit 后 多行怎么办?
#17
换行这个我不会写。。。 那个用tooltip显示额外文本的代码你有吗 怎么给每个下拉项用tooltip添加文本?
#18
windows 使用 “回车 \r (0x0D return; 换行\n 0x0A newline”.
#19
#20
已解决 多谢大家