Hi, I'm doing a VC++ project, which requires me to create multiple CWnd objects and put them into one dialog box for viewing. For example, I need to create 100 buttons with 1-100 written on them, and put them into one dialog box. Of course the dialog box can't show them all at once, so there need to be a scroll bar of some sort for the user to drag and view all the buttons. However after fumbling around hours after hours and reading some reference books, I can't find the method to accomplish the above mentioned task. I figure there may be some kind of "container" object to place on the main dialog box to contain all those text buttons, and to browse them with a scroll bar, but I can't find such "container" object anywhere.

Anyone can help on this? Thanks! :confused:

Recommended Answers

All 3 Replies

derive the class from CFormView instead of CDialog and MFC will put scroll bars on it and handle them appropriately for you.

derive the class from CFormView instead of CDialog and MFC will put scroll bars on it and handle them appropriately for you.

Thanks a lot for the reply, I have tried CFormView and this is what I get. I have set the CFormView with vertical scrollbar but it just doesn't show up :confused:

[IMG]http://my.opera.com/yeya0/homes/albums/111001/shot1.JPG[/IMG]

[IMG]http://my.opera.com/yeya0/homes/albums/111001/shot2.JPG[/IMG]

[IMG]http://files.myopera.com/yeya0/albums/111001/shot3.JPG[/IMG]

It's really frustrating :sad: Could you please provide some links to examples or code or explain some more? Thanks a lot again!

attached is a quicky example that I created with VC++ 2005 Pro. I did similar with VC++ 6.0 but did not attach it. There is nothing special about the project, just created a normal MFC project and set the view type to CFormView.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.