Hi All!
I need to draw something on a form in a certain place, excluding the position of scrollbars. I can `t do it.
Look at the test case. Label "abs" moves with the scrolling, and returns to the coordinates 100,100 only when resizing. I need to stop it moving
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs;
type
{ TForm1 }
TForm1 = class(TForm)
procedure _onCreate(Sender: TObject);
procedure _onPaint(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1._onCreate(Sender: TObject);
begin
VertScrollBar.Range:=1000;
VertScrollBar.Tracking:=true;
HorzScrollBar.Range:=1000;
HorzScrollBar.Tracking:=true;
end;
procedure TForm1._onPaint(Sender: TObject);
var
arect:trect;
begin
//UpdateScrollbars;{uncomment this line - draw good, but other errors (app not close)}
ARect := GetClientRect;
canvas.TextRect(ARect,100+HorzScrollBar.Position,100+VertScrollBar.Position,'Abs');
end;
end.
How to do it?
win7, trunk lazarus, trunk fpc