Bonjour

J'ai un soucis de sélection d'1/2 pixel

Ce que je veux (cf photofiltre)



Ce que j'ai (cf logiciel):



Voici mon code de Capture :

Bitmap tempBitmap = new Bitmap(MaCapture.Width, MaCapture.Height, PixelFormat.Format32bppArgb);
tempBitmap.SetResolution(MaCapture.HorizontalResolution, MaCapture.VerticalResolution);

using (Graphics bmGraphics = Graphics.FromImage(tempBitmap))
{
bmGraphics.Clear(Color.Black);

bmGraphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
bmGraphics.DrawImage(MaCapture, new Rectangle(0, 0, pictureBox1.Width, pictureBox1.Height), new Rectangle(DeplacementX - 1, DeplacementY - 1, Convert.ToInt32(pictureBox1.Width / zoomFactor), Convert.ToInt32(pictureBox1.Height / zoomFactor)), GraphicsUnit.Pixel);

// Draw the bitmap on the picZoom picturebox
pictureBox1.BorderStyle = BorderStyle.Fixed3D;
// Dispose of the Graphics object
bmGraphics.Dispose();

pictureBox1.Image = tempBitmap;
}
Monde Code de Selection :


//Debut PointDepartX
if (this.MouseDown_X >= this.MouseHover_X) { TailleX = this.MouseDown_X - this.MouseHover_X; PositionX = this.MouseHover_X; }
else { TailleX = this.MouseHover_X - this.MouseDown_X; PositionX = this.MouseDown_X; }

if (this.MouseDown_Y >= this.MouseHover_Y) { TailleY = this.MouseDown_Y - this.MouseHover_Y; PositionY = this.MouseHover_Y; }
else { TailleY = this.MouseHover_Y - this.MouseDown_Y; PositionY = this.MouseDown_Y; }

MonRectangletmp = new Rectangle(PositionX + Convert.ToInt32(textBox3.Text), PositionY + Convert.ToInt32(textBox4.Text), TailleX, TailleY);
AffichageMonRectangleTmp = new Rectangle((int)((MonRectangletmp.X - Convert.ToInt32(textBox3.Text)) * zoomFactor), (int)((MonRectangletmp.Y - Convert.ToInt32(textBox4.Text)) * zoomFactor), (int)(MonRectangletmp.Width * zoomFactor), (int)(MonRectangletmp.Height * zoomFactor));

using (Pen pen = new Pen(Color.LimeGreen, 2))
{
e.Graphics.DrawRectangle(pen, AffichageMonRectangleTmp);
}
Ma sélection se trouve au Milieu des pixels et non aligné comme eux.
Je n'arrive pas à trouver l'erreur de ce soucis.

Je vous remercie d'avance.