change column width in MSFlexgrid

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Nov 2008
Posts: 10
Reputation: singoi is an unknown quantity at this point 
Solved Threads: 0
singoi singoi is offline Offline
Newbie Poster

change column width in MSFlexgrid

 
0
  #1
Nov 28th, 2008
Hi Friends,

how can i change the columns width in MSflexgrid by code from 1.jpg to 2.Jpg

I have copied this code in my Module:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Public Function Grid_AutoSize(oGrid As MSFlexGrid, oLabel As Label)
  2. Dim nRow As Long
  3. Dim nCol As Long
  4. Dim nWidth As Long
  5. Dim nMaxWidth As Long
  6.  
  7. ' Setzen der Eigenschaften
  8. With oLabel
  9. With .Font
  10. .Name = oGrid.Font.Name
  11. .Size = oGrid.Font.Size
  12. .Bold = oGrid.Font.Bold
  13. .Italic = oGrid.Font.Italic
  14. .Strikethrough = oGrid.Font.Strikethrough
  15. .Underline = oGrid.Font.Underline
  16. End With
  17.  
  18. ' Wichtig!
  19. .WordWrap = False
  20. .AutoSize = True
  21. End With
  22.  
  23. ' Auswerten und Setzen der Grössen
  24. With oGrid
  25. For nCol = .FixedCols To .Cols - 1
  26. nMaxWidth = 0
  27. For nRow = .FixedRows To .Rows - 1
  28. oLabel.Caption = .TextMatrix(nRow, nCol)
  29. nWidth = oLabel.Width
  30. If nWidth + 100 > nMaxWidth Then nMaxWidth = nWidth + 100
  31. Next nRow
  32.  
  33. .ColWidth(nCol) = nMaxWidth
  34. Next nCol
  35. End With
  36. End Function


and i have called this function in my Form Load

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Grid_AutoSize msf1, lbltemp
  2.  
  3. Dim m As Long
  4. For m = 1 To msf1.Cols + 1
  5. msf1.ColWidth(-1) = 1400
  6. Next

can u please help me

Thanks,

Singoi
Attached Thumbnails
1.jpg   2.jpg  
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: change column width in MSFlexgrid

 
0
  #2
Nov 28th, 2008
Hi,

Try This :

  1. msf1.ColWidth(0) = 400
  2. msf1.ColWidth(1) = 1000
  3. msf1.ColWidth(2) = 1200
  4. msf1.ColWidth(3) = 1200
  5. msf1.ColWidth(4) = 1500

With a little bit of judgement, you can do it..

Regards
Veena
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Visual Basic 4 / 5 / 6 Forum


Views: 1706 | Replies: 1
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC