473,472 Members | 2,264 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

PropertyGrid Serialize Property of type SystemColor

Joe
Hi

I have a propertygrid that I allow the user to pick a system.color and I
want to save to a file to load later
onto the propertygrid. String and bool values work but I am unable to save
colors

Any suggestions???
Thanks
Serializing code
----------------
XmlSerializer mySerializer = new XmlSerializer(typeof(ExcelProperty));

// To write to a file, create a StreamWriter object.

StreamWriter myWriter = new StreamWriter(sFile);

mySerializer.Serialize(myWriter, this);

PropertyGrid Class

-------------------------

[Category("Header")]

[Description("Backcolor data header row")]

public System.Drawing.Color HeaderBackColor

{

get { return cBackColor; }

set { cBackColor = value; }

}

[Category("Data")]

[Description("Alternate row color data rows")]

public bool AlternateRowColoring

{

get { return bAlternateRow; }

set { bAlternateRow = value; }

}


Oct 8 '06 #1
3 2779
In article <OU**************@TK2MSFTNGP03.phx.gbl>, hc******@yahoo.com
says...
I am unable to save colors
Could you clarify that? Are you getting an error?

--
Patrick Steele
http://weblogs.asp.net/psteele
Oct 9 '06 #2
Joe
Hi

I get no error but the xml is empty for that property that stores
system.color

<AlternateRowColoring>true</AlternateRowColoring>
<AlternateRowColor />

"Patrick Steele" <pa*****@mvps.orgwrote in message
news:MP***********************@msnews.microsoft.co m...
In article <OU**************@TK2MSFTNGP03.phx.gbl>, hc******@yahoo.com
says...
>I am unable to save colors

Could you clarify that? Are you getting an error?

--
Patrick Steele
http://weblogs.asp.net/psteele

Oct 9 '06 #3
In article <#k**************@TK2MSFTNGP03.phx.gbl>, hc******@yahoo.com
says...
Hi

I get no error but the xml is empty for that property that stores
system.color

<AlternateRowColoring>true</AlternateRowColoring>
<AlternateRowColor />
The "Color" structure has no public settable properties (the R, G, B and
A properties are read-only so they aren't serializable). You'll need to
add an extra property to serialize a Color property. See:

http://tinyurl.com/p7wxv

--
Patrick Steele
http://weblogs.asp.net/psteele
Oct 11 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Zoury | last post by:
Hi! Is it possible to use the PropertyGrid control without bind it to a control? As if it were a standard list? I would like to add "properties" in it but i never know what it will be. For...
1
by: ANDRES BECERRA | last post by:
Herfried K. Wagner was kind enough to point me to the PropertyGrid control http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemwindowsformspropertygridclasstopic.asp I have found a few...
7
by: siddhiash | last post by:
Hi Friends I want to add PasswordChar Property which shows ****** for string which I type in PropertyGrid Control. Regards, Siddharth
5
by: Ger | last post by:
The propertygrid is a great control, but I would like to show a more descriptive text for the properties in the control. I tried to find a solution within the system.componentmodel but did not...
5
by: Diomatas | last post by:
Hi I ve got a class with some public properties and one of them is of type image. I use these properties in a propertygrid. When the user press the little button into the propertygrid, an open...
0
by: movieknight | last post by:
Hi, I have a class which I am feeding to the propertygrid, and I am exposing a Mesh object from my class for the propertygrid to display. I want the propertygrid to show the values (when you...
6
by: Steve Teeples | last post by:
Can someone show me an example of how to place a "CheckedListBox" property within a PropertyGrid? -- ----------- Thanks, Steve
4
by: Tugrul HELVACI | last post by:
Changing DisplayNames of my properties using PropertyGrid component, how ?? I'm using Delphi 2006 and I have a class defination like this: TPerson = class fPersonName : String;...
4
by: Rohan | last post by:
I need to use the Collection editor of the propertyGrid, but i can't this to work, i looked around on the NET on collection and I am kinda lost. i have this so far, i don't know what i should do...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.