Forum > General

Quesion about TATImageBox

<< < (2/3) > >>

stab:
Thanks a lot Alextp,

Now it works even though I don't quite understand your changes.
What I want to do is to be able to pick pixels from the image, but feel a little unsure where in the image I'm pointing when zoomed in.
Could you please explain that to me? %)

AlexTP:
That may be a useful feature-- some event or prop, so you can detect image pixel under the mouse. Will see it.

AlexTP:
Try to do this: (I didn't test yet)

- ATImageBox has the public prop Image: TImage
- in the MouseMove event, get X/Y params, and do conversion from screen coords, to Image related coords. Like

  P:= ATImageBox1.ClientToScreen(Point(X, Y));
  P:= ATImageBox1.Image.ScreenToClient(P);

now you have P. Image related coords. Read the zooming value (prop ImageZoom, in percents) and scale P.

stab:
Tried this:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TfrmExtractElevationCurves.ATImageBox1MouseMove(Sender: TObject;  Shift: TShiftState; X, Y: Integer);var  Button: TMouseButton;  P : TPoint;  xs, ys, z : single;begin  P := ATImageBox1.ClientToScreen(Point(X, Y));  P:= ATImageBox1.Image.ScreenToClient(P);  xs := P.X; ys := P.Y;  z := 0.01 * ATImageBox1.ImageZoom;  P.X := Round(xs / z);  P.Y := Round(ys / z);  StatusBar1.SimpleText := 'X: ' + IntToStr(x) + ' Y: ' + IntToStr(y) + ' ' +    'Zoom: ' + IntToStr(ATImageBox1.ImageZoom) + ' - ' +    'X: ' + IntToStr(P.X) + ' Y: ' + IntToStr(P.Y);end;  
But I didn't get it to work. It seems to be connected to drag coordinates in some way.  %)

AlexTP:
I fixed this, now X/Y must be right, I tested it on a small demo with resized picture. Updated in GH.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version