dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: resize splitter windows at runtime

  1. #1
    Join Date
    Jul 2000
    Posts
    133

    resize splitter windows at runtime

    I have a splitter window which includes four splitters. Is there any way that I can resize each view at runtime? Thank you in advance.


  2. #2
    Join Date
    Oct 1999
    Location
    Broomfield, CO
    Posts
    3,382

    Re: resize splitter windows at runtime

    1. Call GetClientRect() on your frame window to get the total area available for the splitters.
    2. Determine the sizes you want for each splitter pane and put the values into CSize variables.
    3. Use GetColumnInfo() and SetColumnInfo() on each splitter column you want to change. If you are changing the current size and the minimum, you can just call SetColumnInfo(), else call GetColumnInfo() to get the current size and the min size, then call SetColumnInfo() to change the current size and leave the min alone.
    4. Use GetRowInfo() and SetRownInfo() on each splitter row you want to change, similar to step 3.
    5. For each splitter that changed, call RecalcLayout ("m_wndSplitter1.RecalcLayout();").


  3. #3
    Join Date
    Oct 2000
    Location
    Scotland
    Posts
    34

    Re: resize splitter windows at runtime

    Use the functions CSplitterWnd functions 'SetRowInfo' and 'SetColumnInfo' to set the 'ideal widths' for the panes of your split window as appropriate (these 'ideal widths' are used to work out the size for each pane going top-left to bottom-right).
    Then call the CWndSplitter function RecalcLayout to redisplay the window.
    e.g. if you had an explorer style window with two panes then;


    //get the size of the window containing the splitter panes
    CRect rect;
    GetWindowRect( &rect );

    //now resize the first pane to 1/3 of this width
    m_wndSplitter.SetColumnInfo(0,rect.Width()/3,20);
    m_wndSplitter.RecalcLayout();




    this would set the first pane to occupy 1/3 of the window's area, the second occupying the remainder.

    Cheers,

    BMeister

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)