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

icon into GridHeader

Thread ID:





24036 Jan 27,2005 10:12 AM UTC Jan 27,2005 12:58 PM UTC WinForms 7
Tags: GridControl
Hrvoje Voda
Asked On January 27, 2005 10:12 AM UTC

i would like to put an icon into gridHeader but by writting a code

Administrator [Syncfusion]
Replied On January 27, 2005 10:21 AM UTC

For a GridControl, try adding these lines to the Form_Load event to show an icon in col header 3. ImageList imageList = new ImageList(); imageList.Images.Add(SystemIcons.Warning.ToBitmap()); imageList.Images.Add(SystemIcons.Application.ToBitmap()); this.gridControl1[3,0].ImageList = imageList; this.gridControl1[3,0].CellType = "Static"; this.gridControl1[3,0].ImageIndex = 0; If you want the cell to keep the 3d appearance, also set the style.CellAppearance property. If you are using a GridDataBoundGrid, then you would need to handle PrepareViewStyleInfo to set the same properties on e.Style based on the values of e.ColIndex and e.RowIndex.

Hrvoje Voda
Replied On January 27, 2005 11:04 AM UTC

I''m trying to put icon in CellHeader 2 but i can only put in CellHeader 0! Why?

Administrator [Syncfusion]
Replied On January 27, 2005 11:22 AM UTC

Are you using a GridDataBoundGrid? If so, you cannot use the code snippets above. You have to use PrepareViewStyleInfo.

Hrvoje Voda
Replied On January 27, 2005 12:07 PM UTC

I''m using BoundControl but I don''t know how to use ColIndex? e.ColIndex ?

Administrator [Syncfusion]
Replied On January 27, 2005 12:21 PM UTC

Here is a link to a sample. http://www.syncfusion.com/forums/Uploads/GDBG_ImageInColHeader.zip

Hrvoje Voda
Replied On January 27, 2005 12:51 PM UTC

Great! Now it all works! I just have one more question and then i want ask it ever again! :) How do i put that icon in center of a CellHeader? There is now method for it within Cell properties

Administrator [Syncfusion]
Replied On January 27, 2005 12:58 PM UTC

Instead of setting CellType = "Static", try this code. e.Style.CellType = "Image"; e.Style.ImageSizeMode = GridImageSizeMode.CenterImage;


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

Live Chat Icon For mobile
Live Chat Icon