怎么限定组合框的文本框输入字符串的最大长度
如何限定组合框的文本框输入字符串的最大长度
现在是必须拉长组合框的文本框才能输入更长的字符串,不拉长的话只能输入与文本框长度一样的字符串,想输入更长的字符串就不响应了,有什么解决办法吗?谢谢大侠
------解决方案--------------------
extern CEdit* pmyEdit;
// Limit the number of characters to be the maximum number visible.
// Get the text metrics for the edit; needed for the
// average character width.
TEXTMETRIC tm;
CDC* pDC = pmyEdit->GetDC();
pDC->GetTextMetrics(&tm);
pmyEdit->ReleaseDC(pDC);
CRect r;
pmyEdit->GetRect(&r);
pmyEdit->LimitText(r.Width()/tm.tmAveCharWidth);
现在是必须拉长组合框的文本框才能输入更长的字符串,不拉长的话只能输入与文本框长度一样的字符串,想输入更长的字符串就不响应了,有什么解决办法吗?谢谢大侠
------解决方案--------------------
extern CEdit* pmyEdit;
// Limit the number of characters to be the maximum number visible.
// Get the text metrics for the edit; needed for the
// average character width.
TEXTMETRIC tm;
CDC* pDC = pmyEdit->GetDC();
pDC->GetTextMetrics(&tm);
pmyEdit->ReleaseDC(pDC);
CRect r;
pmyEdit->GetRect(&r);
pmyEdit->LimitText(r.Width()/tm.tmAveCharWidth);