Sizing Columns in CListView's / CListCtrl's - Programmer

This is a discussion on Sizing Columns in CListView's / CListCtrl's - Programmer ; Greetings: I'm writing an application that must run on a variety of machines with different screen resolution settings. I have many dialogs containing list views and I would like to be able to initialize the column widths so that they ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Sizing Columns in CListView's / CListCtrl's

  1. Sizing Columns in CListView's / CListCtrl's

    Greetings:

    I'm writing an application that must run on a variety of machines with
    different screen resolution settings. I have many dialogs containing list
    views and I would like to be able to initialize the column widths so that
    they completely fill the full width of the list view without any column
    being clipped. However, What works for one screen resolution does not work
    for another.

    For example, I have a list control with three columns. The column sizes are
    specified in the LVCOLUMN structure and three consecutive calls to
    InsertColumn using 90, 80 and 100 units, respectively. On a screen with high
    resolution, this leaves tons of room to spare along the right-hand side of
    the list control. On lower resolution screens, the right-most column gets
    clipped and you have to use the horizontal scroll bar to see it. I know my
    users will hate that.

    I am surprised that there is not a simple member function for CListView or
    CListCtrl that returns the length and width of the entire list control
    rectangle so that I can size each column of the control as a fraction of the
    full width of the list control. Is there some reason why that is not
    available?

    In the absence of such a simple and useful function, how, exactly, can I
    obtain, at runtime, the width of the control and then size each column
    accordingly?

    Thank you in advance,
    Mark Roberts,
    Toronto



  2. Re: Sizing Columns in CListView's / CListCtrl's

    I get the width of the ListCtrl using GetClientRect(), then divide
    accordingly.

    --
    -------------------------------------------------------------------------
    Free software - Baxter Codeworks www.baxcode.com
    -------------------------------------------------------------------------


    "Mark Roberts" wrote in message
    news:NLzEc.77819$Ax1.744263@news20.bellglobal.com. ..
    > Greetings:
    >
    > I'm writing an application that must run on a variety of machines with
    > different screen resolution settings. I have many dialogs containing list
    > views and I would like to be able to initialize the column widths so that
    > they completely fill the full width of the list view without any column
    > being clipped. However, What works for one screen resolution does not work
    > for another.
    >
    > For example, I have a list control with three columns. The column sizes

    are
    > specified in the LVCOLUMN structure and three consecutive calls to
    > InsertColumn using 90, 80 and 100 units, respectively. On a screen with

    high
    > resolution, this leaves tons of room to spare along the right-hand side of
    > the list control. On lower resolution screens, the right-most column gets
    > clipped and you have to use the horizontal scroll bar to see it. I know my
    > users will hate that.
    >
    > I am surprised that there is not a simple member function for CListView or
    > CListCtrl that returns the length and width of the entire list control
    > rectangle so that I can size each column of the control as a fraction of

    the
    > full width of the list control. Is there some reason why that is not
    > available?
    >
    > In the absence of such a simple and useful function, how, exactly, can I
    > obtain, at runtime, the width of the control and then size each column
    > accordingly?
    >
    > Thank you in advance,
    > Mark Roberts,
    > Toronto
    >
    >




+ Reply to Thread