property Items.CellPicture (Index as Long, ColIndex as Variant) as Variant
Retrieves or sets a value that indicates the Picture object displayed by the cell.

 TypeDescription 
   Index as Long A long expression that indicates the index of the item.  
   ColIndex as Variant A long expression that indicates the column's index, or a string expression that indicates the column's caption or column's key.  
   Variant A Picture object that indicates the cell's picture. ( A Picture object implements IPicture interface ), a string expression that indicates the base64 encoded string that holds a picture object. Use the eximages tool to save your picture as base64 encoded format.  

The control can associate to a cell a check or radio button, an icon, multiple icons, a  picture and a caption. Use the CellPicture property  to associate a picture to a cell. You can use the CellPicture property when you want to display images with different widths into a cell. Use the CellImage property to associate an icon from Images collection. Use the CellImages property to assign multiple icons to a cell. Use the CellHasCheckBox property to add a check box to a cell. Use the CellHasRadioButton property to assign a radio button to a cell. Use the ItemHeight property to enlarge the item's height. The CellPictureWidth and CellPictureHeight properties specifies the size of the area where the cell's picture is stretched.

The following VB sample loads a picture from a file:

With List1.Items
    .CellPicture(.FirstVisibleItem, 0) = "c:\winnt\logo.gif"
End With

The following sample loads the picture whose base64 representation is:

The following VB sample associates a picture to a cell by loading it from a base64 encoded string:

The following C++ loads a picture from a file:

The following VB.NET sample loads a picture from a file:

With AxList1.Items
    .CellPicture(.FocusItem, 0) = IPDH.GetIPictureDisp(Image.FromFile("c:\winnt\zapotec.bmp"))
End With 

where the IPDH class is defined like follows:

Public Class IPDH
    Inherits System.Windows.Forms.AxHost

    Sub New()
        MyBase.New("")
    End Sub

    Public Shared Function GetIPictureDisp(ByVal image As Image) As Object
        GetIPictureDisp = AxHost.GetIPictureDispFromPicture(image)
    End Function

End Class

The following C# sample loads a picture from a file:

axList1.Items.set_CellPicture(axList1.Items.FocusItem, 0, IPDH.GetIPictureDisp(Image.FromFile("c:\\winnt\\zapotec.bmp")));

where the IPDH class is defined like follows:

internal class IPDH : System.Windows.Forms.AxHost
{
	public IPDH() : base("")
	{
	}

	public static object GetIPictureDisp(System.Drawing.Image image)
	{
		return System.Windows.Forms.AxHost.GetIPictureDispFromPicture( image );
	}
}

The following VFP sample loads a picture from a file:

with thisform.List1.Items
	.CellPicture( .FocusItem, 0 ) = LoadPicture("c:\winnt\zapotec.bmp")
endwith


Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.