0
I’m starting in the programming and I came up with a question. I’m trying to cut an image in half and show in two picture box the two cuts.
I’m making the cut like this.
private void Btn_Recortar_Click(object sender, EventArgs e)
{
Lobj_ImagemcortadaEsquerda = RecortarImagem(ImagemOriginalCopiada, 0, 0, 100, 60);
Lobj_ImagemCortadaDireita = RecortarImagem(ImagemOriginalCopiada, 0, 0, 200, 60);
pictureBox1.Image = Lobj_ImagemCortadaDireita;
pictureBox2.Image = Lobj_ImagemcortadaEsquerda;
pictureBox1.Image = Lobj_Imagemcortada2;
pictureBox2.Image = Lobj_Imagemcortada;
}
Cut-out method
public Bitmap RecortarImagem(Bitmap ImagemOriginal, int cropX, int cropY, int cropWidth, int cropHeight)
{
ImagemRecortada = true;
Rectangle rect = new Rectangle(cropX, cropY, cropWidth, cropHeight);
Bitmap cropped = ImagemOriginalCopiada.Clone(rect, ImagemOriginal.PixelFormat);
return cropped;
}
The idea is to have two images. In the first pictureBox:
and the second pictureBox: