找回密码
 加入
搜索
查看: 6156|回复: 15

[GUI管理] 【已解决】关于gui子窗口座标

[复制链接]
发表于 2019-12-8 21:16:26 | 显示全部楼层 |阅读模式
本帖最后由 anythinging 于 2020-2-18 17:10 编辑

各位大神,在练习做一个桌面的小日历,开始日历控件总是被背景图片遮挡,反复测试后可算是实现不被背景图遮挡了,又有了个新问题,日历窗口gui的x,y值不生效,始终在屏幕左上角,求指点,谢谢!
$WinMain = GUICreate("WinMain", 1280, 800, -1, -1,$WS_POPUP)
$Wallpaper = GUICtrlCreatePic('c:\windows\back01.jpg', 0,0, 1280, 800)
GUICtrlSetState($Wallpaper,$GUI_DISABLE)
$text1 = GUICtrlCreateLabel('桌面日历',500,30,200,50)
GUICtrlSetFont(-1, 24, 800,0,"微软雅黑")
$ButtonA1 = GUICtrlCreateButton('退出', 500, 700, 100, 35)

_WinAPI_SetWindowLong($WinMain, $GWL_HWNDPARENT, WinGetHandle("Program Manager"));此语句实现窗口不被最小化

GUISetState(@SW_SHOW, $WinMain)

;$WinMainSubRL = GUICreate("日历控件",220,160,1060,20,$WS_POPUP,$WS_EX_MDICHILD,$WinMain);不被背景图片遮挡

$WinMainSubRL = GUICreate("日历控件",220,160,1060,20,$WS_CHILD,$WS_EX_LAYERED,$WinMain);不被背景图片遮挡


Global $hCalendarText = GUICtrlCreateLabel(@YEAR&@mon,12,10,280,25)
GUICtrlSetFont(-1, 14, 400,0,"微软雅黑")
GUICtrlSetColor(-1,0xFEFEFE)
GUICtrlSetBkColor(-1,-2)

GUISetState()
 楼主| 发表于 2019-12-8 21:21:17 | 显示全部楼层
日历的窗口始终在左上解红框位置

本帖子中包含更多资源

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

×
 楼主| 发表于 2019-12-8 21:26:43 | 显示全部楼层
如果用$WinMainSubRL = GUICreate("日历控件",220,160,1060,20,$WS_POPUP,$WS_EX_MDICHILD,$WinMain);不被背景图片遮挡,能实现不被背景图片遮挡了,xy值也生效了,但无法实现透明

本帖子中包含更多资源

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

×
发表于 2019-12-9 08:31:22 | 显示全部楼层
anythinging 发表于 2019-12-8 21:26
如果用$WinMainSubRL = GUICreate("日历控件",220,160,1060,20,$WS_POPUP,$WS_EX_MDICHILD,$WinMain);不被 ...

是这个意思?



本帖子中包含更多资源

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

×
 楼主| 发表于 2019-12-9 08:34:51 | 显示全部楼层

是的,就是这个意思.
发表于 2019-12-9 08:41:18 | 显示全部楼层
anythinging 发表于 2019-12-9 08:34
是的,就是这个意思.

用一个窗口就可以

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $iWidtha = 1280;@DesktopWidth
Global $iHeighta = 750;@DesktopHeight
#Region ### START Koda GUI section ### Form=
$WinMain = GUICreate("Form1", $iWidtha, $iHeighta, -1, -1, BitOR($WS_SYSMENU, $WS_BORDER, $WS_POPUP, $DS_MODALFRAME))
$Wallpaper = GUICtrlCreatePic(@ScriptDir & "/back0.jpg", 0,0, $iWidtha, $iHeighta);$iWidtha - 68, $iHeighta - 100)
GUICtrlSetState($Wallpaper,$GUI_DISABLE)
Global $hCalendarText = GUICtrlCreateLabel(@YEAR&@mon,$iWidtha-100,10,90,25)
GUICtrlSetFont(-1, 14, 400,0,"微软雅黑")
GUICtrlSetColor(-1,0xFEFEFE)
GUICtrlSetBkColor(-1,-2)
$text1 = GUICtrlCreateLabel('桌面日历',$iWidtha/2-70,30,140,50)
GUICtrlSetFont(-1, 24, 800,0,"微软雅黑")
GUICtrlSetColor(-1,0xFF9933);0x990000)
GUICtrlSetBkColor(-1,-2)
$ButtonA1 = GUICtrlCreateButton('退出', $iWidtha/2-50, 700, 100, 35)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE, $ButtonA1
                        Exit

        EndSwitch
