Solved

Using MSFlexGrid in MFC application

Posted on 2003-11-06
7
983 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

635 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