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 26, 2005 08:16 PM

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 03:11 AM

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


AD Administrator Syncfusion Team June 27, 2005 03:45 AM

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 03:41 AM

Can you give me some example with preparestyleinfo and ColIndx?


AD Administrator Syncfusion Team June 29, 2005 04:05 AM

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


HV Hrvoje Voda June 29, 2005 07:17 AM

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


AD Administrator Syncfusion Team June 29, 2005 09:34 AM

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 04:40 PM

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


AD Administrator Syncfusion Team June 29, 2005 06:50 PM

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 03:03 AM

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


AD Administrator Syncfusion Team June 30, 2005 03:17 AM

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 03:25 AM

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 04:18 AM

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 05:45 AM

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

Loader.
Live Chat Icon For mobile
Up arrow icon