solo_k 发表于 2010-6-5 11:14:29

如何控制窗口的大小??

创建了一个可调整大小的窗口
我想让这个窗口的高度小于300时就不能再小了
宽度小于500时就不能再小了
请问哪位大虾知道如何解决???
我大概知道是用到 WM_SIZING消息
可不知道具体怎么用,在百度找了半天也没找到合适的

如能解决,非常感谢:face (36):

solo_k 发表于 2010-6-5 11:16:49

:face (37):
希望有高手能提供示范的代码

netegg 发表于 2010-6-5 13:27:07

应该是dock吧

solo_k 发表于 2010-6-5 13:52:29

dock是什么啊?不懂

netegg 发表于 2010-6-5 13:58:57

停靠呀,不指定左上角xy怎么控制大小

h141242 发表于 2010-6-5 14:37:52

dock是什么啊?不懂

Hen5ei 发表于 2010-6-5 14:45:17

我也不懂.....

solo_k 发表于 2010-6-5 16:00:50

我知道要指定大小,但是不知道如何指定
说白了,也就是 WM_SIZING   这个消息不知道怎么用
我在百度上找到一个Delphi的实例,实现的就是我所说的那个功能,但只看了个一知半解
所以希望高手能演示一段Au3实现这种功能的方法,先感谢啦!

unit Unit1; //Line 01
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TForm1 = class(TForm)
private
  { Private declarations }
  procedure PROC_WM_SIZING(var AMsg: TMessage); message WM_SIZING; //Line 12
public
  { Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.PROC_WM_SIZING(var AMsg: TMessage); //Line24
const
MinWidth = 400; //Line 26
var
ARect: ^TRect; //Line 28
begin
ARect := Ptr(AMsg.LParam);  //Line 30
ARect.Top := Top;       //Line 31
ARect.Bottom := Top + Height; //Line 32
if ARect.Right - ARect.Left < MinWidth then begin
  case AMsg.WParam of
   WMSZ_BOTTOMLEFT,
   WMSZ_LEFT,
   WMSZ_TOPLEFT:   ARect.Left := ARect.Right - MinWidth; //Line 37
   WMSZ_BOTTOMRIGHT,
   WMSZ_RIGHT,
   WMSZ_TOPRIGHT:  ARect.Right := ARect.Left + MinWidth; //Line 40
  else
  end;
end;
end; //Line 44
end. //Line 46

penny_shen 发表于 2010-6-5 16:07:39

不是可以用工具画的吗?

solo_k 发表于 2010-6-5 16:39:36

楼上的回复更不懂了
还是哪位大哥教教我 WM_SIZING 这个消息的参数咋用吧

solo_k 发表于 2010-6-6 10:54:39

没人解答呀
再顶一下

jhun 发表于 2010-6-7 23:38:30

不知道我明天记不记得来回复,我做过这个,代码在公司,如果明天记得我直接贴上来

C.L 发表于 2010-6-8 00:35:47

可调整窗口,最大无限制,最小是500*300
#include <GUIConstants.au3>
#include <WindowsConstants.au3>

GUICreate("Test",500,500,-1,-1,$WS_SIZEBOX)
GUISetState (@SW_SHOW)
GUIRegisterMsg(0x24, "MY_WM_Size")

While 1
    $msg = GUIGetMsg()
    If $msg =-3 Then ExitLoop
Wend
   
Func MY_WM_Size($hWnd, $Msg, $wParam, $lParam)
    $min = DllStructCreate("int;int;int;int;int;int;int;int;int;int",$lParam)
    DllStructSetData($min,7,500)
    DllStructSetData($min,8,300)
EndFunc

rtytext 发表于 2010-6-8 10:01:15

不错,学习一下{:face (356):}

waxy 发表于 2010-6-8 11:31:20

这个不错值得学习。
页: [1]
查看完整版本: 如何控制窗口的大小??