unit UMainForm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TFMainForm =
class(TForm)
bgTop: TImage;
bgBottom: TImage;
bgBorderLeft: TImage;
bgBorderRight: TImage;
bgIcon: TImage;
LCaption: TLabel;
bgMinimize: TImage;
bgExit: TImage;
procedure MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState;
X, Y: Integer);
procedure MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
procedure FormCreate(Sender: TObject);
procedure Minimize(Sender: TObject);
procedure Exit(Sender: TObject);
private
Point : TPoint;
Down : Boolean;
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
FMainForm: TFMainForm;
implementation
uses Types;
{$R *.dfm}
procedure TFMainForm.Exit(Sender: TObject);
begin
FMainForm.Close;
end;
procedure TFMainForm.FormCreate(Sender: TObject);
begin
FMainForm.DoubleBuffered:=True;
end;
procedure TFMainForm.Minimize(Sender: TObject);
begin
Application.Minimize;
end;
procedure TFMainForm.MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Point.X:=X;
Point.Y:=Y;
Down:=True;
end;
procedure TFMainForm.MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if Down = True
then
begin
FMainForm.Left:=Mouse.CursorPos.X - Point.X;
FMainForm.Top:=Mouse.CursorPos.Y - Point.Y;
end;
end;
procedure TFMainForm.MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Down:=False;
end;
end.