Reputation: 1
while trying to change button color or border color on click with code below:
private void LoggerStart_Click(object sender, EventArgs e)
{
if (LoggerStart.Text == "Start")
{
//?
LoggerStart.Text = "Stop";
LoggerStart.IdleBorderColor = Color.Red;
}
else
{
LoggerStart.Text = "Start";
}
}
the color changes for a short time, and returns to it's default color instantly!.
I expected to get the new color but it gets back to default shortly!
Upvotes: 0
Views: 63
Reputation: 1
I used LoggerStart.Idlefillcolor and it solved my problem.
Upvotes: 0
Reputation: 101
Try to use other comparsion, ex. based on buttons color/border color
private void button1_Click(object sender, EventArgs e)
{
if (button1.ForeColor != Color.Green)
{
button1.ForeColor = Color.Green;
button1.Text = "stop";
}
else
{
button1.ForeColor = Color.Red;
button1.Text = "start";
}
}
Upvotes: 0