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.

DerivedCellControl style.Tag problems

Thread ID:

Created:

Updated:

Platform:

Replies:

726 Aug 6,2002 09:01 AM Aug 6,2002 10:13 AM Windows Forms 1
loading
Tags: GridControl
Roy Muller
Asked On August 6, 2002 09:01 AM

I've derived a cell model and renderer class similar to the LinkedLabel sample code. In the OnDraw() method there is a style parameter. I'd like to pass an object reference in style.Tag to the cellrenderer.OnDraw() method. First, I created a UserControl class and added a grid to it. In the constructor I add the custom cell type to the grid. Next I wrote an UpdateDataContents() method that populates the grid. In the loop I set the grid[x,y].CellType to the custom cell type specified in the constructor. I also set the grid[x,y].Tag to the object reference to pass in to the derived cell model/renderer classes. The problem I'm running into is the style.Tag in the custom renderer class is always null. I verified that the style.CellModel.Name property in the OnDraw method is correct. What coud I be missing? Is there a better way to display a cell that contains two different font sizes?

Roy Muller
Replied On August 6, 2002 10:13 AM

I'm not sure why, but when I deleted the grid from my UserControl and added it back in, it worked; I now see the Tag object reference in my custom cell rendering class. There is still a small difference between my code and the LinkedLabel sample code; VStudio adds a TableStyle to the grid in the InitializeComponent() method of my UserControl class whereas the sample code doesn't use VStudio's Form Designer. My problem is solved, but I believe there are bugs lurking in the VStudio form designer interface. It seem that the most reliable way to set properties is with code outside the form designer.

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.

;