Link to home
Start Free TrialLog in
Avatar of raghavphil
raghavphil

asked on

Using MSFlexGrid in MFC application

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
Avatar of Roshan Davis
Roshan Davis
Flag of United States of America image

What about "ColWidth()" function?
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
Avatar of raghavphil
raghavphil

ASKER

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!!
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
}

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??

ASKER CERTIFIED SOLUTION
Avatar of Roshan Davis
Roshan Davis
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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