I have PictureBox
and I set its BorderStyle
to None
but I'm still getting a border around it. How can I get rid of that?
What more details? My Image doesn't have borders itself. I use the 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 the image:
Image is 10x10. They are below (at 800%)
original:
http://img695.imageshack.us/img695/2409/originallu.png
and how it is displayed:
http://img209.imageshack.us/img209/7088/displayed.png
What should be done is:
private void Form1_Load(object sender, EventArgs e)
{
picture.BorderStyle = BorderStyle.None;
}
I don't understand why it doesn't work when I set it to None
from Form Designer. Anyone knows?
Check Padding
property of your PictureBox
Set it 0
pictureBox1.Padding = new Padding(0);
精彩评论