FlexGrid for WinForms
Adding Pictures and Text to a Cell
Show AllShow All
Hide AllHide All

To add pictures and text to a cell, use the SetData and SetCellImage methods. Add the following code to the Form_Load event:

  1. Resize the cells to fit the image using the Height and Width properties.

    To write code in Visual Basic

    To write code in C#

  2. Add the SetCellImage method to add the image.

    To write code in Visual Basic

    To write code in C#

  3. Add the SetData method to add the text:

    To write code in Visual Basic

    To write code in C#

  4. Set the alignment of the image to CenterTop and the text to CenterBottom:

    To write code in Visual Basic

    To write code in C#

This topic illustrates the following:

Your grid will look like the following with an image and text in the same cell.


Note: To set the text on top of the picture, change the alignment of the text to CenterTop, and the alignment of the image to CenterBottom.

 

 


Copyright © GrapeCity, inc. All rights reserved.

Product Support Forum |  Documentation Feedback