Click here to Skip to main content
15,887,683 members
Home / Discussions / C#
   

C#

 
AnswerRe: custom control problem in design time Pin
Gonzalo Cao26-Sep-10 22:36
Gonzalo Cao26-Sep-10 22:36 
GeneralRe: custom control problem in design time Pin
reza assar28-Sep-10 22:59
reza assar28-Sep-10 22:59 
QuestionLinkedIn using C# Pin
Jassim Rahma24-Sep-10 13:31
Jassim Rahma24-Sep-10 13:31 
AnswerRe: LinkedIn using C# Pin
Mycroft Holmes24-Sep-10 15:35
professionalMycroft Holmes24-Sep-10 15:35 
QuestionWebService not returning Color Pin
Luc Pattyn24-Sep-10 10:26
sitebuilderLuc Pattyn24-Sep-10 10:26 
AnswerRe: WebService not returning Color Pin
PIEBALDconsult24-Sep-10 12:19
mvePIEBALDconsult24-Sep-10 12:19 
GeneralRe: WebService not returning Color [modified] Pin
Luc Pattyn24-Sep-10 12:32
sitebuilderLuc Pattyn24-Sep-10 12:32 
GeneralRe: WebService not returning Color Pin
PIEBALDconsult24-Sep-10 13:28
mvePIEBALDconsult24-Sep-10 13:28 
You needs codez? Sounds Urgentz. Confused | :confused:


Just for the heck of it, I was just playing around with a Color wrapper class, with decent results.

[System.SerializableAttribute()]
public class Color : System.Xml.Serialization.IXmlSerializable
{
    private static readonly System.Text.RegularExpressions.Regex reg ;

    static Color
    (
    )
    {
        reg = new System.Text.RegularExpressions.Regex
        (
            @"^\#(?'Digits'[0-F]{8})$"
        ,
            System.Text.RegularExpressions.RegexOptions.IgnoreCase
        ) ;

        return ;
    }

    public System.Drawing.Color color { get ; set ; }

    public System.Xml.Schema.XmlSchema
    GetSchema
    (
    )
    {
        return ( null ) ;
    }

    public void
    WriteXml
    (
        System.Xml.XmlWriter Writer
    )
    {
        Writer.WriteString ( "#" + this.color.ToArgb().ToString ( "X8" ) ) ;

        return ;
    }

    public void
    ReadXml
    (
        System.Xml.XmlReader Reader
    )
    {
        System.Text.RegularExpressions.MatchCollection mat =
            reg.Matches ( Reader.ReadString() ) ;

        if ( mat.Count == 1 )
        {
            int i ;

            if
            (
                System.Int32.TryParse
                (
                    mat [ 0 ].Groups [ "Digits" ].Value
                ,
                    System.Globalization.NumberStyles.HexNumber
                ,
                    null
                ,
                    out i
                )
            )
            {
                this.color = System.Drawing.Color.FromArgb ( i ) ;
            }
        }

        return ;
    }
}


I'm think of adding implicit conversions to it (and making the field private).


I probably won't be able to respond again until tomorrow afternoon (UTC -7:00).
GeneralRe: WebService not returning Color Pin
Luc Pattyn24-Sep-10 14:27
sitebuilderLuc Pattyn24-Sep-10 14:27 
GeneralRe: WebService not returning Color Pin
PIEBALDconsult24-Sep-10 22:07
mvePIEBALDconsult24-Sep-10 22:07 
GeneralRe: WebService not returning Color Pin
Luc Pattyn25-Sep-10 4:55
sitebuilderLuc Pattyn25-Sep-10 4:55 
GeneralRe: WebService not returning Color Pin
Keith Barrow25-Sep-10 1:34
professionalKeith Barrow25-Sep-10 1:34 
GeneralRe: WebService not returning Color [modified] Pin
PIEBALDconsult25-Sep-10 4:19
mvePIEBALDconsult25-Sep-10 4:19 
GeneralRe: WebService not returning Color Pin
Luc Pattyn25-Sep-10 4:49
sitebuilderLuc Pattyn25-Sep-10 4:49 
GeneralRe: WebService not returning Color Pin
PIEBALDconsult25-Sep-10 6:58
mvePIEBALDconsult25-Sep-10 6:58 
GeneralRe: WebService not returning Color Pin
Luc Pattyn25-Sep-10 7:39
sitebuilderLuc Pattyn25-Sep-10 7:39 
GeneralRe: WebService not returning Color Pin
PIEBALDconsult25-Sep-10 9:18
mvePIEBALDconsult25-Sep-10 9:18 
GeneralRe: WebService not returning Color Pin
Luc Pattyn25-Sep-10 9:34
sitebuilderLuc Pattyn25-Sep-10 9:34 
GeneralRe: WebService not returning Color Pin
PIEBALDconsult25-Sep-10 9:52
mvePIEBALDconsult25-Sep-10 9:52 
GeneralRe: WebService not returning Color Pin
Luc Pattyn25-Sep-10 9:54
sitebuilderLuc Pattyn25-Sep-10 9:54 
GeneralRe: WebService not returning Color Pin
PIEBALDconsult25-Sep-10 12:46
mvePIEBALDconsult25-Sep-10 12:46 
GeneralRe: WebService not returning Color Pin
Luc Pattyn25-Sep-10 13:03
sitebuilderLuc Pattyn25-Sep-10 13:03 
GeneralRe: WebService not returning Color Pin
PIEBALDconsult25-Sep-10 13:53
mvePIEBALDconsult25-Sep-10 13:53 
GeneralRe: WebService not returning Color Pin
Keith Barrow25-Sep-10 12:08
professionalKeith Barrow25-Sep-10 12:08 
GeneralRe: WebService not returning Color Pin
Luc Pattyn25-Sep-10 12:51
sitebuilderLuc Pattyn25-Sep-10 12:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.