This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

Bitmap location inside of the BitmapViewer

Hi,
I'would need to know the exact location of the top-left corner of the bitmap loaded inside of the BitmapViewer.

If the bitbamp is bigger than BitmapViewer, I can easily use the ScrollPosition property, but how can I do if the bitmap is smaller than BitmapViewer?

Pls see attached a screenshot for reference (the yellow part is the BitmapViewer background)

Thanks!

Attachments

Hello, edodad!

You should use function workspaceToControlPoint to calculate top-left coordinate of image in BitmapViewer.

You may try the following JavaScript code:

function get_coordinates() {
	var bv = $find("BitmapViewer1");
	var pt = new GraphicsMill.PointF(0,0);
	var pt1 = bv.workspaceToControlPoint(pt);
	alert(pt1.x + " " + pt1.y);
}


Fell free to contact us if you have some problems with it.
Hi Sergey,
first of all, thanks a lot for your help!

Forgot to mention that I'm using the WIN library (not the WEB one)...
Just to make sure, could you please provide me with the .NET piece of code?

Thanks again
edodad
Hello,

And for WinForms BitmapViewer it will be something like that:

System.Drawing.Point pnt = _bv.WorkspaceToControl(
	new System.Drawing.Point(0, 0), 
	Aurigma.GraphicsMill.Unit.Pixel);

System.Windows.Forms.MessageBox.Show(pnt.ToString());