473,654 Members | 3,082 Online
Bytes | Software Development & Data Engineering Community
+ 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(t ypeof(ExcelProp erty));

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

StreamWriter myWriter = new StreamWriter(sF ile);

mySerializer.Se rialize(myWrite r, this);

PropertyGrid Class

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

[Category("Heade r")]

[Description("Ba ckcolor data header row")]

public System.Drawing. Color HeaderBackColor

{

get { return cBackColor; }

set { cBackColor = value; }

}

[Category("Data" )]

[Description("Al ternate row color data rows")]

public bool AlternateRowCol oring

{

get { return bAlternateRow; }

set { bAlternateRow = value; }

}


Oct 8 '06 #1
3 2797
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

<AlternateRowCo loring>true</AlternateRowCol oring>
<AlternateRowCo lor />

"Patrick Steele" <pa*****@mvps.o rgwrote in message
news:MP******** *************** @msnews.microso ft.com...
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

<AlternateRowCo loring>true</AlternateRowCol oring>
<AlternateRowCo lor />
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
5686
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 now I use a DataGrid with 2 columns in it where the first one as the ReadOnly property property set to true.. it's quite ugly. if it's impossible then i'm open to any suggestions. :O)
1
11870
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 samples of how to use the PropertyGrid control and have gained a decent understanding of it. But of course, as it usually the case, my needs go far beyond the simple examples shown in online samples. All the online samples show how to take a class...
7
9707
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
1719
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 succeed. As far as I know I can only show the user the property name I use in my class, like "cubic_inches". I would like the user to see something like "Cylinder cubic inches". Is it in any way possible to associate a text to the name of the...
5
2994
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 file dialog appears where he can choose the image he likes. The question is How can I get the path of the image from the propertygrid or the open dialog.
0
1525
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 expand the property) and allow those values to be edited. My code is below. The grid is showing the values but they are read-only, although the other properties for the rest of my class are editable. Public Class MeshConverter
6
6931
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
3299
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; fPersonSurName : String; fPersonAge : Integer; published property PersonName : String read fPersonName write fPersonName;
4
5446
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 next Thank you Public class frmColor Dim xColors As New myColors
0
8814
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8706
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8475
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8591
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7304
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4149
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2709
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 we have to send another system
1
1915
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1592
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.