c#picturebox控件改变sizemode哪个都没有效果!!!求大神看下 5
publicpartialclassForm1:Form{publicForm1(){InitializeComponent();}ImagemyImage;privat...
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Image myImage;
private void btnshow_Click(object sender, EventArgs e)
{
openFileDialog1.Filter = "*.jpg,*.jpeg,*.bmp,*.gif,*.ico,*.png,*.tif,*.wmf|*.jpg;*.jepg;*.bmp;*.gif;*.ico;*.png;*.tif;*.wmf";
openFileDialog1.ShowDialog();
myImage = System.Drawing.Image.FromFile(openFileDialog1.FileName);
pictureBox1.Image = myImage;
pictureBox1.Height = myImage.Height;
pictureBox1.Width = myImage.Width;
}
private void btnsf_Click(object sender, EventArgs e)
{
pictureBox1.Height=Convert.ToInt32(myImage.Height*Convert.ToSingle(textsf.Text.Trim()));
pictureBox1.Width = Convert.ToInt32(myImage.Width * Convert.ToSingle(textsf.Text.Trim()));
}
说明下改sizemode不管用,backgo...这个也不关用!!!! 展开
{
public Form1()
{
InitializeComponent();
}
Image myImage;
private void btnshow_Click(object sender, EventArgs e)
{
openFileDialog1.Filter = "*.jpg,*.jpeg,*.bmp,*.gif,*.ico,*.png,*.tif,*.wmf|*.jpg;*.jepg;*.bmp;*.gif;*.ico;*.png;*.tif;*.wmf";
openFileDialog1.ShowDialog();
myImage = System.Drawing.Image.FromFile(openFileDialog1.FileName);
pictureBox1.Image = myImage;
pictureBox1.Height = myImage.Height;
pictureBox1.Width = myImage.Width;
}
private void btnsf_Click(object sender, EventArgs e)
{
pictureBox1.Height=Convert.ToInt32(myImage.Height*Convert.ToSingle(textsf.Text.Trim()));
pictureBox1.Width = Convert.ToInt32(myImage.Width * Convert.ToSingle(textsf.Text.Trim()));
}
说明下改sizemode不管用,backgo...这个也不关用!!!! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询