Torna al Thread
//:. Occurs when the mouse pointer is over the control and a mouse button is released
private void PictureBoxPreview_MouseUp(object sender, MouseEventArgs e)
{
this.PictureBoxPreview.Cursor = Cursors.Arrow;
if ( this.bFlagMouseDown )
{
this.bFlagMouseDown = false;
//Recupero il contesto grafico dall'immagine nella picture box
Graphics g = Graphics.FromImage( this.PictureBoxPreview.Image );
// Creazione pen (colore nero).
Pen blackPen = new Pen( Color.Black, 2 );
// Posizione e dimensione ellisse (cerchio)
int nDistanceBetweenPoints = (int)Math.Sqrt( (Math.Pow((this.StartX - this.EndX), 2) + Math.Pow((this.StartY - this.EndY), 2)) );
int width = 2 * nDistanceBetweenPoints;
int height = 2 * nDistanceBetweenPoints;
// Draw ellipse to screen.
g.DrawEllipse( blackPen, this.StartX, this.StartY, width, height );
}
}
//:. Occurs when the mouse pointer leaves the control
private void PictureBoxPreview_MouseLeave(object sender, EventArgs e)
{
label2.Text = sender.GetType().ToString() + ": MouseLeave";
this.bFlagMouseEnter = false;
}
}