Solved

Using MSFlexGrid in MFC application

Posted on 2003-11-06
7
933 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
bobThere java chalenge 45 85
Expand data scrubbing tool 13 31
Looking for a specific application/software 2 92
scoreUp challenge 14 48
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

746 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

11 Experts available now in Live!

Get 1:1 Help Now