函数参考


_GUICtrlMonthCal_GetColorArray

检索控件指定部分的颜色

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetColorArray($hWnd, $iColor)

参数

$hWnd 控件句柄
$iColor int 类型值,指定检索颜色的控件部位.
此值可为下列之一:
$MCSC_BACKGROUND - 月份之间的背景颜色.
$MCSC_MONTHBK - 本月的背景颜色.
$MCSC_TEXT - 月内文本的颜色.
$MCSC_TITLEBK - 日历标题的背景颜色.
$MCSC_TITLETEXT - 日历标题的文字颜色.
$MCSC_TRAILINGTEXT - 上一天和下一天的文本颜色.

返回值

成功: 返回如下格式的数组:
[0] - 返回包含的数量
[1] - COLORREF 类型的 RGB 颜色
[2] - 十六位 BGR 颜色
[3] - 十六位 RGB 颜色
失败: 返回 False

注意/说明

 标头和结尾的日历天是当前月份的日历中出现的日子 .

相关

_GUICtrlMonthCal_Create

示例/演示


#include <GUIConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
    Local $hMonthCal

    ; 创建 GUI
    GUICreate("Month Calendar Get Color Array", 425, 300)
    $hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, $WS_BORDER, 0x00000000)

    ; 创建 memo 控件
    $iMemo = GUICtrlCreateEdit("", 4, 168, 417, 128, BitOR($WS_VSCROLL, $ES_MULTILINE))
    GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
    GUICtrlSendMsg($iMemo, $EM_SETREADONLY, True, 0)
    GUICtrlSetBkColor($iMemo, 0xFFFFFF)
    GUISetState()

    _GUICtrlMonthCal_SetColor($hMonthCal, $MCSC_MONTHBK, $CLR_MONEYGREEN)

    ; Get/Set calendar colors
    MemoWrite(_FormatOutPut("Background color displayed between months:", _GUICtrlMonthCal_GetColorArray($hMonthCal, $MCSC_BACKGROUND)))
    MemoWrite(_FormatOutPut(@CRLF & "Background color displayed within the month:", _GUICtrlMonthCal_GetColorArray($hMonthCal, $MCSC_MONTHBK)))
    MemoWrite(_FormatOutPut(@CRLF & "Color used to display text within a month:", _GUICtrlMonthCal_GetColorArray($hMonthCal, $MCSC_TEXT)))
    MemoWrite(_FormatOutPut(@CRLF & "Background color displayed in the calendar's title:", _GUICtrlMonthCal_GetColorArray($hMonthCal, $MCSC_TITLEBK)))
    MemoWrite(_FormatOutPut(@CRLF & "Color used to display text within the calendar's title:", _GUICtrlMonthCal_GetColorArray($hMonthCal, $MCSC_TITLETEXT)))
    MemoWrite(_FormatOutPut(@CRLF & "Color used to display header day and trailing day text:", _GUICtrlMonthCal_GetColorArray($hMonthCal, $MCSC_TRAILINGTEXT)))

    ; 循环直到用户退出
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>_Main

Func _FormatOutPut($sText, $aColors)
    Return $sText & _
            @CRLF & @TAB & "COLORREF rgbcolor:" & @TAB & $aColors[1] & _
            @CRLF & @TAB & "Hex BGR color:" & @TAB & @TAB & $aColors[2] & _
            @CRLF & @TAB & "Hex RGB color:" & @TAB & @TAB & $aColors[3]
EndFunc   ;==>_FormatOutPut

; 写入消息到 memo
Func MemoWrite($sMessage)
    GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite