我的窗口中有一个主窗口。其它为子窗口。可是当子窗口移动到某些地方时主窗口的下凹部分就出现了滚动条,那样太难看呀。
  我想要么就让子窗口不能移动或是限制子窗口移动范围使得主窗口不要出现滚动条,可惜我做不到!
  兄弟们来看看吧,最好是用第二种方法。

解决方案 »

  1.   

    把BorderStyle设置为bsSingle就行了
      

  2.   

    利用下面两个消息,完全搞掂:
    WM_MOVING
    WM_SIZING
    前者控制鼠标按住窗口标题栏时窗口整体的移动,
    后者控制鼠标拖动窗口边框时的窗口尺寸的改变。
      

  3.   

    wm_moving
    wm_sizing
    具体点?参数?
      

  4.   

    我知道原理,但没条件调试。
    希望对你有帮助!
    windows.ClipCursor(rect);
      

  5.   

    好像假如一句话就可以了,inherited;
      

  6.   

    禁止窗体移动    
        
    typeTForm1 = class(TForm)privateprocedure wmnchittest(var msg:twmnchittest); message wm_nchittest;{ Private declarations }public{ Public declarations }end;varForm1: TForm1;implementation{$R *.DFM}procedure TForm1.wmnchittest(var msg:twmnchittest);begininherited;if (htcaption = msg.result) then msg.result:=htclient;end; end.
     
     
      

  7.   

    窗口的Align设成alCustom,窗口不能移动
      

  8.   

    1)添加变量
    var
      Form1:TForm1;
      oleft:Integer;
      otop:Integer;
      owidth:Integer;
      ohight:Integer;
    2)保存窗体的原始大小和位置
      procedure TForm1.FormCreate(Sender:Tobject);
      begin
        oleft:=Left;
        otop:=Top;
        owidth:=Width;
        oheigth:=Height;
      end;
    4)添加处理WM_WINDOWPOSCHANGING过程
      type
        TForm1=class(TForm)
          Lable1:TLable;
       procedure windowsposchange(var Msg:TWMWINDOWPOSCHANGING);
        message WM_WINDOWPOSCHANGING;
          procedure FormCreate(Sender:Tobject);
                      .
                      .
                      .
    其具体 定义如下:
        procedure TForm1.windowsposchange(var Msg:TWMWINDOWPOSCHANGING);
        begin
          Msg.WindowPos.x:=oleft;
          Msg.WindowPos.y:=otop;
          Msg.WindowPos.cx:=owidth;
          Msg.WindowPos.cy:=oheight;
          inherited;
        end;
        ....
      

  9.   

    procedure WMNCHitTest(var Msg:TMessage);message WM_NCHITTEST;
    procedure TFormMain.WMNCHitTest(var Msg:TMessage);
    begin
      if FMoveable then
        inherited
      else
        Msg.Result:=1;
    end;
      

  10.   

    to tonylk(tony) 你的方法不成功。