我自己解决了!
var
mouse_down,first_draw:Boolean;
x_mouse,y_mouse:Integer;
p_old:TPoint ;
procedure Tfrmmain.brMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
p:TPoint;
begin
GetCursorPos(p);
mouse_down:=True;
first_draw:=True ;
x_mouse:=p.x;
y_mouse:=p.y;
p_old:=p ;
SetCursor(LoadCursor(0, IDC_SIZENWSE));
end;
procedure Tfrmmain.brMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var
p:TPoint;
desktop:TCanvas ;
rect:TRect ;
rect_old:TRect;
begin
SetCursor(LoadCursor(0, IDC_SIZENWSE));
if mouse_down then begin
GetCursorPos(p);
desktop:=windowsDesktopCanvas;
with desktop do begin
Pen.Width:=1;
Pen.Style:=psSolid ;
if not first_draw then begin
rect_old.Left:=left;
rect_old.Top:=top;
rect_old.Right:=p_old.X ;
rect_old.Bottom:=p_old.y;
DrawFocusRect(rect_old );
end;
rect.Left:=left;
rect.Top:=top;
rect.Right:=p.X ;
rect.Bottom:=p.y;
DrawFocusRect(rect );
first_draw :=False ;
TBToolbar1.Refresh ;
F_List.Refresh ;
end;
desktop.Free ;
p_old:=p;
end;
end;
procedure Tfrmmain.brMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Width:=Width+(p_old.x-x_mouse);
Height:=Height+(p_old.Y-y_mouse );
Refresh;
mouse_down:=False ;
SetCursor(LoadCursor(0, IDC_ARROW ));
end;