ListView.Width <> Sum of ColumnHeader widths 
Author Message
 ListView.Width <> Sum of ColumnHeader widths

Hmm... you know, you're right about this behavior.  And I'm not sure why
it's happening, but you know what I'd do instead of worrying about it is
this:

1.      Go ahead and leave the code as is or else make the columns a little
skinnier if you want.
2.      In your app, when the user dismisses the form containing the listview
control, store in the registry the widths of the columns and read them back
in the next time you build the form at run time.  This will make your
application a lot more 'friendly' in your users' eyes -- since it allows
them to decide what width they like for the columns -- and will cause you
less headaches.

Mark Pribbenow
Systems Engineer
ARIS Corporation
http://www.*-*-*.com/
_______________________________



Quote:
> I am trying to set the width of the column headers of my
> ListView so that, together, they span the entire width
> of the ListView. Instead they always come out
> significantly wider, giving me a horizontal scroll bar
> that I don't want.  My code follows:

> lvwAccts.ColumnHeaders(1).Width = _
>    lvwAccts.Width / 4
> lvwAccts.ColumnHeaders(2).Width = _
>    lvwAccts.Width / 4
> lvwAccts.ColumnHeaders(3).Width = _
>    lvwAccts.Width / 2

> But the sum of the column header widths always adds up
> to more than the width of the ListView whence they were
> derived. Does anyone know what I'm doing wrong?

> Thanks for your help.
> --
> Napa Group, Inc.           Tel:212.689.9100
> 10 East 40th Street                Fax:212.689.9212
> New York, NY 10016         http://www.*-*-*.com/



Fri, 11 Jun 1999 03:00:00 GMT  
 ListView.Width <> Sum of ColumnHeader widths

I am trying to set the width of the column headers of my
ListView so that, together, they span the entire width
of the ListView. Instead they always come out
significantly wider, giving me a horizontal scroll bar
that I don't want.  My code follows:

lvwAccts.ColumnHeaders(1).Width = _
        lvwAccts.Width / 4
lvwAccts.ColumnHeaders(2).Width = _
        lvwAccts.Width / 4
lvwAccts.ColumnHeaders(3).Width = _
        lvwAccts.Width / 2

But the sum of the column header widths always adds up
to more than the width of the ListView whence they were
derived. Does anyone know what I'm doing wrong?

Thanks for your help.
--
Napa Group, Inc.                Tel:212.689.9100
10 East 40th Street             Fax:212.689.9212
New York, NY 10016              http://www.napa.com



Fri, 11 Jun 1999 03:00:00 GMT  
 ListView.Width <> Sum of ColumnHeader widths

David,

Quote:
>I am trying to set the width of the column headers of my
>ListView so that, together, they span the entire width
>of the ListView. Instead they always come out
>significantly wider, giving me a horizontal scroll bar
>that I don't want.  My code follows:

>lvwAccts.ColumnHeaders(1).Width = _
>    lvwAccts.Width / 4
>lvwAccts.ColumnHeaders(2).Width = _
>    lvwAccts.Width / 4
>lvwAccts.ColumnHeaders(3).Width = _
>    lvwAccts.Width / 2

The control's Width property gives you the entire width of the
control, which is not necessarily the same as the width of the area
used for painting the columns.

Also, even after taking that into account you need to watch out for
the fact that your divisions may result in an extra pixel here or
there and that will cause you further agravation.

Zane



Sat, 12 Jun 1999 03:00:00 GMT  
 ListView.Width <> Sum of ColumnHeader widths


Fri, 19 Jun 1992 00:00:00 GMT  
 ListView.Width <> Sum of ColumnHeader widths

Hi David,

<<<<<<<
I am trying to set the width of the column headers of my
ListView so that, together, they span the entire width
of the ListView. Instead they always come out
significantly wider, giving me a horizontal scroll bar
that I don't want.  My code follows:

lvwAccts.ColumnHeaders(1).Width = _
        lvwAccts.Width / 4
lvwAccts.ColumnHeaders(2).Width = _
        lvwAccts.Width / 4
lvwAccts.ColumnHeaders(3).Width = _
        lvwAccts.Width / 2

But the sum of the column header widths always adds up
to more than the width of the ListView whence they were
derived. Does anyone know what I'm doing wrong?

The width of a column in a ListView control cannot be set by using a
property and/or method when the View property is set to List. But
the following Knowledge Base article gives a generic procedure that can be
used to set the width of a column in a ListView control when in List view.

"How to Set the Column Width of Columns in a ListView Control"

To access this article refer to the following site.
http://www.microsoft.com/kb/articles/q147/6/66.htm

If your default view is report then you need not go for the above said
method.

Hope this helps,

Have a nice time,
Bharathy Mohan M.
Aditi Corp.

 Aditi Corp was formerly known as NetQuest Inc.

P.S. : Worried about response times to your queries?
 Check out our FREE technical support service at http://www.aditi.com/nntp.htm
OR just click on the attached link

begin 600 link.url
M6TEN=&5R;F5T4VAO<G1C=71=#0I54DP]:'1T<#HO+W=W=RYA9&ET:2YC;VTO
*;FYT<"YH=&T-"FAO
`
End



Sat, 12 Jun 1999 03:00:00 GMT  
 ListView.Width <> Sum of ColumnHeader widths


<snip>

Quote:

>"How to Set the Column Width of Columns in a ListView Control"

>To access this article refer to the following site.
>http://www.microsoft.com/kb/articles/q147/6/66.htm

<snip>

You didn't actually answer the question.  It is interesting to see the
use of the constant "5" in the sample program given as the number of
millimeters between columns.  But it still doesn't provide insight as
the "client area" of the control.

Zane



Sat, 12 Jun 1999 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Set Grid width to sum of Column Widths

2. ListView column width = ListView width ?

3. Listview control - columnheader width

4. Problem getting columnheader width after columnheader drag

5. Problem getting columnheader width after columnheader drag

6. <<<<<<<<ComboBox>>>>>>>>>>>>

7. Total width of columns = Width of ListView

8. Total width of columns = Width of ListView

9. Total width of columns = Width of ListView

10. Total width of columns = Width of ListView

11. HELP >>>>>>WIN API <<<<<<<<<<

12. help me out please!!!!<<<<<<<<<<<<<<<<<<<<<<<thanks>>>>>>>>>>>>>>>>>>>>>>>>

 

 
Powered by phpBB® Forum Software