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.
Unfortunately, activation email could not send to your email. Please try again.

image in cell

Thread ID:

Created:

Updated:

Platform:

Replies:

30894 Jun 26,2005 04:59 PM Jun 30,2005 06:45 AM Windows Forms 14
loading
Tags: GridControl
Hrvoje Voda
Asked On June 26, 2005 04:59 PM

How to put an image into column header ?

Administrator [Syncfusion]
Replied On June 26, 2005 09: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.

Hrvoje Voda
Replied On June 27, 2005 04:11 AM

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

Administrator [Syncfusion]
Replied On June 27, 2005 04:45 AM

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

Can you give me some example with preparestyleinfo and ColIndx?

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

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

Hrvoje Voda
Replied On June 29, 2005 08:17 AM

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

Administrator [Syncfusion]
Replied On June 29, 2005 10: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.

Hrvoje Voda
Replied On June 29, 2005 05:40 PM

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

Administrator [Syncfusion]
Replied On June 29, 2005 07: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.

Hrvoje Voda
Replied On June 30, 2005 04:03 AM

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

Administrator [Syncfusion]
Replied On June 30, 2005 04: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)?

Hrvoje Voda
Replied On June 30, 2005 04: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.

Administrator [Syncfusion]
Replied On June 30, 2005 05: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.

Hrvoje Voda
Replied On June 30, 2005 06:45 AM

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

CONFIRMATION

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.

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.

;