coordinates - WPF how to show an Image.Source (BitmapSource) pixel position? -


Let's say I've got an image that shows my source in a detailed way, how can I use a mouse event to show?

(I do not need to direct pixels to the coordinates of the image relative to its size)

thanks in advance / P>

You can find actual pixel height and width from ImageSource.

ImageSource imageSource = image.Source; Bitmap image bitmap image = (bitmap image) imageSource;

Now since you got the image displayed in the image control. You can easily map the position of the mouse on the pixel scale.

  PixelMosposePx = E. GetPhin (Image) X * bitmap image Pixelwidth / image Wide; PixelMousePositionY = E. GetPosition (Image). Y * bitmapImage.PixelHeight / image.Height;  

Have fun


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -