Solved

Using MSFlexGrid in MFC application

Posted on 2003-11-06
7
966 Views
Last Modified: 2013-11-20
Hi All,
I'm using a MSFlexGrid control in my MFC application on a resizable dialog
which is placed on a view.
I want to know how to resize the grid when the parent dialog is resized.
like when my application is maximized the dialog gets resized but the flexgrid
column size remains the same and hence the user is able to see lot of empty
space.
i want to resize the column width for each cell and the width of the grid itself.
Can anyone help me out

Thanks in advance
Raghav
0
Comment
Question by:raghavphil
  • 4
  • 3
7 Comments
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 9693403
What about "ColWidth()" function?
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 9693413
Ooops its "SetColWidth()"

eg:
     m_oFlexGrid.SetColWidth(0, 1600);
     m_oFlexGrid.SetColWidth(1, 2400);
     m_oFlexGrid.SetTextMatrix(0, 0, "ONE");
     m_oFlexGrid.SetTextMatrix(0, 1, "TWO");

Good Luck
0
 

Author Comment

by:raghavphil
ID: 9693933
This has to be done dynamically right...
when the main app is resized , the view window which has the grid is also resized.
I have two columns in my grid. First has a fixed width.
I want the second to be expanded when the view is resized. Is it possible to do with this!!
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 23

Expert Comment

by:Roshan Davis
ID: 9693993
Yes, Map WM_SIZE for resizing of GRID

void CYourView::OnSize(int cx, int cy)
{
     m_oFlexGrid..MoveWindow(0,0,cx,cy);
   
     // Also increase the column width as mentioned above
}

0
 

Author Comment

by:raghavphil
ID: 9698846
Yes...i understand this part.
But i have a splitter window used for my view and it contains two views. one is a tree view and the other is a Dialog put in a view.This dialog contains a Grid.
So how do i calculate the new size of this dialog. This is where it's causing problems. Any solutions??

0
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 150 total points
ID: 9698883
Yes, Map WM_SIZE for resizing of Dialog
void CYourView::OnSize(int cx, int cy)
{
    m_odlg..MoveWindow(0,0,cx,cy);
   
    // Also increase the column width as mentioned above
}

And Map WM_SIZE of Dialog for resizing of GRID

void CDialogEx::OnSize(int cx, int cy)
{
    m_oFlexGrid..MoveWindow(0,0,cx,cy);
   
    // Also increase the column width as mentioned above
}


Rosh
0
 

Author Comment

by:raghavphil
ID: 9712377
Hi Roshmon,
Thanks for the answer.... it works...
you seem to be lot experienced in FlexGrid....
i might need some more help in future... ofcoz u'll get points :-)

Once again thanks for the answer

regards
Raghav
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
WinWaitActive parameters 12 31
viewing source code from eclipse 13 110
has77  challenge 9 93
scoreUp challenge 14 64
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 …
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

808 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