怎样可以使MID子窗体在主窗体中可以移动,但是又不会移动到主窗体客户区边界以外,即当MID子窗体移动到主窗体客户区边界以外后主窗体会出现滚动条,现在就是不想让主窗体出现滚动条.不知道我描述的问题大家是否遇到 如果有高手已经解决这个问题请告诉我,问题解决后立刻给分!谢谢
解决方案 »
- 如何获取dbgrid最后一行,在线等!
- qq界面怎样编写?
- 为什么在BDE中DBF文件显示正确,在ADO中显示不正确?
- 为什么我在clientdataset的ApplyUpdates(0)的时候SQLSERVER总是报这样的错误?SQL Server Error:Cannot create new transaction because
- 在delphi中,如何备份数据,倒入数据.
- 关于摄像头图像采集的一些问题求援助!
- 高分求助我要做一个简单的个人信息管理程序,类似与window的通讯录,但通讯录的存储格式很特别,那位高手能给详细解释一下或提供一些质料
- 控制 QuickReport 的换页
- 请问带复选框的树形列表怎么实现啊?!
- 如何得到aspack2.12的注册版软件(免费的呀!)?
- 在TTreeView中,怎样取得选中节点的根节点。
- 关于报表 100分! 高难度,有人找到方法再给分
的勾去掉就可以了
SetWindowLong(Application.Handle, GWL_STYLE, GetWindowLong(Application.handle, GWL_STYLE) and not (WS_HSCROLL or WS_VSCROLL));
unit Child1;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons, ExtCtrls;type
TfrmChild1 = class(TForm)
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
procedure WMMOVE(var Message:TMessage);message WM_MOVE;
public
{ Public declarations }
end;var
frmChild1: TfrmChild1;implementation{$R *.DFM}procedure TfrmChild1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action:=caFree;
end;procedure TfrmChild1.FormCreate(Sender: TObject);
begin
frmChild1.DoubleBuffered:=true;
end;procedure TfrmChild1.WMMOVE(var Message:TMessage);
var Accept:boolean;
begin
if Message.Msg=WM_MOVE then
begin
if frmChild1.Left+frmChild1.Width>frmMain.Width then
begin
frmChild1.Left:=frmMain.Width-frmChild1.Width ;
Accept:=true;
end
else if frmChild1.Left<0 then
begin
Accept:=true;
frmChild1.Left:=0;
end;
if frmChild1.Top+frmChild1.Height>frmMain.Height then
begin
Accept:=true; frmChild1.Top:=frmMain.Height-frmChild1.Height;
end
else if frmChild1.Top<0 then
begin
Accept:=true;
frmChild1.Top:=0;
end;
if not Accept then
inherited;
end
end;
end.
我创建MIDCHILD的代码是
frmChild1:=tfrmChild1.Create(Application);
frmChild1.Show;
不知道是不是这里错了.
unit Unit2;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;type
TForm2 = class(TForm)
private
{ Private declarations }
procedure FUpdateOnMOve(var Msg: TMsg); message WM_MOVE;//??????
public
{ Public declarations }
end;var
Form2: TForm2;implementation{$R *.dfm}procedure Tform2.FUpdateOnMOve(var Msg: TMsg); //
begin
IF WINDOWSTATE<>wsMaximized THEN
BEGIN
IF Left<=0 THEN
LEFT:=0;
IF TOP<=0 THEN
TOP:=0;
IF (Left +WIDTH)>=APPLICATION.MainForm.ClientWidth-4 THEN
Left:=APPLICATION.MainForm.ClientWidth-4-WIDTH;
IF (TOP +HEIGHT)>=APPLICATION.MainForm.ClientHEIGHT-4 THEN
TOP:=APPLICATION.MainForm.ClientHEIGHT-4-HEIGHT;
END;
end;end.
这样可以解决最大化和正常情况下的移动问题,但是最小化后因为没有LEFT 和TOP 我不知道应该怎么去判断. 还有问下各位高手 TMESSAGE 和TMSG 这两个在使用消息的时候怎么区分,什么时候该用TMESSAGE 什么时候该用TMSG?