Click here to Skip to main content
14,367,083 members

Using CResizablePage In a CFormView

Rate this:
3.07 (18 votes)
Please Sign up or sign in to vote.
3.07 (18 votes)
16 Apr 2001CPOL
Technique for utilizing a CResizablePage in a CFormView-derived class

Introduction - A Little Background

My first exposure to Paolo Messina's code for creating a resizable dialog box involved a CPopertySheet embedded in a dialog box which (of course) contained one or more (dynamically added) property pages. The app itself was already well along in the development cycle, but it still wasn't difficult at all to add the support from CResizable*.* that I needed.

Due to the nature of the property sheet, I didn't need the CResizableSheet code, but I did make use of the other two components (CResizableDialog and CResizablePage).

The Task At Hand

Over the last couple of months, my boss has been developing an application with a splitter view containing a CTreeView, a couple of CListViews, and a CFormView containing a tab control with several tabs that each contain a list control.

As you all know, when a view is resized to be smaller than the data/object it contains, the pane automatically displays scroll bars so that you can scroll the desired portion into view. The formview pane had the nasty habit of scrolling the entire pane when such an event occurs, and this has the side affect (in our case) of scrolling the tab titles out of the visible pane.

To remedy this situation, I used the embedded property sheet technique that I had used in my other application, and instead of using a tab control, I used individual CResizablePage objects to represent the tabs.

When using a property sheet, you have the benefit of a self-induced border around the tab control. While this is handy on a dialog box, it's a royal pain with a CWnd on a formview, especially our formview. The fix was to offset the page enough to where the list control on the tabs filled the entire pane, thus emulating the pane scroll bars.

I guess the long and short of it is that the formview looks like a tabbed list view, and the tabs don't scroll off the pane when the scroll bars (if any) are manipulated.

I've included a demo (the same one I gave my boss) of the technique I used.

I don't remember where I got the code for the embedded property sheet, but it sure has come in handy in a number of instances.

Lastly, many tanks to Paolo for the CResizable*.* classes. They've been the most useful set of classes I've used in many, many years.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer (Senior) Paddedwall Software
United States United States
I've been paid as a programmer since 1982 with experience in Pascal, and C++ (both self-taught), and began writing Windows programs in 1991 using Visual C++ and MFC. In the 2nd half of 2007, I started writing C# Windows Forms and ASP.Net applications, and have since done WPF, Silverlight, WCF, web services, and Windows services.

My weakest point is that my moments of clarity are too brief to hold a meaningful conversation that requires more than 30 seconds to complete. Thankfully, grunts of agreement are all that is required to conduct most discussions without committing to any particular belief system.

Comments and Discussions

GeneralMy vote of 1 Pin
CSawant12-Jul-09 2:25
groupCSawant12-Jul-09 2:25 
Generalcformview ..... please .. please .. hepl me ! Pin
Anonymous7-Jul-03 19:49
memberAnonymous7-Jul-03 19:49 
i have created an apliction in cformview. by pressing a button i want to create a window(view window) with scroll bars and i have to display data in the view window. after i have verified the data i want to close the view window. I have to go back to the formviw. how can i implement this?
very urgently needed the answer
GeneralAdding Controls Dynamically to CFormView Pin
Muhammad Yousaf7-May-03 9:43
memberMuhammad Yousaf7-May-03 9:43 
GeneralFit a dialog into a View of a Window Pin
17-Apr-02 9:27
suss17-Apr-02 9:27 
QuestionDemo Broken? Pin
Stephen Woods1-Apr-02 20:13
memberStephen Woods1-Apr-02 20:13 
GeneralMemory Leaks Pin
4-Dec-00 17:02
suss4-Dec-00 17:02 
GeneralRe: Memory Leaks Pin
Matt Philmon4-Dec-00 18:02
memberMatt Philmon4-Dec-00 18:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Posted 26 Nov 2000


27 bookmarked