Alex Kayz
Alex Kayz

Reputation: 201

Moving a control at the bottom left of the screen at runtime

I made a Windows Forms application with C# and the Form size is 1200x800. There's a Picture Box called RivalCube which moves at runtime at the bottom left using the command RivalCube.Location = new Point(0, 677);. It works fine, but if you make the Application full screen and you start it it places the Picture Box somewhere in the middle of the screen because being Maximized makes it bigger so 0,677 is no longer the bottom left of the screen. So how do I make sure it stays at the bottom even if the application resizes? I'v tried anchoring it but it still does not work.

Thanks alot !

Upvotes: 0

Views: 201

Answers (1)

Alfie Goodacre
Alfie Goodacre

Reputation: 2793

On the resize event of the form add your code for the picture box's movement

Like this:

    private void Form1_Resize(object sender, EventArgs e)
    {
        RivalCube.Location = new Point(0, 677);
    }

Upvotes: 1

Related Questions