End Google Ads 201810 - BS.net 01 --> I have a program which has a control that gets live web cam video feed and plays it on a rectangle in the main form. I have the following code for the control "Mouse_Click" event:

private void videoSourcePlayer_MouseClick(object sender, MouseEventArgs e)
{
txtMouseX.Text = e.X.ToString();
txtMouseY.Text = e.Y.ToString();
}


i need to convert the e.X and e.Y to integer format, and use those values in the getPixel function of the bitmap image taken from the video source player in the following code:


private void videoSourcePlayer_NewFrame( object sender, ref Bitmap image )
{


bool showOnlyObjects = onlyObjectsCheck.Checked;

Bitmap objectsImage = null;



objectsImage = image;
colorFilter.ApplyInPlace( image );


// lock image for further processing
BitmapData objectsData = objectsImage.LockBits( new Rectangle( 0, 0, image.Width, image.Height ),
ImageLockMode.ReadOnly, image.PixelFormat );

// grayscaling
UnmanagedImage grayImage = grayscaleFilter.Apply( new UnmanagedImage( objectsData ) );

// unlock image
objectsImage.UnlockBits( objectsData );

// locate blobs
blobCounter.ProcessImage( grayImage );
Rectangle[] rects = blobCounter.GetObjectRectangles( );

if ( rects.Length > 0 )
{


Rectangle objectRect = rects[0];

Graphics g = Graphics.FromImage( image );

using ( Pen pen = new Pen( Color.FromArgb( 160, 255, 160 ), 3 ) )
{
//draw something here
}

g.Dispose( );


}
}



how do i get the mouse x and y coordinate values from the first function into the second function so i can use the "image.getPixel()" call?