Problem with List Box

I have a list box on my dialog box. I have created a control variable for this list box and i am inserting several strings in this list box using InsertString().

In properties(style) of List Box, I have selected Horizontal and Vertical Scroll both, but in practice no Horizontal scroll bar is available althought Vertical Scroll bar is working well. I am unable to guess how can i add horizontal scroll bar this list box?????

Please reply asap

thanx



anarkalinAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
PIGConnect With a Mentor Commented:
You need to set horizontal extent to ListBox. That is sample code for this.
CString str;
CSize   sz;
int     dx=0;
CDC*    pDC = m_List.GetDC();
for (int i=0;i < m_List.GetCount();i++){  
   m_List.GetText( i, str );
   sz = pDC->GetTextExtent(str);  
   if (sz.cx > dx)      
      dx = sz.cx;
}
m_List.ReleaseDC(pDC);
// Set the horizontal extent so every character of all strings
// can be scrolled to.
m_List.SetHorizontalExtent(dx);
0
 
anarkalinAuthor Commented:
Thank you very much indeed, can i have PIGs' email???
0
 
PIGCommented:
plamenig@atia.com
0
All Courses

From novice to tech pro — start learning today.