Solved

How to resize a dialog bar ?

Posted on 1998-12-11
7
386 Views
Last Modified: 2013-11-20
I wish to write an MDI application which upon starting up, a workspace window will appear on the left of the main frame. I tried to use  CDialogBar class to implement. It works well except I could not resize it.

Will anyone tell me how to around this problem ?

Thank you all

Serhan
0
Comment
Question by:Serhan
7 Comments
 
LVL 4

Expert Comment

by:pagladasu
Comment Utility
To resize the dialogbar, obtain a pointer to it and then use the MoveWindow() function.
0
 

Expert Comment

by:dagangwang
Comment Utility
Because CDialogBar is a window, you can use SetWindowPos to rsposition or move.
0
 

Expert Comment

by:dagangwang
Comment Utility
You can add splitter window. Your DialogBar is inserted left one. When drag split border,
you should resize DialogBar height. Thus you can imitate resizing function.
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:Serhan
Comment Utility
Have tried to use MoveWindow and SetWindowPos but they did not work as expected.
0
 
LVL 2

Expert Comment

by:wyy_cq
Comment Utility
please use the docking window .
0
 
LVL 3

Accepted Solution

by:
shaig earned 100 total points
Comment Utility
Note that MoveWindow has a strang way of passing params:
The first two are coordinates, while the following are not! they specify widh and hight.
Check if you passed params correctly, i hope this helps.
0
 
LVL 4

Expert Comment

by:pagladasu
Comment Utility
Here is some information that might help.
To make a dialog bar resizable:

1.Use the new CBRS_SIZE_DYNAMIC style when creating the dialog bar.

2.Add code to an override of the new CalcDynamicLayout() function.

Control bars support the new CBRS_SIZE_DYNAMIC style. CBRS_SIZE_DYNAMIC allows a floating control bar to be dynamically resized when the user drags the control bar's border. The virtual function
CControlBar::CalcDynamicLayout() has been added to determine the size that a control bar should be resized to.

CalcDynamicLayout() is called for CBRS_SIZE_DYNAMIC control bars when the border of a floating control bar is dragged and when the control bar is docked or floated. The default CControlBar implementation simply calls CalcFixedLayout(), which prevents control bar objects from resizing unless CalcDynamicLayout() is overridden. CDialogBar does not override CalcDynamicLayout(), so by default, dialog bars are not resizable.

To make a resizable dialog bar:

1.Create a new class derived from CDialogBar and override the CalcDynamicLayout() function. Depending on the behavior you
want, it may be necessary to add a member variable to the class.

2.Create an instance of this class using the CBRS_SIZE_DYNAMIC style bit. Dialog bars are typically created in
         CMainFrame::OnCreate():
         if (!m_wndDialogBar.Create(this, IDD_DIALOGBAR,
         CBRS_TOP | CBRS_SIZE_DYNAMIC, 777)) {
            TRACE0("Failed to create dialogbar\n");
               return -1;
      }
      m_wndDialogBar.EnableDocking(CBRS_ALIGN_ANY);
        DockControlBar(&m_wndDialogBar);

Hope this helps
thanks
pagladasu
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now