C#学习之开关控件picturebox

/*LED灯控制按钮(图片)*/
private void pictureBox2_Click(object sender, EventArgs e)
{
    if (LedFlage == false)
    {
        LedFlage = true;
        pictureBox2.BackgroundImage = Properties.Resources.switchon;
        pictureBox3.BackgroundImage = Properties.Resources.ledon;
    }
    else
    {
        LedFlage = false;
        pictureBox2.BackgroundImage = Properties.Resources.switchoff;
        pictureBox3.BackgroundImage = Properties.Resources.ledoff;
    }
}     

你可能感兴趣的:(C#)