【发布时间】:2014-02-10 19:24:01
【问题描述】:
当用户选择他想要的颜色时,我想更改标签的边框颜色。我知道标签的绘制事件可以改变边框颜色。我只想要这段代码:
private void label1_Paint(object sender, PaintEventArgs e)
{
ControlPaint.DrawBorder(e.Graphics, label1.DisplayRectangle, Color.Blue, ButtonBorderStyle.Solid);
}
继续工作:
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboBox1.SelectedIndex == 0)
{
//apply red color
}
}
要应用的组合框的选定索引(用户想要的颜色)。我只是不知道该怎么做。
【问题讨论】:
-
我已经编辑了你的标题。请参阅“Should questions include “tags” in their titles?”,其中的共识是“不,他们不应该”。
-
感谢编辑。 :)
标签: c# event-handling