2
I would like to know how to resize images in c#. I will receive images in both JPG, JPEG, GIF and PNG.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace formCalcularIdade
{
public partial class Form1 : Form
{
private int _anoAtual;
private int _anoNasc;
private int _idade;
public Form1()
{
InitializeComponent();
}
private void Limpar(object sender, EventArgs e)
{
txtAnoAtual.Clear();
txtDateNasc.Clear();
}
private void Calcular(object sender, EventArgs e)
{
this._anoAtual = Convert.ToInt32(txtAnoAtual.Text);
this._anoNasc = Convert.ToInt32(txtDateNasc.Text);
this._idade = _anoAtual - _anoNasc;
txtDateIdade.Text = Convert.ToString(this._idade);
}
private void uploadFoto(object sender, EventArgs e)
{
OpenFileDialog dataImage = new OpenFileDialog();
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)
{
}
}
}