Re: CListBox horizontal scroll
Here's some code I use. Hopefully self explanatory:
// Set the horizontal scroll
int oldwidth = m_cListBox.GetHorizontalExtent();
CDC* pDC = m_cListBox.GetWindowDC();
if (pDC) {
int newwidth = (int)(pDC->GetTextExtent(szMsg,
(int)_tcslen(szMsg)).cx);
m_cListBox.ReleaseDC(pDC);
if (newwidth > oldwidth)
m_cListBox.SetHorizontalExtent(newwidth);
}
// Add the new one at the end
if(bFileMsg) {
int nLast = m_cListBox.GetCount();
if(nLast > 0)
m_cListBox.DeleteString(nLast-1);
}
m_cListBox.AddString(szMsg);
if(m_bAutoScrollStatus) {
// Keep the last one in view
m_cListBox.SetTopIndex(m_cListBox.GetCount()-1);
}
Tom
"Guido Franzke" <guidof73@yahoo.de> wrote in message
news:ODUKOFPdKHA.1648@TK2MSFTNGP05.phx.gbl...
Hello NG,
I have a normal CListBox in my dialog. I insert text with AddString. The
string is longer than the area to show the listbox. But I cannot
horizontal
scroll the text.
I changed the properties: horizontal scrollbar = true, vertical scrollbar
=
true, deactivate no scrolling = true.
But I cannot horizontal scroll.
I use MSVC Developer 2003, Version 7.1.3088 and Windows XP.
Can you help me?
Thanks,
Guido