VSFlexGrid Control > VSFlexGrid Properties, Events, and Methods > VSFlexGrid Properties > CellButtonPicture Property |
Returns or sets the picture used in cell buttons.
[form!]VSFlexGrid.CellButtonPicture[ = Picture ]
This property allows you to customize the appearance of cell buttons. For details on how to create and handle cell buttons, see the CellButtonClick event.
If you want to use a single picture for all cell buttons on the grid, assign the picture to the CellButtonPicture property at design time, or at the Form_Load event. To change pictures depending on the row, column, or cell being edited, trap the BeforeEdit event and set the picture accordingly. For example, the code below uses different pictures depending on the column being edited:
Private Sub fg_BeforeEdit(ByVal Row As Long, ByVal Col As Long, Cancel As Boolean)
Select Case Col
Case 2 ' ellipsis button
fg.ComboList = "..."
Set fg.CellButtonPicture = Nothing
Case 3 ' font button
fg.ComboList = "..."
Set fg.CellButtonPicture = imgFont
Case 4 ' color button
fg.ComboList = "..."
Set fg.CellButtonPicture = imgColor
Case Else ' no button
fg.ComboList = ""
Set fg.CellButtonPicture = Nothing
End Select
End Sub
The pictures used for cell buttons should fit within the button (larger pictures are truncated). They should also be transparent, so the button face can be seen through the empty parts of the picture. For best results, use small icons (16 x 16 pixels) and draw the picture in the upper left 12 x 12 rectangle within the icon.
Picture