How can I get rid of the border with Picturebox?

I have PictureBox, and I set it BorderStyleto None, but I still get the border around it. How can I get rid of this?

What other details? My image has no borders. I am using code

    private void btnLoad_Click(object sender, EventArgs e)
    {

        if (dgOpenFile.ShowDialog() == DialogResult.OK)
        {
            try
            {
                img = new Bitmap(dgOpenFile.FileName);

                picture.Size = img.Size;
                picture.Image = img;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }

To open and display an image:

Image 10x10. They are lower (at 800%)

original:

http://img695.imageshack.us/img695/2409/originallu.png

and how it is displayed:

http://img209.imageshack.us/img209/7088/displayed.png

+3
source share
2 answers

What should be done:

    private void Form1_Load(object sender, EventArgs e)
    {
        picture.BorderStyle = BorderStyle.None;
    }

I do not understand why this does not work when I install it in Nonefrom Form Designer. Somebody knows?

+4
source

Check your PaddingpropertyPictureBox

0

pictureBox1.Padding = new Padding(0);
+3

Source: https://habr.com/ru/post/1785737/


All Articles