procedure TForm1.SpeedButton2Click(Sender: TObject); begin
sendmessage(form1.WindowHandle,WM_SYSCOMMAND,SC_ICON,);//窗体最小化 任务栏中
end; procedure TForm1.SpeedButton2Click(Sender: TObject); begin
form1.WindowState := wsMaximized;//窗体最大化
end; procedure TForm1.SpeedButton2Click(Sender: TObject); begin
form1.WindowState := wsminimized;//窗体最小化到 任务栏上方 end; procedure TForm1.SpeedButton2Click(Sender: TObject); begin
form1.WindowState := wsnormal;//窗体正常化
end;
---------------------
作者:ozhy111
来源:CSDN
原文:https://blog.csdn.net/ozhy111/article/details/86062553
版权声明:本文为博主原创文章,转载请附上博文链接!
自定义
Uses ShellAPI; 、//最小化
procedure TForm1.btn1Click(Sender: TObject);
var
I, J, X, Y: Word;
begin
//第一种:最小化在屏幕的左下角 ,不是常见的最小化
// WindowState := wsMinimized;
//第儿种:最小化在任务栏里面 ,是常见的最小化
postmessage(Self.Handle,WM_SYSCOMMAND,SC_MINIMIZE,);
end; 、//最大化/正常的按钮
procedure TForm1.btn2Click(Sender: TObject);
var
abd: TAppBarData;
begin
if WindowState = wsMaximized then
WindowState := wsNormal
else
begin
WindowState := wsMaximized; // BorderStyle为 bsNone
abd.cbSize := sizeof(abd);
SHAppBarMessage(ABM_GETTASKBARPOS, abd); //读取任务的区域
Self.Height := Self.Height - (abd.rc.Bottom - abd.rc.Top); //预留出任务的位置
end;
end; 、//关闭
procedure TForm1.btn3Click(Sender: TObject);
begin
Close;
end; 、//窗体的移动 procedure TForm1.lbl1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button=Mbleft then
begin
ReleaseCapture;
Perform(WM_NCLBUTTONDOWN,HTCAPTION,);//消息处理
end;
end; 、//查找应用程序中已经创建的窗体 function FindForm(FormName: string): TForm;
var
i:Integer;
begin
Result := nil;
for i:= to Application.ComponentCount- do
begin
if Application.Components[i].Name = FormName then
begin
Result := TForm(Application.Components[i]);
Break;
end;
end;
end;
---------------------
作者:爱在丽江leslex
来源:CSDN
原文:https://blog.csdn.net/xiongmao000738/article/details/6790153
版权声明:本文为博主原创文章,转载请附上博文链接!