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,

Recommended Answers

All 3 Replies

A PictureBox will always be inside a Form, so I guess you first have to look how to maximize a Form. The Screen class might help.

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.

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()
            // 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
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.