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

Losing BackColor in Styles

From time to time I''m losing the BackColor in my grid styles when I run my application. That is, the BackColors are set, I run the app from VS.NET, and when I return to the designer all BackColors are reset to their defaults (and no longer appear in InitializeComponent). Any idea what''s happening? Note that none of my other grid style info (like TextColor) is lost, just the BackColor.

6 Replies

AD Administrator Syncfusion Team January 28, 2005 09:32 PM UTC

What version are you using? 3010 is the first release that does not save cell style information for a GridControl as a binary resource. Instead, it saves everything through collections in code. Is this the version you are seeing this problem with? If so, can you post the IniytializeComponent code when the backcolor is present so we can try to reproduce the problem.


ML Michael Lenaghan January 29, 2005 02:20 AM UTC

I can do that, but I just noticed this when I compiled: Code generation for property ''ColWidthEntries'' failed. Error was: ''Specified cast is not valid.'' Code generation for property ''Interior'' failed. Error was: ''value'' Code generation for property ''Interior'' failed. Error was: ''value'' Code generation for property ''Interior'' failed. Error was: ''value'' It just so happens that I''m losing three BackColors; could there be a relationship?


AD Administrator Syncfusion Team January 29, 2005 06:37 AM UTC

Was this form originally created with an 2.x version of Essential Grid? If so, did you run the Syncfusion\Essential Suite\3.0.1.0\Utilities\Migration\1.1\ConvertResx utility to convert this old resx? (Use 1.0\Convertresx if you are using .Net 1.0). If you have not done this, then you might get the old resx and try it. With 3.0.1.0 and a new form, I tried setting BackColor on individual cells and columns along with some other properties and things seems to work OK for me. Are you setting these BackColors on individual cells or columns or basestyles?


ML Michael Lenaghan January 29, 2005 06:34 PM UTC

This form was created with 3.0.1.0. The BackColors are set in BaseStyles. It looks like those BackColors are then used in the Interior property of the style--at least, when I inspect I see that they''ve been set to the same value--and it''s the Interior property that''s reporting the error. Btw, my current workaround is to reset the colors for those styles in FormLoad. Also: I''m having another style problem that I''ll post as a separate message.


AD Administrator Syncfusion Team January 30, 2005 06:29 PM UTC

Hi Michael, BackColor is just a shortcut to set interior. Internally it will create a BrushInfo and assign it to Interior. Interior will then be written out to InitializeComponent method. Regarding your problem: Are the syncfusion dlls in the GAC? If not can you try registering them? Normally InvalidCastException occur when dll are not in the GAC and CopyLocal = true for the assemblies because then the VS designer loads the same dll from multiple locations. If that''s not the case I don''t know what could be wrong. Can you try on another machine or can you send a sample project? Thanks, Stefan


ML Michael Lenaghan January 30, 2005 07:56 PM UTC

Yes, I have 9 Syncfusion dll''s in the gac: Syncfusion.Core, Syncfusion.Grid.Base, Syncfusion.Grid.Windows, Syncfusion.Scripting.Base, Syncfusion.Scripting.Windows, Syncfusion.Shared.Base, Syncfusion.Shared.Web, Syncfusion.Shared.Windows, Syncfusion.WebServer. All but WebServer are 3.0.1.0. I can''t really send the project; it''s very, very large. I could perhaps send you the one unit that uses the grid so that you could at least see the source. Where would I send it to...? Btw, a) I''m still occassionally seeing CurrentCell with the wrong style and b) if I don''t set "e.Cancel = true" in CurrentCellStartEditing, read-only fields allow a couple of keystrokes.

Loader.
Up arrow icon