lundi 17 septembre 2018

c# else if { } expected? [on hold]

I'm trying to make it so when you start with screen height of 1080px the form background image will set to a 1920x1080px image but i keep getting:

{} expected!

private void Form_Load(object sender, EventArgs e)
{
    this.MaximizedBounds = Screen.FromHandle(this.Handle).WorkingArea;
    this.WindowState = FormWindowState.Maximized;

    if (Screen.PrimaryScreen.WorkingArea.Height == 1080) ;
    {
        this.BackgroundImage = Properties.Resources._1920x1080;
    }
    else if (Screen.PrimaryScreen.WorkingArea.Height == 1440) ;
    {
        this.BackgroundImage = Properties.Resources.bg;
    }
}

Whenever i add the ; after if (Screen.PrimaryScreen.WorkingArea.Height == 1080) it shows the above error.

Aucun commentaire:

Enregistrer un commentaire