发信人: mengy (LEAR DLLS 命令时,将从内存中清除), 信区: BorlandDev
标 题: delphi中控制窗体
发信站: 哈工大紫丁香 (2001年03月13日18:04:32 星期二), 转信
控制窗体 <<上一篇 >>下一篇
如何在 Delphi 中把 Form 控制成不能放大/缩小/移动/关闭?
1、把 Form 的 BorderIcons 下的几个子属性值全改为 False;
2、修改 Form 的 BorderStyle 的值为bsSingle ;
3、为了让窗口不能移动,可以自已拦下 WM_NCHITTEST 消息, 对该消息的处理为:
一概回应鼠标点在窗口的 Client 区域, 相信这个视窗就呆呆的不会动了。
详情可以查一下 Win32API Help 的 CreateWindow() 与 WM_NCHITTEST 的说
明。
下面是一个例子, 请参考看看:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls,Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
procedure WMNCHitTest(var Msg: TMessage); message WM_NCHITTEST;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
Close; // 不可少, 因为已经没有其他方法能关闭此窗口了
end;
procedure TForm1.WMNCHitTest(var Msg: TMessage);
begin
inherited; // 这样,移动就不可能了...
Msg.Result := HTCLIENT;
end;
end.
如果你有什么好的资料,可以寄给我哟:) <<回到首页 <<上一篇 >>下一篇
------------------------------------------------------------------------
--------
Delphi 技巧集
Copyright 1999.11 by 东子 Mail to me!
感谢广州视窗提供主页空间
--
大海无边天做岸
山登绝顶我为风
※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: 202.118.227.121]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:3.671毫秒