procedure TForm1.SpeedButton2Click(Sender: TObject); begin sendmessage(form1.WindowHandle,WM_SYSCOMMAND,SC_ICON,0);//窗体最小化 任务栏中 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; 1、//最小化 procedure TForm1.btn1Click(Sender: TObject); var I, J, X, Y: Word; begin //第一种:最小化在屏幕的左下角 ,不是常见的最小化 // WindowState := wsMinimized; //第儿种:最小化在任务栏里面 ,是常见的最小化 postmessage(Self.Handle,WM_SYSCOMMAND,SC_MINIMIZE,0); end; 2、//最大化/正常的按钮 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; 3、//关闭 procedure TForm1.btn3Click(Sender: TObject); begin Close; end; 4、//窗体的移动 procedure TForm1.lbl1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin if Button=Mbleft then begin ReleaseCapture; Perform(WM_NCLBUTTONDOWN,HTCAPTION,0);//消息处理 end; end; 5、//查找应用程序中已经创建的窗体 function FindForm(FormName: string): TForm; var i:Integer; begin Result := nil; for i:=0 to Application.ComponentCount-1 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 版权声明:本文为博主原创文章,转载请附上博文链接!
原文地址:https://www.cnblogs.com/westsoft/p/10360403.html
时间: 2024-10-26 01:32:32