We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

image in cell

How to put an image into column header ?

14 Replies

AD Administrator Syncfusion Team June 27, 2005 01:16 AM UTC

For a GridControl, you can set the celltype to be static and then set teh ImageList and ImageIndex properties on teh style to display an image. Me.gridControl1(0, 2).ImageList = imageList Me.gridControl1(0, 2).ImageIndex = 1 Me.gridControl1(0, 2).CellType = "Static" //the header shows the image in column 2. For a GridDataBoundGrid, you would need to handle PrepareViewStyleInfo, and depending upon the passed in e.ColIndex and e.RowIndex (should be zero). then set e.StyleInfo.CellType = "Static", and also set the ImageList and ImageIndex in the event handler as well.


HV Hrvoje Voda June 27, 2005 08:11 AM UTC

Can I do it somehow without imagelist? Just to call an image?


AD Administrator Syncfusion Team June 27, 2005 08:45 AM UTC

You can try using a Image celltype. this.grid[2, 1].CellValue = someImage; this.grid[2,1].CellType = "Image";


HV Hrvoje Voda June 29, 2005 08:41 AM UTC

Can you give me some example with preparestyleinfo and ColIndx?


AD Administrator Syncfusion Team June 29, 2005 09:05 AM UTC

http://www.syncfusion.com/Support/user/uploads/GDBG_Image_43c6c9ed.zip


HV Hrvoje Voda June 29, 2005 12:17 PM UTC

When i put an image on header I get a black background. Why? My image is transparent...


AD Administrator Syncfusion Team June 29, 2005 02:34 PM UTC

You can try setting this property to see if it helps. this.gridControl1.SupportsTransparentBackColor = true; If not, you can add your transparent bitmap to the sample above, and upload it here, and we can try to get it working.


HV Hrvoje Voda June 29, 2005 09:40 PM UTC

It''s not working! I still have a black background!


AD Administrator Syncfusion Team June 29, 2005 11:50 PM UTC

Here is a sample showing a bitmap in a cell with a transparent color. http://www.syncfusion.com/Support/user/uploads/GDBG_GLC_dc29c85a.zip If you upload a sample showing your problem, we can try to spot the problem here.


HV Hrvoje Voda June 30, 2005 08:03 AM UTC

Here is the code that I use and a picture with result in grid. image_8517.zip


AD Administrator Syncfusion Team June 30, 2005 08:17 AM UTC

Where have you get this code? e.Style.CellType = "Icon"; I do not know what an "Icon" celltype is? Did you register a custom cellmodel a CellType named "Icon"? Have you tried your bitmap in the sample I attached above (swapping the Blue our for your transparent color)?


HV Hrvoje Voda June 30, 2005 08:25 AM UTC

Yes but it doesn''t work. My image is transparent. But, when I put "Icon" under CellType I get an image without that black background. The problem is that I can''t put it in center.


AD Administrator Syncfusion Team June 30, 2005 09:18 AM UTC

Did you define an "Icon" celltype? If not, then setting CellType = "Icon" is the same as setting CellType = "Static" because the grid does not know any cell type name Icon so it defaults to a Static celltype. Please attach a sample project that I can run to see your problem. If you do this, I will try suggest a solution.


HV Hrvoje Voda June 30, 2005 10:45 AM UTC

I solved a problem with your example. Some parameters that I use were not correct.

Loader.
Up arrow icon