xuantruongbn
Gà con
Show nhiều hình ảnh lên sao mình debug mà vẫn không tìm đc để resize image cho nó to hơn đc vậy ae mong ae chỉ giáo:
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog ofd=new OpenFileDialog ();
ofd.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp)|*.jpg; *.jpeg; *.gif; *.bmp";
ofd.Multiselect= true;
DialogResult dr = ofd.ShowDialog();
if (dr == DialogResult.OK)
{
string[] fies=ofd.FileNames;
int x = 40;
int y=80;
int maxHeight = 5;
foreach(string img in fies)
{
PictureBox pic = new PictureBox();
pic.Image=Image.FromFile(img);
pic.Location=new Point(x, y);
x += pic.Width + 0;
maxHeight=Math.Max(pic.Height, maxHeight);
if (x > this.ClientSize.Width - 100)
{
x = 200;
y += maxHeight ;
}
this.panel1.Controls.Add(pic);
pic.SizeMode = PictureBoxSizeMode.Zoom;
}
}
}
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog ofd=new OpenFileDialog ();
ofd.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp)|*.jpg; *.jpeg; *.gif; *.bmp";
ofd.Multiselect= true;
DialogResult dr = ofd.ShowDialog();
if (dr == DialogResult.OK)
{
string[] fies=ofd.FileNames;
int x = 40;
int y=80;
int maxHeight = 5;
foreach(string img in fies)
{
PictureBox pic = new PictureBox();
pic.Image=Image.FromFile(img);
pic.Location=new Point(x, y);
x += pic.Width + 0;
maxHeight=Math.Max(pic.Height, maxHeight);
if (x > this.ClientSize.Width - 100)
{
x = 200;
y += maxHeight ;
}
this.panel1.Controls.Add(pic);
pic.SizeMode = PictureBoxSizeMode.Zoom;
}
}
}