Solved

How to resize the CListCtrl attached in a CListView?

Posted on 2000-03-26
2
654 Views
Last Modified: 2013-11-20
Hi all...

I have a CListView view in my SDI application... the problem is that when the main window is maximized, the attached CListCtrl is resized to occupy the whole view area (and that is what I want).. but.. when the main window is resized (to normal state, for example), and after resizing columns widths, it seems that the CListCtrl isn't resized so the horizontal scroll bar is shown... How can I avoid that?

This is my ClistView OnSize event

/////////////////////////////////////////////////////////////////////////////
// CTransView message handlers

void CTransView::OnSize(UINT nType, int cx, int cy)
{
      CListView::OnSize(nType, cx, cy);
      
      CRect rect;
      CListCtrlEx& ListaMarcas = (CListCtrlEx&)GetListCtrl();
      GetWindowRect(&rect);
      ListaMarcas.SetColumnWidth(0, 13*rect.Width()/100);
      ListaMarcas.SetColumnWidth(1, rect.Width()/5);
      ListaMarcas.SetColumnWidth(2, rect.Width()/5);
      ListaMarcas.SetColumnWidth(3, rect.Width()/5);
      ListaMarcas.SetColumnWidth(4, 27*rect.Width()/100);
}


Where CListCtrlEx is a customized CListCtrl.

I hope you can help me...

Thanks a lot in advance...

Skel
0
Comment
Question by:skel
[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
2 Comments
 
LVL 10

Accepted Solution

by:
RONSLOW earned 100 total points
ID: 2659393
Try using GetClientRect instead of GetWindowRect.  GetWindowRect includes any non-client area (eg borders etc).
0
 

Author Comment

by:skel
ID: 2660450
Thanks... I'll try it when I get answer for my another question concerning this fact....

But.. you said that I can use GetClientRect instead of GetWindowRect.... I think that isn't the problem since the column windth change accordingly to the new size, what is OK... the problem is the width of the whole control which keeps its size without resizing accordingly to its columns width..

Skel
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
function returning CString in a regular win32 DLL 8 201
Separate into files by filename 12 91
Detect file exist or not 3 203
c++  placing data into a form and an editbox 5 25
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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…
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.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

726 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