WEnd

 楼主| 发表于 2019-12-9 08:46:33 | 显示全部楼层
chzj589 发表于 2019-12-9 08:41
用一个窗口就可以
[au3]
#include

谢谢!用一个窗口是没问题的,想请教如果是2个gui或多个gui窗口的时候,如何处理?
发表于 2019-12-9 10:18:59 | 显示全部楼层
anythinging 发表于 2019-12-9 08:46
谢谢!用一个窗口是没问题的,想请教如果是2个gui或多个gui窗口的时候,如何处理?

查看帮助
GUISetState([标志[, 句柄]])


 楼主| 发表于 2019-12-9 12:36:38 | 显示全部楼层
以后要逐步增加些东西,如果放在一个窗口里的话,很多坐标参数都需要修改。
发表于 2019-12-9 13:22:58 | 显示全部楼层
本帖最后由 chzj589 于 2019-12-9 14:11 编辑
anythinging 发表于 2019-12-9 12:36
以后要逐步增加些东西,如果放在一个窗口里的话,很多坐标参数都需要修改。

三年多了,LZ可能没时间学习,这应该是基础的东西。例子:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $iWidtha = 1280;@DesktopWidth
Global $iHeighta = 750;@DesktopHeight
Global $WinMain, $WinMain1, $ButtonA1
_WinMain()
Func _WinMain()
        GUISetState(@SW_HIDE, $WinMain1)
        #Region ### START Koda GUI section ### Form=
        $WinMain = GUICreate("Form1", $iWidtha, $iHeighta, -1, -1, BitOR($WS_SYSMENU, $WS_BORDER, $WS_POPUP, $DS_MODALFRAME))
        $Wallpaper = GUICtrlCreatePic(@ScriptDir & "/back0.jpg", 0, 0, $iWidtha, $iHeighta);$iWidtha - 68, $iHeighta - 100)
        GUICtrlSetState($Wallpaper, $GUI_DISABLE)
        Global $hCalendarText = GUICtrlCreateLabel(@YEAR & @MON, $iWidtha - 100, 10, 90, 25)
        GUICtrlSetFont(-1, 14, 400, 0, "微软雅黑")
        GUICtrlSetColor(-1, 0xFEFEFE)
        GUICtrlSetBkColor(-1, -2)
        $text1 = GUICtrlCreateLabel('桌面日历', $iWidtha / 2 - 70, 30, 140, 50)
        GUICtrlSetFont(-1, 24, 800, 0, "微软雅黑")
        GUICtrlSetColor(-1, 0xFF9933);0x990000)
        GUICtrlSetBkColor(-1, -2)
        $ButtonA1 = GUICtrlCreateButton('退出', $iWidtha / 2 - 50, 700, 100, 35)
        $Button1 = GUICtrlCreateButton('下一个窗口', $iWidtha - 350, 700, 100, 35)
        GUISetState(@SW_SHOW, $WinMain)
        #EndRegion ### END Koda GUI section ###

        While 1
                $nMsg = GUIGetMsg()
                Switch $nMsg
                        Case $GUI_EVENT_CLOSE, $ButtonA1
                                Exit
                        Case $Button1
                                _Button()
                EndSwitch
        WEnd
EndFunc   ;==>_WinMain
Func _Button()
        GUISetState(@SW_HIDE, $WinMain)
        #Region ### START Koda GUI section ### Form=
        $WinMain1 = GUICreate("Form1", $iWidtha, $iHeighta, -1, -1, BitOR($WS_SYSMENU, $WS_BORDER, $WS_POPUP, $DS_MODALFRAME))
        $Wallpaper = GUICtrlCreatePic(@ScriptDir & "/back0.jpg", 0, 0, $iWidtha, $iHeighta);$iWidtha - 68, $iHeighta - 100)
        GUICtrlSetState($Wallpaper, $GUI_DISABLE)
        Global $hCalendarText = GUICtrlCreateLabel(@YEAR & @MON, $iWidtha - 100, 10, 90, 25)
        GUICtrlSetFont(-1, 14, 400, 0, "微软雅黑")
        GUICtrlSetColor(-1, 0xFEFEFE)
        GUICtrlSetBkColor(-1, -2)
        $text1 = GUICtrlCreateLabel('桌面日历2', $iWidtha / 2 - 77, 30, 155, 50)
        GUICtrlSetFont(-1, 24, 800, 0, "微软雅黑")
        GUICtrlSetColor(-1, 0xFF9933);0x990000)
        GUICtrlSetBkColor(-1, -2)
        $Button1 = GUICtrlCreateButton('返回', $iWidtha - 350, 700, 100, 35)

        GUISetState(@SW_SHOW, $WinMain1)
        #EndRegion ### END Koda GUI section ###

        While 1
                $nMsg = GUIGetMsg()
                Switch $nMsg
                        Case $GUI_EVENT_CLOSE, $ButtonA1
                                Exit
                        Case $Button1
                                _WinMain()
                EndSwitch
        WEnd
