interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls;
type
TEdge=(eNone,eTopLeft,eTopRight,eBottomLeft,eBottomRight);
TForm1 = class(TForm)
Panel1: TPanel;
procedure Panel1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Panel1Resize(Sender: TObject);
procedure Panel1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Private-Deklarationen }
r1,r2,r3,r4:TRect;
edge:TEdge;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Panel1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if ptinRect(r1,Point(x,y)) then edge:=eTopLeft else
if PtInRect(r3,Point(x,y)) then edge:=eBottomRight else
if ptinRect(r2,Point(x,y)) then edge:=eTopRight else
if PtInRect(r4,Point(x,y)) then edge:=eBottomLeft else
edge:=eNone;
case edge of
eNone:Panel1.Cursor:=crDefault;
eTopLeft,eBottomRight:Panel1.Cursor:=crSizeNWSE;
eTopRight,eBottomLeft: Panel1.Cursor:=crSizeNESW;
end;
end;
procedure TForm1.Panel1Resize(Sender: TObject);
begin
r1:=rect(0,0,5,5);
r3:=rect(panel1.width-5,panel1.height-5,panel1.width,panel1.height);
r2:=rect(r1.left,r3.top,r1.right,r3.bottom);
r4:=rect(r3.left,r1.top,r3.right,r1.bottom);
end;
procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if edge<>eNone then
begin
releaseCapture;
case edge of
eTopLeft:Panel1.PerForm(WM_SysCommand, $F004, 0);
eTopRight:Panel1.PerForm(WM_SysCommand, $F007, 0);
eBottomLeft:Panel1.PerForm(WM_SysCommand, $F005, 0);
eBottomRight:Panel1.PerForm(WM_SysCommand, $F008, 0);
end;
end;
end;
end.