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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

image in cell

Thread ID:





30894 Jun 26,2005 08:59 PM UTC Jun 30,2005 10:45 AM UTC WinForms 14
Tags: GridControl
Hrvoje Voda
Asked On June 26, 2005 08:59 PM UTC

How to put an image into column header ?

Administrator [Syncfusion]
Replied On 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.

Hrvoje Voda
Replied On June 27, 2005 08:11 AM UTC

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

Administrator [Syncfusion]
Replied On 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";

Hrvoje Voda
Replied On June 29, 2005 08:41 AM UTC

Can you give me some example with preparestyleinfo and ColIndx?

Administrator [Syncfusion]
Replied On June 29, 2005 09:05 AM UTC


Hrvoje Voda
Replied On June 29, 2005 12:17 PM UTC

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

Administrator [Syncfusion]
Replied On 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.

Hrvoje Voda
Replied On June 29, 2005 09:40 PM UTC

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

Administrator [Syncfusion]
Replied On 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.

Hrvoje Voda
Replied On June 30, 2005 08:03 AM UTC

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

Administrator [Syncfusion]
Replied On 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)?

Hrvoje Voda
Replied On 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.

Administrator [Syncfusion]
Replied On 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.

Hrvoje Voda
Replied On June 30, 2005 10:45 AM UTC

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


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon