Multiple colors in a C# .NET label

后端 未结 11 1716
無奈伤痛
無奈伤痛 2020-11-27 03:54

I\'m looking for a way to display multiple colors in a single C#/.NET label. E.g the label is displaying a series of csv separated values that each take on a color dependin

11条回答
  •  生来不讨喜
    2020-11-27 04:16

    If you are building your Windows app for people with XP and up, you can use WPF. Even if it's a Windows Forms app, you can add a WPF UserControl.

    I would then use a Label, and set the "Foreground" property to be a gradient of colors.

    Or, in Windows Forms (no WPF), you could just use a "Flow Panel", and then in a for loop add multiple Labels as segments of your sentense... they will all "flow" together as if it was one label.

提交回复
热议问题