Type | Description | |||
Handle as Variant |
The Handle parameter can be:
|
The control provides an image list window, that's displayed at design time. The ImageSize property defines the size (width/height) of the icons within the control's Images collection. Use the ShowImageList property to hide the image list window, at design time. At design time, the user can add new icons to the control's Images collection, by dragging icon files, exe files, etc, to the images list window. At runtime, the user can use the Images and ReplaceIcon method to change the Images collection. The Images collection is 1 based. Use the CellImage, CellImages properties to assign icons to a cell. Use the CellPicture property to load a picture in a cell.
The following VB sample adds two icons to the control's images collection using the BASE64 encoding strings:
With Grid1 .BeginUpdate .Images "gBJJgBAICAAGAAEAAQhYAf8Pf4hh0QihCJo2AEZjQAjEZFEaIEaEEaAIAkcbk0olUrlktl0vmExmUzmk1m03nE5nU7nk9n0/oFBoVDolFo1HpFJpVLplNp1PqFRqVTqlVq1XrFZrVbrldr1fsFhsVjslls1ntFptVrtltt1vuFxuVzul1u13vF5vV7vl9v1/wGBwWDwCAw0Tf9dYGLAGLYGEvsQxGNxmSqmOymPzGYyFvwyAyeSzGiysPpObxmozWlxOWztlyWkx+x02j2usoOcjWqzOh020xOvrOf32J23G3GyyfHmu6jPO3vM4nA4vCqPU5nK12gjOg7WmmnEjfQ7O/03E6fm4PWpXow/f5Gz8AA0HM7uTmmY8W7xnE6T3vU5bGPYpz1vW9zvNu+UDuq+7XJk3j9ue5MAwRBsCKpAyNQs5T7wc+afN46SNOpDsMK/C0OQU/CjxK88NxJAMTrPFLDwk68AxNGa4QsrjqR3IEgyFIciI0iwfJXJCPJAkSSAAkqUSgnEHyKmCKI2eZ/yyjZwH/LsuB+cAfvGB5gAe8YBmAAaNkAAM2zZN0pIzNc1o3Ok2AOQADy4A5wT2jR8AfQKNn8B9Co2f5P0TREHoCA==" .Columns.Add("Column 1").HeaderImage = 1 .Items.CellImage(.Items.AddItem("Item 1"), 0) = 2 .EndUpdate End With
The following template adds two icons to the control's images collection using the BASE64 encoding strings:
BeginUpdate Images("gBJJgBAICAAGAAEAAQhYAf8Pf4hh0QihCJo2AEZjQAjEZFEaIEaEEaAIAkcbk0olUrlktl0vmExmUzmk1m03nE5nU7nk9n0/oFBoVDolFo1HpFJpVLplNp1PqFRqVTqlVq1XrFZrVbrldr1fsFhsVjslls1ntFptVrtltt1vuFxuVzul1u13vF5vV7vl9v1/wGBwWDwCAw0Tf9dYGLAGLYGEvsQxGNxmSqmOymPzGYyFvwyAyeSzGiysPpObxmozWlxOWztlyWkx+x02j2usoOcjWqzOh020xOvrOf32J23G3GyyfHmu6jPO3vM4nA4vCqPU5nK12gjOg7WmmnEjfQ7O/03E6fm4PWpXow/f5Gz8AA0HM7uTmmY8W7xnE6T3vU5bGPYpz1vW9zvNu+UDuq+7XJk3j9ue5MAwRBsCKpAyNQs5T7wc+afN46SNOpDsMK/C0OQU/CjxK88NxJAMTrPFLDwk68AxNGa4QsrjqR3IEgyFIciI0iwfJXJCPJAkSSAAkqUSgnEHyKmCKI2eZ/yyjZwH/LsuB+cAfvGB5gAe8YBmAAaNkAAM2zZN0pIzNc1o3Ok2AOQADy4A5wT2jR8AfQKNn8B9Co2f5P0TREHoCA==") Columns { Add("Column 1") { HeaderImage = 1 } } Items { Dim h h = AddItem("Item 1") CellImage(h, 0) = 2 } EndUpdate
The following VB sample shows how to replace the entire list of icons, using a Microsoft Image List control ( ImageList1 ):
Grid1.Images ImageList1.hImageList
The control copies the images list, so destroying the source of the images list should not affect the images in the control.
The following C++ sample loads icons from a BASE64 encoded string:
#include "Items.h" #include "Columns.h" #include "Column.h" m_grid.BeginUpdate(); CString s = "gBJJgBAIDAAGAAEAAQhYAf8Pf4hh0QihCJo2AEZjQAjEZFEaIEaEEaAIAkcbk0olUrlktl0vmExmUzmk1m03nE5nU7nk9n0/oFBoVDolFo1HpFJpVLplNp1PqFRqVTqlVq1XrFZrVbrldr1fsFhsVjslls1ntFptVrtltt1vuFxuVzul1u13vF5vV7vl9v1/wGBnqAQEZwmCxFhYGLib"; s += "/xoAw9ZiFdxbAAGVxM5yOTzkPy+MzGRpmdx2kl2epGY1WgxmZl+Yyery2yyGHyeirGoo+03mM02Jzee029y2Ewum2+FnOTlGezHNx0b3/C3U258a4mP5HVvOw52s2fg2vH6ml8uf8OWmnMjXs9vRjXG8fa88068Z+/o/XJ8nm/zHrg4L/ti8TQts87svyljfuk+DlPfAbPPkicAJnCbs"; s += "NbDDLO2xz5PlBi3O8x0EsZD7zuG8T1vrCD5uZE7zxM+CXQNB78RKw8RRbF8Rwyu0UPS/UYsfBSbw4lEJx3AEkwvGbxSY/clsPIT3L600pxhHECx6lsjLA7LbxZH7XJfK0Dwi/8iNPJMjSo0clvjMLuTHLkJTNCqVTSms2Tkq8jTzOcVP/BsePUocQLDQ9AJ3LtFUbR1HqaiwfJXSaPJA"; s += "kSSAAkqUU2nE20gmp5oo6JwH+eZ31EjJwB+eBn1K/AHnBWIfvwAZwACYAHsMy9cIMyFeEBTrIADYKSWLX1ipLXxgJLYgDoyeDIA+cFngAfwAVWfFdIcAB8B+f1tn+YJ/D+f5Poyf5xoojKAg"; m_grid.Images( COleVariant( s ) ); m_grid.GetColumns().Add( "Column 1" ); COleVariant vtMissing; V_VT( &vtMissing ) = VT_ERROR; CItems items = m_grid.GetItems(); long h = items.AddItem( COleVariant( "Item 1" ) ); items.SetCellImage( COleVariant( h ), COleVariant( (long) 0 ), 1 ); h = items.AddItem( COleVariant( "Item 2" ) ); items.SetCellImages( COleVariant( h ), COleVariant( (long) 0 ), COleVariant( "2,3" ) ); m_grid.EndUpdate();
The following C++ sample loads icon from a HIMAGELIST type:
SHFILEINFO sfi; ZeroMemory( &sfi, sizeof(sfi) ); HIMAGELIST hSysImageList = (HIMAGELIST)SHGetFileInfo(_T("C:\\"), 0, &sfi, sizeof (SHFILEINFO), SHGFI_SMALLICON | SHGFI_SYSICONINDEX ); m_grid.Images( _variant_t( (long)hSysImageList ) );
The following VB.NET sample loads icons from a BASE64 encoded string:
Dim s As String With AxGrid1 .BeginUpdate() s = "gBJJgBAIDAAGAAEAAQhYAf8Pf4hh0QihCJo2AEZjQAjEZFEaIEaEEaAIAkcbk0olUrlktl0vmExmUzmk1m03nE5nU7nk9n0/oFBoVDolFo1HpFJpVLplNp1PqFRqVTqlVq1XrFZrVbrldr1fsFhsVjslls1ntFptVrtltt1vuFxuVzul1u13vF5vV7vl9v1/wGBnqAQEZwmCxFhYGLib/xoAw9ZiFdxbAAGVxM5yOTzkPy+MzGRpmdx2kl2epGY1WgxmZl+Yyery2yyGHyeirGoo+03mM02Jzee029y2Ewum2+FnOTlGezHNx0b3/C3U258a4mP5HVvOw52s2fg2vH6ml8uf8OWmnMjXs9vRjXG8fa88068Z+/o/XJ8nm/zHrg4L/ti8TQts87svyljfuk+DlPfAbPPkicAJnCbsNbDDLO2xz5PlBi3O8x0EsZD7zuG8T1vrCD5uZE7zxM+CXQNB78RKw8RRbF8Rwyu0UPS/UYsfBSbw4lEJx3AEkwvGbxSY/clsPIT3L600pxhHECx6lsjLA7LbxZH7XJfK0Dwi/8iNPJMjSo0clvjMLuTHLkJTNCqVTSms2Tkq8jTzOcVP/BsePUocQLDQ9AJ3LtFUbR1HqaiwfJXSaPJAkSSAAkqUU2nE20gmp5oo6JwH+eZ31EjJwB+eBn1K/AHnBWIfvwAZwACYAHsMy9cIMyFeEBTrIADYKSWLX1ipLXxgJLYgDoyeDIA+cFngAfwAVWfFdIcAB8B+f1tn+YJ/D+f5" s = s + "Poyf5xoojKAg" .Images(s) .Columns.Add("Column 1") With .Items Dim h As Integer h = .AddItem("Item 1") .CellImage(h, 0) = 1 h = .AddItem("Item 2") .CellImages(h, 0) = "2,3" End With .EndUpdate() End With
The following C# sample loads icons from a BASE64 encoded string:
axGrid1.BeginUpdate(); string s = "gBJJgBAIDAAGAAEAAQhYAf8Pf4hh0QihCJo2AEZjQAjEZFEaIEaEEaAIAkcbk0olUrlktl0vmExmUzmk1m03nE5nU7nk9n0/oFBoVDolFo1HpFJpVLplNp1PqFRqVTqlVq1XrFZrVbrldr1fsFhsVjslls1ntFptVrtltt1vuFxuVzul1u13vF5vV7vl9v1/wGBnqAQEZwmCxFhYGLib/xoAw9ZiFdxbAAGVxM5yOTzkPy+MzGRpmdx2kl2epGY1WgxmZl+Yyery2yyGHyeirGoo+03mM02Jzee029y2Ewum2+FnOTlGezHNx0b3/C3U258a4mP5HVvOw52s2fg2vH6ml8uf8OWmnMjXs9vRjXG8fa88068Z+/o/XJ8nm/zHrg4L/ti8TQts87svyljfuk+DlPfAbPPkicAJnCbsNbDDLO2xz5PlBi3O8x0EsZD7zuG8T1vrCD5uZE7zxM+CXQNB78RKw8RRbF8Rwyu0UPS/UYsfBSbw4lEJx3AEkwvGbxSY/clsPIT3L600pxhHECx6lsjLA7LbxZH7XJfK0Dwi/8iNPJMjSo0clvjMLuTHLkJTNCqVTSms2Tkq8jTzOcVP/BsePUocQLDQ9AJ3LtFUbR1HqaiwfJXSaPJAkSSAAkqUU2nE20gmp5oo6JwH+eZ31EjJwB+eBn1K/AHnBWIfvwAZwACYAHsMy9cIMyFeEBTrIADYKSWLX1ipLXxgJLYgDoyeDIA+cFngAfwAVWfFdIcAB8B+f1tn+YJ/D+f5"; s = s + "Poyf5xoojKAg"; axGrid1.Images(s); axGrid1.Columns.Add("Column 1"); int h = axGrid1.Items.AddItem("Item 1"); axGrid1.Items.set_CellImage(h, 0, 1 ); h = axGrid1.Items.AddItem("Item 2"); axGrid1.Items.set_CellImages(h, 0,"2,3"); axGrid1.EndUpdate();
The following VFP sample loads icons from a BASE64 encoded string:
local s With thisform.Grid1 .BeginUpdate() s = "gBJJgBAIDAAGAAEAAQhYAf8Pf4hh0QihCJo2AEZjQAjEZFEaIEaEEaAIAkcbk0olUrlktl0vmExmUzmk1m03nE5nU7nk9n0/oFBoVDolFo1HpFJpVLplNp1PqFRqVTqlVq1XrFZrVbrl" s = s + "dr1fsFhsVjslls1ntFptVrtltt1vuFxuVzul1u13vF5vV7vl9v1/wGBnqAQEZwmCxFhYGLib/xoAw9ZiFdxbAAGVxM5yOTzkPy+MzGRpmdx2kl2epGY1WgxmZl+Yyery2yyGHyeir" s = s + "Goo+03mM02Jzee029y2Ewum2+FnOTlGezHNx0b3/C3U258a4mP5HVvOw52s2fg2vH6ml8uf8OWmnMjXs9vRjXG8fa88068Z+/o/XJ8nm/zHrg4L/ti8TQts87svyljfuk+DlPfAbPP" s = s + "kicAJnCbsNbDDLO2xz5PlBi3O8x0EsZD7zuG8T1vrCD5uZE7zxM+CXQNB78RKw8RRbF8Rwyu0UPS/UYsfBSbw4lEJx3AEkwvGbxSY/clsPIT3L600pxhHECx6lsjLA7LbxZH7XJfK0D" s = s + "wi/8iNPJMjSo0clvjMLuTHLkJTNCqVTSms2Tkq8jTzOcVP/BsePUocQLDQ9AJ3LtFUbR1HqaiwfJXSaPJAkSSAAkqUU2nE20gmp5oo6JwH+eZ31EjJwB+eBn1K/AHnBWIfvwAZwACYAHsMy9cIMyFeEBTrIADYKSWLX1ipLXxgJLYgDoyeDIA+cFngAfwAVWfFdIcAB8B+f1tn+YJ/D+f5" s = s + "Poyf5xoojKAg" .Images(s) .Columns.Add("Column 1") With .Items .DefaultItem = .AddItem("Item 1") .CellImage(0, 0) = 1 .DefaultItem = .AddItem("Item 2") .CellImages(0, 0) = "2,3" EndWith .EndUpdate() EndWith