Horizontal scroll in List box
Hi gurus,
I have a list box in dialog.
In the property window i have checked the vertical and horizontal scroll options.
Also disable no scroll option.
But when i run the code the vertical scroll is working.
The horizontal scroll is active, but doesnt slide, even when the text extends the list box margins.
How to make the horizontal scroll work?
Thank you
[420 byte] By [
help_cplus] at [2007-11-19 7:32:15]

# 1 Re: Horizontal scroll in List box
You need to use SetHorizontalExtent() ... this code snippet shows how to determine the value of its argument.
//
// in code below, m_list1c is control variable associated with the CListBox
//
CDC *pDC = GetDC();
CSize Size,MaxSize(0,0);
for(int i=0;i < m_list1c.GetCount();++i)
{
CString str;
m_list1c.GetText(i,str);
Size=pDC->GetTextExtent(str);
if(MaxSize.cx < Size.cx)MaxSize = Size;
}
m_list1c.SetHorizontalExtent(MaxSize.cx);
ReleaseDC(pDC);