ok thx dan weiß ich nicht was ich falsch gemacht hab:
ich will nen kleines prog machen wo der butten einem wegspringt und hab den quelltext:
Delphi-Quellcode:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 =
class(TForm)
Button1: TButton;
Button2: TButton;
Label1: TLabel;
procedure Button1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
pos : integer;
implementation
{$R *.dfm}
procedure TForm1.Button1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
//1->2//
if pos = 1
then button1.Top := 120;
if pos = 1
then button1.Left := 8;
if pos = 1
then pos := 2;
if pos = 1
then exit;
//2->3//
if pos = 2
then button1.Top := 120;
if pos = 2
then button1.Left := 152;
if pos = 2
then pos := 3;
if pos = 2
then exit;
//3->4//
if pos = 3
then button1.Top := 137;
if pos = 3
then button1.Left := 152;
if pos = 3
then pos := 4;
if pos = 3
then exit;
//4->5//
if pos = 4
then button1.Top := 64;
if pos = 4
then button1.Left := 8;
if pos = 4
then pos := 5;
if pos = 4
then exit;
//5->1//
if pos = 5
then button1.Top := 176;
if pos = 5
then button1.Left := 8;
if pos = 5
then pos := 1;
if pos = 5
then exit;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
pos := 1;
end;
end.
aber sobalt ich über die buttenposition gehe springt die über alle positionenn und geht wieder runter