Page view counter
How to get backcolor of textbox in Hex value?
Last post 08-22-2008 1:22 AM by microsoft_kc. 1 replies.
Sort Posts:
08-22-2008 12:48 AM
How to get backcolor of textbox in Hex value?

Hello all,

How can i get background color of a textbox in hexvalue. The background property of textbox is a a brush type. I cant find a color property in it. i need to save backcolor of textbox and restore it when the user logs in next time. How can i do this.

 I need help over it.

 Thanks in advance

Vijesh

VijeshMV

Loading...
Joined on 07-08-2008
Posts 16
08-22-2008 1:22 AM
Marked as Answer
Re: How to get backcolor of textbox in Hex value?

Use the following method to convert any color object to HEX value:  

        /// <summary>
        /// This method will convert SolidColorBrush object to a string color
        /// </summary>
        /// <param name="color"><code>SolidColorBrush</code> object</param>
        /// <returns>Hex value as a string i.e. <example>"#FF838383"</example></returns>
        public static string ColorToString(SolidColorBrush color)
        {
            return "#" + color.Color.A.ToString() + color.Color.R.ToString() + color.Color.G.ToString() + color.Color.B.ToString();
        }
 

(Please click on "Mark As Answer", if this has answered your query. Thanks)

Regards,
Kunal Chowdhury

microsoft_kc

Loading...
Joined on 03-27-2008
Pune, India
Posts 425
Microsoft Communities