EndFunc   ;==>_Button



 楼主| 发表于 2019-12-9 16:15:40 | 显示全部楼层
感谢解答,实在是惭愧,水平有限啊,其实我只想要左边的效果,右边的位置
#NoTrayIcon
#include <Process.au3>
#include <WinAPIProc.au3>
#include <ftpex.au3>
#Include <WinAPI.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <winapi.au3>



$WinMain = GUICreate("WinMain", @DesktopWidth, @DesktopHeight, -1, -1,$WS_POPUP)
$Wallpaper = GUICtrlCreatePic('c:\windows\back02.jpg', 0,0,  @DesktopWidth, @DesktopHeight)
GUICtrlSetState($Wallpaper,$GUI_DISABLE)

$text1 = GUICtrlCreateLabel('桌面日历',400,30,200,50)
GUICtrlSetFont(-1, 24, 800,0,"微软雅黑")

$ButtonA1 = GUICtrlCreateButton('退出', 500, 700, 100, 35)

_WinAPI_SetWindowLong($WinMain, $GWL_HWNDPARENT, WinGetHandle("Program Manager"));此语句实现窗口不被最小化

GUISetState(@SW_SHOW, $WinMain)




Global $aWeekName[7] = ["日","一","二","三","四","五","六"]
Global $aDayName[42]
Global $hFocusText

;$WinMainSubRL = GUICreate("日历控件",220,160,@DesktopWidth-220,30,$WS_POPUP,$WS_EX_MDICHILD,$WinMain);不被背景图片遮挡
$WinMainSubRL = GUICreate("日历控件",220,160,@DesktopWidth-220,10,$WS_CHILD,$WS_EX_LAYERED,$WinMain);不被背景图片遮挡


Global $hCalendarText = GUICtrlCreateLabel(GetDate(),12,20,280,25)
GUICtrlSetFont(-1, 14, 400,0,"微软雅黑")
GUICtrlSetColor(-1,0xFEFEFE)
GUICtrlSetBkColor(-1,-2)

For $i = 0 To 6
        GUICtrlCreateLabel($aWeekName[$i],0+$i*30,35,42,22,$SS_CENTER)
        ;GUICtrlSetFont(-1, 16, 800)
                GUICtrlSetFont(-1, 12, 600, 0, "微软雅黑")
        ;GUICtrlSetColor(-1,0xFEFEFE);周一-周日颜色
                GUICtrlSetColor(-1,0x4682B4);周一-周日颜色
        GUICtrlSetBkColor(-1,-2)
Next

Local $k=1
For $i = 1 To 6
        For $j =0 To 6
                $aDayName[$k-1] = GUICtrlCreateLabel("",0+$j*30,35+$i*20,42,22,$SS_CENTER)
                ;GUICtrlSetFont(-1, 16, 800)
                                GUICtrlSetFont(-1, 12, 400, 0, "微软雅黑")
                GUICtrlSetColor(-1,0xFEFEFE)
                GUICtrlSetBkColor(-1,-2)
                $k+=1
        Next
Next
SetCalendar(@YEAR, @MON)

GUISetState()



While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                        Case $GUI_EVENT_CLOSE, $ButtonA1
                                Exit
        EndSwitch
           Sleep(100)
WEnd


Func SetCalendar($iYear, $iMonth)
        If $iYear < 999 Or $iYear > 9998 Or $iMonth < 1 And $iMonth > 12 Then Return False
        Local $k=1, $l = 0, $iWeekday = _DateToDayOfWeek($iYear, $iMonth, 1)
        Local $iDays = _DateDaysInMonth($iYear, $iMonth)
        For $i = 1 To 6
                For $j =0 To 6
                        If $k >= $iWeekday And $l < $iDays Then
                                $l+=1
                                GUICtrlSetData($aDayName[$k-1],$l)
                        Else
                                GUICtrlSetData($aDayName[$k-1],"")
                        EndIf
                        If @YEAR = $iYear And @MDAY = $l And @MON = $iMonth Then
                                GUICtrlSetColor($aDayName[$k-1],0x4682B4);当天的颜色0xFFA0A0
                        Else
                                GUICtrlSetColor($aDayName[$k-1], 0xFEFEFE);每天的颜色
                        EndIf
                        $k+=1
                Next
        Next
        Return True
