Listview Control ?
- From: "JerryWEC" <JerryWEC@xxxxxxxxxxxxxxxxx>
- Date: Wed, 17 Jan 2007 09:52:09 -0500
Hi all.
I have an issue that maybe someone has seen before... The code below is
getting the size of the sting using the listview font and it is about 2
twice the size it needs to be so I'm dividing by 2 and adding a 20 for good
measure. Does anyone know how to convert the unit of measure from the
StringSize to there correct unit of measure for the .Width of the listview
control?
Any Ideas would be greatly appreciated! JerryM
Dim g As System.Drawing.Graphics =
m_formInstance.lvwLoggingList.CreateGraphics()
Dim StringSize As SizeF = g.MeasureString(Text,
m_formInstance.lvwLoggingList.Font)
Dim StringWidth As Integer = CLng(StringSize.Width) / 2 + 20
If StringWidth > Me.TextColumnWidth Then
Me.TextColumnWidth = StringWidth
m_formInstance.lvwLoggingList.Columns(2).Width = StringWidth
End If
**********************************************************************************************************************
I have also tried to AutoResize the columns as seen below. This works good
on my machine but when class library is used in another application on
another workstation the column width is to small?...
m_formInstance.lvwLoggingList.Columns(2).AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent)
.
- Follow-Ups:
- RE: Listview Control ?
- From: Linda Liu [MSFT]
- RE: Listview Control ?
- Prev by Date: Re: Avoiding the Form's BackColor to Control
- Next by Date: Efficient way of removing selected items from a (very) large ListView
- Previous by thread: Avoiding the Form's BackColor to Control
- Next by thread: RE: Listview Control ?
- Index(es):