C# Brush to string

前端 未结 3 1939
礼貌的吻别
礼貌的吻别 2020-12-07 04:28

I search a way to save the color of a brush as a string. For example I have a Brush which has the color red. Now I want to write \"red\" in a textbox.

Thanks for any

3条回答
  •  广开言路
    2020-12-07 04:50

    What type of brush is this? If its drawing namespace, then brush is an abstract class.! For SolidBrush, do:

    brush.Color.ToString()

    Otherwise, get the color property and use ToString() method to convert color to its string representation.

提交回复
热议问题