こんにちは、
以下のようなプログラムを作成してみました。
スクロールボックスの中にペイントボックスをいれ、
BmpData にビットマップデータを入れています。
このビットマップデータをスクロールボックスの中で
マウスを使って移動させようとしているのですが、
移動中にビットマップがパッコンパッコン、してます。
スムーズに移動するにはどうすればよいのでしょうか?
procedure TFormBMPDebugViewer.PaintBoxMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
Moving := True;
MovePoint := Point(X, Y);
end;
procedure TFormBMPDebugViewer.PaintBoxMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
if Moving then begin
PaintBox.Left := PaintBox.Left + (X - MovePoint.X);
PaintBox.Top := PaintBox.Top + (Y - MovePoint.Y);
end;
end;
procedure TFormBMPDebugViewer.PaintBoxMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
Moving := False;
end;
procedure TFormBMPDebugViewer.PaintBoxPaint(Sender: TObject);
begin
PaintBox.Canvas.StretchDraw( Rect(0, 0, PaintBox.Width, PaintBox.Height), BmpData);
end;
移動元をTImageに移し変えてTImageを移動するのはどうですか?
たぶんビットマップはいい感じで移動できると思います。
私の知恵ではこれしか出ませんでした。とほー
ツイート | ![]() |