I would like to know how to resize images in C #. I will receive images in both JPG, JPEG, GIF and PNG.
usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;usingSystem.Windows.Forms;namespaceformCalcularIdade{publicpartialclassForm1:Form{privateint_anoAtual;privateint_anoNasc;privateint_idade;publicForm1(){InitializeComponent();}privatevoidLimpar(objectsender,EventArgse){txtAnoAtual.Clear();txtDateNasc.Clear();}privatevoidCalcular(objectsender,EventArgse){this._anoAtual=Convert.ToInt32(txtAnoAtual.Text);this._anoNasc=Convert.ToInt32(txtDateNasc.Text);this._idade=_anoAtual-_anoNasc;txtDateIdade.Text=Convert.ToString(this._idade);}privatevoiduploadFoto(objectsender,EventArgse){OpenFileDialogdataImage=newOpenFileDialog();dataImage.Filter="Image Files (*.bmp;*.jpg;*.jpeg,*.png)|*.BMP;*.JPG;*.JPEG;*.PNG";
if (dataImage.ShowDialog() == DialogResult.OK)
{
pictureBox1.ImageLocation = dataImage.FileName;
}
}
private void txtAnoAtual_TextChanged(object sender, EventArgs e)
{
}
private void textBox3_TextChanged(object sender, EventArgs e)
{
}
private void pictureBox1_Click(object sender, EventArgs e)
{
}
}
}