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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PIGCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
anarkalinAuthor Commented:
Thank you very much indeed, can i have PIGs' email???
0
PIGCommented:
plamenig@atia.com
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.