make listview column fill the whole listview - basic.visual

This is a discussion on make listview column fill the whole listview - basic.visual ; Hi, I have a listview in report (details) mode. It only ever has one column so I want the column width to fill the whole listview as the control is resized if the listview has no vertical scrollbar I can ...

+ Reply to Thread
Results 1 to 5 of 5

make listview column fill the whole listview

  1. Default make listview column fill the whole listview

    Hi,

    I have a listview in report (details) mode. It only ever has one column so I
    want the column width to fill the whole listview as the control is resized

    if the listview has no vertical scrollbar I can set the column width to
    listview.width-90; if there is a scrollbar, I set it to listview.width-345.

    two problems with this:

    1. how to tell if there is a scrollbar present or not

    2. even if #1 is possible, this whole thing really stinks. Is there any
    better way to do what I want to do?

    Thanks in advance

    Andy



  2. Default Re: make listview column fill the whole listview

    Why not use sendmessage to cause the column to resize? ..
    http://www.mvps.org/vbnet/code/comct...mnautosize.htm

    You want to apply the LVSCW_AUTOSIZE_USEHEADER message to your single
    column.

    --

    Randy Birch
    MVP Visual Basic
    http://www.mvps.org/vbnet/
    Please respond only to the newsgroups so all can benefit.


    "Andy Fish" <ajfish@blueyonder.co.uk> wrote in message
    news:lcynb.4151$fp2.38449324@news-text.cableinet.net...
    : Hi,
    :
    : I have a listview in report (details) mode. It only ever has one column so
    I
    : want the column width to fill the whole listview as the control is resized
    :
    : if the listview has no vertical scrollbar I can set the column width to
    : listview.width-90; if there is a scrollbar, I set it to
    listview.width-345.
    :
    : two problems with this:
    :
    : 1. how to tell if there is a scrollbar present or not
    :
    : 2. even if #1 is possible, this whole thing really stinks. Is there any
    : better way to do what I want to do?
    :
    : Thanks in advance
    :
    : Andy
    :
    :



  3. Default Re: make listview column fill the whole listview

    Fantastic, thanks

    (I've not actually implemented it yet, but if it don't work I'll know where
    to come..)

    Andy

    "Randy Birch" <rgb_removethis@mvps.org> wrote in message
    news:AEznb.106863$h61.5094@news01.bloor.is.net.cable.rogers.com...
    > Why not use sendmessage to cause the column to resize? ..
    > http://www.mvps.org/vbnet/code/comct...mnautosize.htm
    >
    > You want to apply the LVSCW_AUTOSIZE_USEHEADER message to your single
    > column.
    >
    > --
    >
    > Randy Birch
    > MVP Visual Basic
    > http://www.mvps.org/vbnet/
    > Please respond only to the newsgroups so all can benefit.
    >
    >
    > "Andy Fish" <ajfish@blueyonder.co.uk> wrote in message
    > news:lcynb.4151$fp2.38449324@news-text.cableinet.net...
    > : Hi,
    > :
    > : I have a listview in report (details) mode. It only ever has one column

    so
    > I
    > : want the column width to fill the whole listview as the control is

    resized
    > :
    > : if the listview has no vertical scrollbar I can set the column width to
    > : listview.width-90; if there is a scrollbar, I set it to
    > listview.width-345.
    > :
    > : two problems with this:
    > :
    > : 1. how to tell if there is a scrollbar present or not
    > :
    > : 2. even if #1 is possible, this whole thing really stinks. Is there any
    > : better way to do what I want to do?
    > :
    > : Thanks in advance
    > :
    > : Andy
    > :
    > :
    >
    >




  4. Default Re: make listview column fill the whole listview

    Note this only works if the text in the last column is shorter than the
    space available, otherwise it expands the width to accommodate the text.

    --

    Randy Birch
    MVP Visual Basic
    http://www.mvps.org/vbnet/
    Please respond only to the newsgroups so all can benefit.


    "Andy Fish" <ajfish@blueyonder.co.uk> wrote in message
    news:fuOnb.4836$cw2.44626090@news-text.cableinet.net...
    : Fantastic, thanks
    :
    : (I've not actually implemented it yet, but if it don't work I'll know
    where
    : to come..)
    :
    : Andy
    :
    : "Randy Birch" <rgb_removethis@mvps.org> wrote in message
    : news:AEznb.106863$h61.5094@news01.bloor.is.net.cable.rogers.com...
    : > Why not use sendmessage to cause the column to resize? ..
    : > http://www.mvps.org/vbnet/code/comct...mnautosize.htm
    : >
    : > You want to apply the LVSCW_AUTOSIZE_USEHEADER message to your single
    : > column.
    : >
    : > --
    : >
    : > Randy Birch
    : > MVP Visual Basic
    : > http://www.mvps.org/vbnet/
    : > Please respond only to the newsgroups so all can benefit.
    : >
    : >
    : > "Andy Fish" <ajfish@blueyonder.co.uk> wrote in message
    : > news:lcynb.4151$fp2.38449324@news-text.cableinet.net...
    : > : Hi,
    : > :
    : > : I have a listview in report (details) mode. It only ever has one
    column
    : so
    : > I
    : > : want the column width to fill the whole listview as the control is
    : resized
    : > :
    : > : if the listview has no vertical scrollbar I can set the column width
    to
    : > : listview.width-90; if there is a scrollbar, I set it to
    : > listview.width-345.
    : > :
    : > : two problems with this:
    : > :
    : > : 1. how to tell if there is a scrollbar present or not
    : > :
    : > : 2. even if #1 is possible, this whole thing really stinks. Is there
    any
    : > : better way to do what I want to do?
    : > :
    : > : Thanks in advance
    : > :
    : > : Andy
    : > :
    : > :
    : >
    : >
    :
    :



  5. Default Re: make listview column fill the whole listview

    thanks, it worked a treat.

    just a note to anyone else who tries this method - you need to call
    lvAutosizeControl everytime you resize the listView.

    Andy

    "Randy Birch" <rgb_removethis@mvps.org> wrote in message
    news:VyOnb.114412$h61.99806@news01.bloor.is.net.cable.rogers.com...
    > Note this only works if the text in the last column is shorter than the
    > space available, otherwise it expands the width to accommodate the text.
    >
    > --
    >
    > Randy Birch
    > MVP Visual Basic
    > http://www.mvps.org/vbnet/
    > Please respond only to the newsgroups so all can benefit.
    >
    >
    > "Andy Fish" <ajfish@blueyonder.co.uk> wrote in message
    > news:fuOnb.4836$cw2.44626090@news-text.cableinet.net...
    > : Fantastic, thanks
    > :
    > : (I've not actually implemented it yet, but if it don't work I'll know
    > where
    > : to come..)
    > :
    > : Andy
    > :
    > : "Randy Birch" <rgb_removethis@mvps.org> wrote in message
    > : news:AEznb.106863$h61.5094@news01.bloor.is.net.cable.rogers.com...
    > : > Why not use sendmessage to cause the column to resize? ..
    > : > http://www.mvps.org/vbnet/code/comct...mnautosize.htm
    > : >
    > : > You want to apply the LVSCW_AUTOSIZE_USEHEADER message to your single
    > : > column.
    > : >
    > : > --
    > : >
    > : > Randy Birch
    > : > MVP Visual Basic
    > : > http://www.mvps.org/vbnet/
    > : > Please respond only to the newsgroups so all can benefit.
    > : >
    > : >
    > : > "Andy Fish" <ajfish@blueyonder.co.uk> wrote in message
    > : > news:lcynb.4151$fp2.38449324@news-text.cableinet.net...
    > : > : Hi,
    > : > :
    > : > : I have a listview in report (details) mode. It only ever has one
    > column
    > : so
    > : > I
    > : > : want the column width to fill the whole listview as the control is
    > : resized
    > : > :
    > : > : if the listview has no vertical scrollbar I can set the column width
    > to
    > : > : listview.width-90; if there is a scrollbar, I set it to
    > : > listview.width-345.
    > : > :
    > : > : two problems with this:
    > : > :
    > : > : 1. how to tell if there is a scrollbar present or not
    > : > :
    > : > : 2. even if #1 is possible, this whole thing really stinks. Is there
    > any
    > : > : better way to do what I want to do?
    > : > :
    > : > : Thanks in advance
    > : > :
    > : > : Andy
    > : > :
    > : > :
    > : >
    > : >
    > :
    > :
    >
    >




+ Reply to Thread

Similar Threads

  1. .net 2.0 listview last column width
    By Application Development in forum DOTNET
    Replies: 1
    Last Post: 11-15-2007, 07:42 PM
  2. forcing listview to only one column
    By Application Development in forum CSharp
    Replies: 2
    Last Post: 08-24-2007, 08:47 AM
  3. Hiding a listview column
    By Application Development in forum CSharp
    Replies: 4
    Last Post: 08-03-2007, 02:33 PM
  4. ListView Sort and Column Order problem Plz Help....
    By Application Development in forum CSharp
    Replies: 0
    Last Post: 06-21-2005, 11:19 AM
  5. listview column sort problem
    By Application Development in forum CSharp
    Replies: 4
    Last Post: 05-20-2005, 03:25 PM