0

How to stretch PictureBox into Maximized screen size ?
Currently the size of picturebox is exactly the size of the image, I want to stretch to the resolution screen size excluding taskbar.

private void Form2_Load(object sender, EventArgs e)
{
    Form2 f2 = new Form2();
    pictureBox1.Size = new System.Drawing.Size(Screen.PrimaryScreen.Bounds.Width,
                Screen.PrimaryScreen.Bounds.Height);
}

Edited by Khoo: Correction

2
Contributors
3
Replies
10
Views
3 Years
Discussion Span
Last Post by ddanbe
0

Thanks for your information. I'm using form as image, but my image tends to appear repeat twice in full screen. How can I make it stretch into full size.

0

This seems to work:
Made new forms app with button to exit.

using System;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            // These 3 lines will do the trick
            this.TopMost = true;
            this.FormBorderStyle = FormBorderStyle.None;
            this.WindowState = FormWindowState.Maximized;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Application.Exit();// I foresaw an escape
        }
    }
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.