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.
Syncfusion Feedback

GridGroupingControl - Custom PictureBox

Thread ID:

Created:

Updated:

Platform:

Replies:

68334 Sep 18,2007 05:01 PM UTC Sep 7,2012 06:32 AM UTC WinForms 2
loading
Tags: Tools
Russell Coombes
Asked On September 18, 2007 05:01 PM UTC

Hi,

I am using a GridGroupingControl to display images within the grid. I use the PictureBoxCellModel and PixtureBoxCellRenderer as examples for how to do this. As I am binding to an IList, I cannot set the cell style directly - instead I look to set it having added the columns, like so:

GridStyleInfo style = grid.TableModel.ColStyles["MyColumn"];

style.CellType = "PictureBox";

I also use "PictureBox" when I add the Cell Model:

grid.TableModel.CellModels.Add("PictureBox", new PictureBoxCellModel(gridControl1.Model));

However, this does not display images! I noticed that after setting the relevant ColStyle's 'CellType' to "PictureBox", the 'CellType' is still set to "TextBox"!!! Hence, the 'OnDraw' and 'OnLayout' methods never execute in the PictureBoxCellRenderer!

A colleague told me of a way round this - I had to set the style's CellType in the 'QueryCellStyleInfo' event instead. I did this and it now works. But it makes no sense why! I should be able to set the style's CellType at the same point of adding the CellModel. I see no logical reason why I have to grab the 'QueryCellStyleInfo' event and then have to set the CellType at this point. I have wasted way to long trying to solve this unobvious problem.

Can Syncfusion please let me know why I have to use the 'QueryCellStyleInfo' event, or, could you provide a better way of setting the CellType on a style?

Regards,
Russell

Russell Coombes
Replied On September 18, 2007 05:03 PM UTC

Please ignore or delete this forum post - I have recreated it in the Grid Forum.

Thanks,
Russell

>Hi,

I am using a GridGroupingControl to display images within the grid. I use the PictureBoxCellModel and PixtureBoxCellRenderer as examples for how to do this. As I am binding to an IList, I cannot set the cell style directly - instead I look to set it having added the columns, like so:

GridStyleInfo style = grid.TableModel.ColStyles["MyColumn"];

style.CellType = "PictureBox";

I also use "PictureBox" when I add the Cell Model:

grid.TableModel.CellModels.Add("PictureBox", new PictureBoxCellModel(gridControl1.Model));

However, this does not display images! I noticed that after setting the relevant ColStyle's 'CellType' to "PictureBox", the 'CellType' is still set to "TextBox"!!! Hence, the 'OnDraw' and 'OnLayout' methods never execute in the PictureBoxCellRenderer!

A colleague told me of a way round this - I had to set the style's CellType in the 'QueryCellStyleInfo' event instead. I did this and it now works. But it makes no sense why! I should be able to set the style's CellType at the same point of adding the CellModel. I see no logical reason why I have to grab the 'QueryCellStyleInfo' event and then have to set the CellType at this point. I have wasted way to long trying to solve this unobvious problem.

Can Syncfusion please let me know why I have to use the 'QueryCellStyleInfo' event, or, could you provide a better way of setting the CellType on a style?

Regards,
Russell


Ragamathulla B [Syncfusion]
Replied On September 7, 2012 06:32 AM UTC

Hi Russell,

 

Thank you for your interest in syncfusion products.

 

Please make use of the Grid.TableModel instead of gridcontrol1.Model which is resolve your reported issue.

 

Way 1:

grid.TableModel.CellModels.Add("PictureBox", new PictureBoxCellModel(gridControl1.Model));

 

Way 2:

 

Bitmap bm = Bitmap.FromFile(@"Animated.gif") as Bitmap;

            this.pictureBox1.Image = bm;

 

            this.grid.TableModel.ColStyles[2].CellType = "Control";

            this.grid.TableModel.ColStyles[2].Control = this.pictureBox1;

 

Hope this will be helpful for your reference.

 

http://www.syncfusion.com/support/forums/grid-windows/103636/Displaying-a-gif-image-inside-a-cell-is-not-work

 

Regards,

Ragamathullah B.


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.

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

;