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

DerivedCellControl style.Tag problems

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?

1 Reply

RM Roy Muller August 6, 2002 02:13 PM UTC

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.

Loader.
Live Chat Icon For mobile
Up arrow icon