By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,505 Members | 1,517 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,505 IT Pros & Developers. It's quick & easy.

Automatically Resize Flex Grid

P: n/a
I came across some code to automatically resize a flex grid. It works
adequately--it will resize to allow all of the text to be seen in a
given column. But, it resizes the column too much. That is, there is
blank space on the right-hand side that I'd rather not have there.
Any ideas? Thanks.

Vincent

' We need a Device Context to:
' Select our created font into
hDC1 = modTwips.GetDC(0&)

With Me.flxGrid
'Optimize column size
For col = 0 To .Cols - 1
colWidth = 0
For row = 0 To .rows - 1
strTmp = .TextMatrix(row, col)
lngTmp = apiGetTextExtentPoint32(hDC1, strTmp,
Len(strTmp), stfsize)
If colWidth < stfsize.cx Then colWidth = stfsize.cx
Next row
.colWidth(col) = (modTwips.TwipsPerPixelX * colWidth)
Next col
End With

Jul 19 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.