EndFunc

Func GetDate()
        Return (@YEAR & "   年  " & @MON & "  月  " & @MDAY & "  日  ")
EndFunc


本帖子中包含更多资源

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

×
发表于 2019-12-9 17:22:24 | 显示全部楼层
anythinging 发表于 2019-12-9 16:15
感谢解答,实在是惭愧,水平有限啊,其实我只想要左边的效果,右边的位置

#NoTrayIcon
#include <Process.au3>
#include <WinAPIProc.au3>
#include <ftpex.au3>
#include <WinAPI.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <winapi.au3>
$WinMain = GUICreate("WinMain", @DesktopWidth, @DesktopHeight, -1, -1, $WS_POPUP)
$Wallpaper = GUICtrlCreatePic(@ScriptDir & "/back0.jpg", 0, 0, @DesktopWidth, @DesktopHeight)
GUICtrlSetState($Wallpaper, $GUI_DISABLE)
$text1 = GUICtrlCreateLabel('桌面日历', @DesktopWidth/2-70, 30, 150, 50)
GUICtrlSetFont(-1, 24, 800, 0, "微软雅黑")
GUICtrlSetBkColor(-1, -2)
$ButtonA1 = GUICtrlCreateButton('退出', @DesktopWidth/2-50, 700, 100, 35)
_WinAPI_SetWindowLong($WinMain, $GWL_HWNDPARENT, WinGetHandle("Program Manager"));此语句实现窗口不被最小化
GUISetState(@SW_SHOW, $WinMain)
Global $aWeekName[7] = ["日", "一", "二", "三", "四", "五", "六"]
Global $aDayName[43]
Global $hFocusText
;$WinMainSubRL = GUICreate("日历控件",220,160,@DesktopWidth-220,30,$WS_POPUP,$WS_EX_MDICHILD,$WinMain);不被背景图片遮挡
$WinMainSubRL = GUICreate("日历控件", 220, 160, @DesktopWidth - 220, 10, $WS_CHILD, $WS_EX_LAYERED, $WinMain);不被背景图片遮挡
Global $hCalendarText = GUICtrlCreateLabel(GetDate(), @DesktopWidth - 230, 30, 240, 25)
GUICtrlSetFont(-1, 14, 400, 0, "微软雅黑")
GUICtrlSetColor(-1, 0xFEFEFE)
GUICtrlSetBkColor(-1, -2)
For $i = 0 To 6
        GUICtrlCreateLabel($aWeekName[$i], @DesktopWidth - 235 + $i * 30, 60, 25, 22, $SS_CENTER)
        ;GUICtrlSetFont(-1, 16, 800)
        GUICtrlSetFont(-1, 12, 600, 0, "微软雅黑")
        ;GUICtrlSetColor(-1,0xFEFEFE);周一-周日颜色
        GUICtrlSetColor(-1, 0x990000);0x4682B4);周一-周日颜色
        GUICtrlSetBkColor(-1, -2)
Next
Local $k = 1
For $i = 1 To 6
        For $j = 0 To 6
                $aDayName[$k - 1] = GUICtrlCreateLabel("", @DesktopWidth - 235 + $j * 30, 60 + $i * 20, 25, 22, $SS_CENTER)
                ;GUICtrlSetFont(-1, 16, 800)
                GUICtrlSetFont(-1, 12, 400, 0, "微软雅黑")
                GUICtrlSetColor(-1, 0xFEFEFE)
                GUICtrlSetBkColor(-1, -2)
                $k += 1
        Next
Next
SetCalendar(@YEAR, @MON)
GUISetState()
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE, $ButtonA1
                        Exit
        EndSwitch
        Sleep(100)
