找回密码
 加入
搜索
查看: 6163|回复: 12

[GUI管理] 红色框起来的区域用什么控件来做?【已解决】

 火.. [复制链接]
发表于 2012-2-27 23:38:46 | 显示全部楼层 |阅读模式
本帖最后由 xms77 于 2012-2-29 21:52 编辑

我的想法是用GUICtrlCreateGraphic(10, 50, 700, 600)来做,但是控件的右边界不能随主窗体的大小变化而变化,不知道用什么方法来实现?

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2012-2-28 00:04:31 | 显示全部楼层
一个设置背景色和扩展样式 0x200 的Label不就行了,谁知道那个是干什么的
发表于 2012-2-28 00:08:04 | 显示全部楼层
GUICreate('')
GUICtrlCreateLabel('', 1, 20, 400, 358, -1, 0x200)
GuiCtrlSetBKColor(-1, 0x848285)
GUISetState()
While GUIGetMsg() <> -3
WEnd
 楼主| 发表于 2012-2-28 08:25:46 | 显示全部楼层
回复 2# afan
这个就好像是容器一样可以放窗体的,如图。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2012-2-28 09:13:58 | 显示全部楼层
回复 4# xms77


    这种AU3也可以吗?求实现
发表于 2012-2-28 10:48:55 | 显示全部楼层
回复 4# xms77


    那是一个父窗口的背景。。。 窗体设置为父窗口的时候, 然后再新建一个子窗体,那个子窗体就会出现在主窗口的客户区, 也就是你说的这个容器……
发表于 2012-2-28 13:42:56 | 显示全部楼层
控件有码的吗
发表于 2012-2-28 16:03:57 | 显示全部楼层
本帖最后由 lixiaolong 于 2012-2-28 16:16 编辑

回复 1# xms77

#include <GuiStatusBar.au3>

Global Const $WM_SIZE = 0x05
Global Const $WM_GETMINMAXINFO = 0x0024
Global Const $GUI_RUNDEFMSG = 'GUI_RUNDEFMSG'

$width = 588
$hight = 500

$pichight = 459
$labelhight = 460
$labelhight2 = 80

$GUI = GUICreate('Low Cost Gramload Tester Program (Ver2.2A)', $width, $hight, -1, -1, 0x00070000)

$menu1 = GUICtrlCreateMenu("&File")
$menu2 = GUICtrlCreateMenu("Set-&Up")
$menu3 = GUICtrlCreateMenu("&Production")
$menu4 = GUICtrlCreateMenu("&Window")
$menu5 = GUICtrlCreateMenu("&Help")

GUICtrlCreatePic("", 0, -1, $width, $hight - $pichight, 0x08000000, 0x0007)
GUICtrlSetResizing(-1, 512 + 32)

$ico1 = GUICtrlCreateIcon("shell32.dll", -1, 5, 2, 32, 32, -1, 0x0007)
GUICtrlSetResizing(-1, 770 + 32)
$ico2 = GUICtrlCreateIcon("shell32.dll", -2, 38, 2, 32, 32, -1, 0x0007)
GUICtrlSetResizing(-1, 770 + 32)
$ico3 = GUICtrlCreateIcon("shell32.dll", -3, 70, 2, 32, 32, -1, 0x0007)
GUICtrlSetResizing(-1, 770 + 32)
$ico4 = GUICtrlCreateIcon("shell32.dll", -4, 102, 2, 32, 32, -1, 0x0007)
GUICtrlSetResizing(-1, 770 + 32)

$Graphic = GUICtrlCreateGraphic(0, $hight - $labelhight, $width, $hight - $labelhight2, -1)
GUICtrlSetBkColor(-1, 0x848285)
GUICtrlSetResizing(-1, 32)

$hStatus = _GUICtrlStatusBar_Create($GUI, -1, '', $SBARS_SIZEGRIP, 0x0007)
;===============================================================================
_GUICtrlStatusBar_SetParts($hStatus, -1)

GUISetState()

;注册Windows消息函数
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO")

While 1
        $msg = GUIGetMsg()
        Select
                Case $msg = -3
                        Exit
                Case $msg = $ico1
                        ButtonAnime($GUI, $ico1)
                Case $msg = $ico2
                        ButtonAnime($GUI, $ico2)
                Case $msg = $ico3
                        ButtonAnime($GUI, $ico3)
                Case $msg = $ico4
                        ButtonAnime($GUI, $ico4)
        EndSelect
WEnd

Func ButtonAnime($_Hwd, $_Botton)
        Local $_pos = ControlGetPos($_Hwd, "", $_Botton)
        GUICtrlSetPos($_Botton, $_pos[0] + 1, $_pos[1] + 1)
        Sleep(100)
        GUICtrlSetPos($_Botton, $_pos[0], $_pos[1])
EndFunc   ;==>ButtonAnime


;根据窗口大小,调整状态栏
Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
        #forceref $hWnd, $iMsg, $iwParam, $ilParam
        _GUICtrlStatusBar_Resize($hStatus)
        GUICtrlSetPos($Graphic, 0, $hight - $labelhight, @DesktopWidth * 3, @DesktopHeight * 3)
        Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_SIZE

Func WM_GETMINMAXINFO($hWnd, $msg, $wparam, $lparam)
        Local $tagMINMAXINFO = "int;int;int;int;int;int;int;int;int;int"
        $MINMAXINFO = DllStructCreate($tagMINMAXINFO, $lparam)
        DllStructSetData($MINMAXINFO, 7, 300) ;minx
        DllStructSetData($MINMAXINFO, 8, 200) ;miny
        DllStructSetData($MINMAXINFO, 9, @DesktopWidth) ;maxx
        DllStructSetData($MINMAXINFO, 10, @DesktopHeight - 30) ;maxy
EndFunc   ;==>WM_GETMINMAXINFO

评分

参与人数 1金钱 +20 贡献 +3 收起 理由
xms77 + 20 + 3 你真是太热心了,感谢!

查看全部评分

 楼主| 发表于 2012-2-28 16:29:45 | 显示全部楼层
回复 8# lixiaolong
太感谢了!试了下,在鼠标拖动改变窗体大小的过程中,窗体区域会白花花的闪,不知道能不能解决?
发表于 2012-2-28 16:50:05 | 显示全部楼层
回复 9# xms77

可能是CPU有关吧,我的电脑没问题,但是在虚拟机上和你一样的现象...
发表于 2012-2-29 08:45:20 | 显示全部楼层
学习了,谢谢
发表于 2012-2-29 09:28:52 | 显示全部楼层
学到这源码好谢谢
发表于 2012-12-6 14:23:47 | 显示全部楼层
收藏了,谢谢分享
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-6-1 15:19 , Processed in 0.094077 second(s), 28 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表