Merci beaucoup "jt" a écrit dans le message de news:
il s'agit de la propriete colWidth(index) index represente le numero de colone la valeur est en twips ex msFlexGrid1.ColWidth(2)P0
"Dan" a écrit dans le message de news: 4364d414$0$452$
Bonjour à tous. Je ne trouve pas comment on peut gérer la taille des colonnes du contrôle :
msflexgrild merci de votre aide. Dan
John Smith
salut, Pour mettre une fonction autosize (crédit www.planetsourcecode.com)
Public Sub SetGridColumnWidth(grd As MSFlexGrid)
'params:ms flexgrid control 'purpose:sets the column widths to the 'lengths of the longest string in the co ' lumn 'requirements: the grid must have the sa ' me 'font as the underlying form Dim InnerLoopCount As Long Dim OuterLoopCount As Long Dim lngLongestLen As Long Dim sLongestString As String Dim lngColWidth As Long Dim szCellText As String
With grd
For OuterLoopCount = 0 To .Cols - 1 sLongestString = "" lngLongestLen = 0
For InnerLoopCount = 0 To .Rows - 1 szCellText = .TextMatrix(InnerLoopCount, OuterLoopCount)
If Len(szCellText) > lngLongestLen Then lngLongestLen = Len(szCellText) sLongestString = szCellText End If
Next
lngColWidth = .Parent.TextWidth(sLongestString) 'add 100 for more readable spreadsheet .ColWidth(OuterLoopCount) = lngColWidth + 200 Next
End With
End Sub "Dan" wrote in message news:4364ef5a$0$459$
Merci beaucoup "jt" a écrit dans le message de news:
il s'agit de la propriete colWidth(index) index represente le numero de colone la valeur est en twips ex msFlexGrid1.ColWidth(2)P0
"Dan" a écrit dans le message de news: 4364d414$0$452$
Bonjour à tous. Je ne trouve pas comment on peut gérer la taille des colonnes du contrôle :
msflexgrild merci de votre aide. Dan
salut,
Pour mettre une fonction autosize (crédit www.planetsourcecode.com)
Public Sub SetGridColumnWidth(grd As MSFlexGrid)
'params:ms flexgrid control
'purpose:sets the column widths to the
'lengths of the longest string in the co
' lumn
'requirements: the grid must have the sa
' me
'font as the underlying form
Dim InnerLoopCount As Long
Dim OuterLoopCount As Long
Dim lngLongestLen As Long
Dim sLongestString As String
Dim lngColWidth As Long
Dim szCellText As String
With grd
For OuterLoopCount = 0 To .Cols - 1
sLongestString = ""
lngLongestLen = 0
For InnerLoopCount = 0 To .Rows - 1
szCellText = .TextMatrix(InnerLoopCount, OuterLoopCount)
If Len(szCellText) > lngLongestLen Then
lngLongestLen = Len(szCellText)
sLongestString = szCellText
End If
Next
lngColWidth = .Parent.TextWidth(sLongestString)
'add 100 for more readable spreadsheet
.ColWidth(OuterLoopCount) = lngColWidth + 200
Next
End With
End Sub
"Dan" <antispam@mediacd.fr> wrote in message
news:4364ef5a$0$459$7a628cd7@news.club-internet.fr...
Merci beaucoup
"jt" <jt@nospam.fr> a écrit dans le message de news:
uYM02bW3FHA.1040@TK2MSFTNGP10.phx.gbl...
il s'agit de la propriete colWidth(index) index represente le numero de
colone
la valeur est en twips
ex
msFlexGrid1.ColWidth(2)P0
"Dan" <antispam@mediacd.fr> a écrit dans le message de news:
4364d414$0$452$7a628cd7@news.club-internet.fr...
Bonjour à tous.
Je ne trouve pas comment on peut gérer la taille des colonnes du
contrôle :
salut, Pour mettre une fonction autosize (crédit www.planetsourcecode.com)
Public Sub SetGridColumnWidth(grd As MSFlexGrid)
'params:ms flexgrid control 'purpose:sets the column widths to the 'lengths of the longest string in the co ' lumn 'requirements: the grid must have the sa ' me 'font as the underlying form Dim InnerLoopCount As Long Dim OuterLoopCount As Long Dim lngLongestLen As Long Dim sLongestString As String Dim lngColWidth As Long Dim szCellText As String
With grd
For OuterLoopCount = 0 To .Cols - 1 sLongestString = "" lngLongestLen = 0
For InnerLoopCount = 0 To .Rows - 1 szCellText = .TextMatrix(InnerLoopCount, OuterLoopCount)
If Len(szCellText) > lngLongestLen Then lngLongestLen = Len(szCellText) sLongestString = szCellText End If
Next
lngColWidth = .Parent.TextWidth(sLongestString) 'add 100 for more readable spreadsheet .ColWidth(OuterLoopCount) = lngColWidth + 200 Next
End With
End Sub "Dan" wrote in message news:4364ef5a$0$459$
Merci beaucoup "jt" a écrit dans le message de news:
il s'agit de la propriete colWidth(index) index represente le numero de colone la valeur est en twips ex msFlexGrid1.ColWidth(2)P0
"Dan" a écrit dans le message de news: 4364d414$0$452$
Bonjour à tous. Je ne trouve pas comment on peut gérer la taille des colonnes du contrôle :