WEnd
Func SetCalendar($iYear, $iMonth)
        If $iYear < 999 Or $iYear > 9998 Or $iMonth < 1 And $iMonth > 12 Then Return False
        Local $k = 1, $l = 0, $iWeekday = _DateToDayOfWeek($iYear, $iMonth, 1)
        Local $iDays = _DateDaysInMonth($iYear, $iMonth)
        For $i = 1 To 6
                For $j = 0 To 6
                        If $k >= $iWeekday And $l < $iDays Then
                                $l += 1
                                GUICtrlSetData($aDayName[$k - 1], $l)
                        Else
                                GUICtrlSetData($aDayName[$k - 1], "")
                        EndIf
                        If @YEAR = $iYear And @MDAY = $l And @MON = $iMonth Then
                                GUICtrlSetColor($aDayName[$k - 1], 0xfbfcfd);0x4682B4);当天的颜色0xFFA0A0
                                GUICtrlSetBkColor($aDayName[$k - 1], 0x990000)
                        Else
                                GUICtrlSetColor($aDayName[$k - 1], 0xfbfcfd);0xFEFEFE);每天的颜色
                        EndIf
                        $k += 1
                Next
        Next
        Return True
EndFunc   ;==>SetCalendar
Func GetDate()
        Return (@YEAR & "   年  " & @MON & "  月  " & @MDAY & "  日  ")
EndFunc   ;==>GetDate



本帖子中包含更多资源

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

×
发表于 2019-12-9 17:54:53 | 显示全部楼层
本帖最后由 chzj589 于 2019-12-9 18:29 编辑
anythinging 发表于 2019-12-9 16:15
感谢解答,实在是惭愧,水平有限啊,其实我只想要左边的效果,右边的位置

没注意看,第二个窗口是多余的。
$WinMainSubRL = GUICreate("日历控件", 220, 160, @DesktopWidth - 220, 10, $WS_CHILD, $WS_EX_LAYERED, $WinMain);不被背景图片遮挡第二个窗口要用的话应该是这样子

#NoTrayIcon
#include <Process.au3>
#include <WinAPIProc.au3>
#include <ftpex.au3>
#include <WinAPI.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$WinMain = GUICreate("WinMain", @DesktopWidth, @DesktopHeight, -1, -1, $WS_POPUP)
GUISetBkColor(0xA0E0E0)
$WinMainSubRL = GUICreate("A視窗", @DesktopWidth - 20, @DesktopHeight - 60, 10, 30, $WS_CHILD, $WS_EX_CLIENTEDGE, $WinMain)
GUISetBkColor(0xA0E0E0)
$Wallpaper = GUICtrlCreatePic(@ScriptDir & "/back0.jpg", 0, 0, @DesktopWidth, @DesktopHeight)
GUICtrlSetState($Wallpaper, $GUI_DISABLE)
$text1 = GUICtrlCreateLabel('桌面日历', @DesktopWidth / 2 - 70, 30, 150, 50)
GUICtrlSetFont(-1, 24, 800, 0, "微软雅黑")
GUICtrlSetBkColor(-1, -2)
$ButtonA1 = GUICtrlCreateButton('退出', @DesktopWidth / 2 - 50, 700, 100, 35)
;_WinAPI_SetWindowLong($WinMain, $GWL_HWNDPARENT, WinGetHandle("Program Manager"));此语句实现窗口不被最小化
Global $aWeekName[7] = ["日", "一", "二", "三", "四", "五", "六"]
Global $aDayName[43]
Global $hFocusText
Global $hCalendarText = GUICtrlCreateLabel(GetDate(), @DesktopWidth - 230, 30, 240, 25)
GUICtrlSetFont(-1, 14, 400, 0, "微软雅黑")
GUICtrlSetColor(-1, 0xFEFEFE)
GUICtrlSetBkColor(-1, -2)
For $i = 0 To 6
        GUICtrlCreateLabel($aWeekName[$i], @DesktopWidth - 235 + $i * 30, 60, 25, 22, $SS_CENTER)
        ;GUICtrlSetFont(-1, 16, 800)
        GUICtrlSetFont(-1, 12, 600, 0, "微软雅黑")
        ;GUICtrlSetColor(-1,0xFEFEFE);周一-周日颜色
        GUICtrlSetColor(-1, 0x990000);0x4682B4);周一-周日颜色
        GUICtrlSetBkColor(-1, -2)
Next
Local $k = 1
For $i = 1 To 6
        For $j = 0 To 6
                $aDayName[$k - 1] = GUICtrlCreateLabel("", @DesktopWidth - 235 + $j * 30, 60 + $i * 20, 25, 22, $SS_CENTER)
                ;GUICtrlSetFont(-1, 16, 800)
                GUICtrlSetFont(-1, 12, 400, 0, "微软雅黑")
                GUICtrlSetColor(-1, 0xFEFEFE)
                GUICtrlSetBkColor(-1, -2)
                $k += 1
        Next
