I want to use the rulerbox like in Photoshop, that means Image centered. To adjust the zero-Point I do it like this:
HorizRuler.ViewPos := -ImageEnView1.OffsetX;
VertRuler.ViewPos := -ImageEnView1.OffsetY;
The MousemoveEvent I have adjusted like this:
procedure TForm1.ImageEnView1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
if Lockgripstointegervalue1.Checked then
begin
HorizRuler.GripsPos[0] := trunc(ImageEnView1.XScr2Bmp(X) / m_dpi) - ImageEnView1.OffsetX;
VertRuler.GripsPos[0] := trunc(ImageEnView1.YScr2Bmp(Y) / m_dpi) - ImageEnView1.Offsety;
end
else
begin
HorizRuler.GripsPos[0] := ((ImageEnView1.ViewX - HorizRuler.OffsetX + X) / HorizRuler.DotPerUnit) - ImageEnView1.OffsetX;
VertRuler.GripsPos[0] := ((ImageEnView1.ViewY - VertRuler.OffsetY + Y) / VertRuler.DotPerUnit) - ImageEnView1.Offsety;
end;
end;
All works fine:
But it works not, when the Image is zoomed. What can I do here, to adjust the postion of the mouse-grip and the start of the zero-point?
And an other point: when the Image is zoomed, I want that the rulerbox is zoomed also (and not with a new numbering, see screenshot):
By the way: In an later update it would be fine, if one could link the Horizontal and vertical rulerbox to the ImagenEnview via the object-inspector and all this work what now has to be done by the developer would be into the "intelligent" rulerbox.
HS