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

 TypeDescription 
   Item as Variant A long expression that indicates the item's handle.  
   ColIndex as Variant A long expression that indicates the column's index, a string expression that indicates the column's caption or the 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 CellPictureWidth and CellPictureHeight properties to stretch the cell's picture to a specified size. Use the Def(exCellDrawPartsOrder) property to change the positions of drawing elements in the cell.

The following VB sample loads a picture from a file:

G2antt1.Items.CellPicture(h, 0) = LoadPicture("c:\winnt\logo.gif")

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 AxG2antt1.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:

axG2antt1.Items.set_CellPicture(axG2antt1.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.G2antt1.Items
	.DefaultItem = .FocusItem
	.CellPicture( 0, 0 ) = LoadPicture("c:\winnt\zapotec.bmp")
endwith
 


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