Next
SetCalendar(@YEAR, @MON)
;GUISetState()
GUISetState(@SW_SHOW, $WinMainSubRL)
GUISetState(@SW_SHOW, $WinMain)
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE, $ButtonA1
                        GUIDelete()
                        Exit
        EndSwitch
        ;Sleep(100)
WEnd
Func SetCalendar($iYear, $iMonth)
        If $iYear < 999 Or $iYear > 9998 Or $iMonth < 1 And $iMonth > 12 Then Return False
        Local $k = 1, $l = 0, $iWeekday = _DateToDayOfWeek($iYear, $iMonth, 1)
        Local $iDays = _DateDaysInMonth($iYear, $iMonth)
        For $i = 1 To 6
                For $j = 0 To 6
                        If $k >= $iWeekday And $l < $iDays Then
                                $l += 1
                                GUICtrlSetData($aDayName[$k - 1], $l)
                        Else
                                GUICtrlSetData($aDayName[$k - 1], "")
                        EndIf
                        If @YEAR = $iYear And @MDAY = $l And @MON = $iMonth Then
                                GUICtrlSetColor($aDayName[$k - 1], 0xfbfcfd);0x4682B4);当天的颜色0xFFA0A0
                                GUICtrlSetBkColor($aDayName[$k - 1], 0x990000)
                        Else
                                GUICtrlSetColor($aDayName[$k - 1], 0xfbfcfd);0xFEFEFE);每天的颜色
                        EndIf
                        $k += 1
                Next
        Next
        Return True
EndFunc   ;==>SetCalendar
Func GetDate()
        Return (@YEAR & "   年  " & @MON & "  月  " & @MDAY & "  日  ")
EndFunc   ;==>GetDate



本帖子中包含更多资源

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

×
 楼主| 发表于 2019-12-9 21:09:45 | 显示全部楼层
chzj589 发表于 2019-12-9 17:22
[au3]#NoTrayIcon
#include
#include

非常感谢指点,看了您的2个代码,我看懂了日历代码的座标是相对于$WinMain的,而我之前设置的日历座标都是属于$WinMainSubRL的,请问这样设置有问题吗?

我最初的想法是如果日历座标属于$WinMainSubRL,那么在以后的代码中可以隐藏或关闭$WinMainSubRL,就可以将日历这一块隐藏不显示了。
发表于 2019-12-9 22:00:46 | 显示全部楼层
本帖最后由 chzj589 于 2019-12-9 22:23 编辑
anythinging 发表于 2019-12-9 21:09
非常感谢指点,看了您的2个代码,我看懂了日历代码的座标是相对于$WinMain的,而我之前设置的日历座标都 ...

你没注意看,第二个代码就是属于$WinMainSubRL窗口
如果要增加窗口代码,只要添加$WinMainSubRL窗口就行在GUISetState(@SW_SHOW, $WinMain)后面加上
$WinMainSubRL1 = GUICreate("", @DesktopWidth - 23, @DesktopHeight - 63, 10, 30, $WS_CHILD, $WS_EX_CLIENTEDGE, $WinMain)
;GUISetBkColor(0xA0E0E0)
$Wallpaper = GUICtrlCreatePic(@ScriptDir & "/back0.jpg", 0, 0, @DesktopWidth, @DesktopHeight)
GUICtrlSetState($Wallpaper, $GUI_DISABLE)
$text1 = GUICtrlCreateLabel('桌面日历', @DesktopWidth / 2 - 70, 30, 150, 50)
GUICtrlSetFont(-1, 24, 800, 0, "微软雅黑")
GUICtrlSetBkColor(-1, -2)

$Button2 = GUICtrlCreateButton('返回', @DesktopWidth - 350, 700, 100, 35)
GUISetState(@SW_HIDE, $WinMainSubRL1)
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE, $ButtonA1
                        GUIDelete()
                        Exit
                Case $Button1
                        GUISetState(@SW_HIDE, $WinMainSubRL)
                        WinActivate($WinMain)
                        GUISetState(@SW_SHOW, $WinMainSubRL1)
                Case $Button2
                        GUISetState(@SW_HIDE, $WinMainSubRL1)
                        WinActivate($WinMain)
                        GUISetState(@SW_SHOW, $WinMainSubRL)
        EndSwitch
WEnd

您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-12-23 16:03 , Processed in 0.102230 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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