Что нового

[Время, дата] Отмечаем дни в Календаре

defens

Знающий
Сообщения
89
Репутация
5
Подскажите, как согласно выбранной дате пометить этот день в календаре и от нее пометить остальные дни дальше на остальные месяца.
И как сделать, чтоб можно было передвигать месяца.

Код:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <DateTimeConstants.au3>

Opt("MustDeclareVars", 1)

;~ Global $MCS_NOTODAY
Global $hGui, $Button1, $Date1, $Date2, $Date3, $Button2, $nMsg
Global $Group1, $Label, $Input, $Label1, $Input1, $Label2, $Input2, $Label3, $Input3, $Button
Global $Group2, $Label4, $Label5, $Label6, $Label7, $Label8, $Label9, $Label14, $Label15, $Label16, $Label17, $Label18, $Label19

#Region ### START Koda GUI section ### Form=
$hGui = GUICreate("ГРАФИК", 740, 370)
GUISetBkColor(0x25C3F0)
$Group1 = GUICtrlCreateGroup("", 8, 4, 557, 165)
$Button1 = GUICtrlCreateButton("ПРЕДЫДУЩИЙ", 11, 15, 20, 150, $BS_MULTILINE)
GUICtrlSetFont(-1, 9)
$Date1 = GUICtrlCreateMonthCal("", 32, 15, 168, 150, BitOR($MCS_NOTODAY, $MCS_NOTODAYCIRCLE), $WS_EX_WINDOWEDGE)
$Date2 = GUICtrlCreateMonthCal("", 202, 15, 168, 150, BitOR($MCS_NOTODAY, $MCS_NOTODAYCIRCLE), $WS_EX_WINDOWEDGE)
$Date3 = GUICtrlCreateMonthCal("", 372, 15, 168, 150, BitOR($MCS_NOTODAY, $MCS_NOTODAYCIRCLE), $WS_EX_WINDOWEDGE)
$Button2 = GUICtrlCreateButton("СЛЕДУЮЩИЙ", 541, 15, 20, 150, $BS_MULTILINE)
GUICtrlSetFont(-1, 9)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$Group1 = GUICtrlCreateGroup("", 570, 4, 160, 165)
$Label = GUICtrlCreateLabel("Имя:", 580, 20, 50)
GUICtrlSetFont(-1, 13)
$Input = GUICtrlCreateInput("", 640, 20, 80, 18, BitOR($ES_CENTER, $ES_NUMBER))
$Label1 = GUICtrlCreateLabel("Число:", 580, 48, 50)
GUICtrlSetFont(-1, 13)
$Input1 = GUICtrlCreateInput("1", 640, 48, 80, 18, BitOR($ES_CENTER, $ES_NUMBER))
$Label2 = GUICtrlCreateLabel("Месяц:", 580, 77, 54)
GUICtrlSetFont(-1, 13)
$Input2 = GUICtrlCreateInput("1", 640, 77, 80, 18, BitOR($ES_CENTER, $ES_NUMBER))
$Label3 = GUICtrlCreateLabel("Год:", 580, 105, 50)
GUICtrlSetFont(-1, 13)
$Input3 = GUICtrlCreateInput("2000", 640, 105, 80, 18, BitOR($ES_CENTER, $ES_NUMBER))
;~ $Label10 = GUICtrlCreateLabel("", 56, 192, 36, 17)
;~ GUICtrlSetFont(-1, 13)
;~ $Input4 = GUICtrlCreateInput("Input3", 144, 128, 121, 21)
$Button = GUICtrlCreateButton("РАССЧИТАТЬ", 600, 133, 100, 25)
GUICtrlSetFont(-1, 11)
	GUICtrlSetColor(-1, 0xFFFFFF)
		GUICtrlSetBkColor(-1, 0x2C84C4)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$Group2 = GUICtrlCreateGroup('', 8, 175, 722, 180)
$Label4 = GUICtrlCreateLabel('', 20, 195, 50, 20, $WS_BORDER)
GUICtrlSetBkColor(-1, 0xFF00EA)
$Label5 = GUICtrlCreateLabel('', 20, 220, 50, 20, $WS_BORDER)
GUICtrlSetBkColor(-1, 0xFCE0E0)
$Label6 = GUICtrlCreateLabel('', 20, 245, 50, 20, $WS_BORDER)
GUICtrlSetBkColor(-1, 0x98FFFD)
$Label7 = GUICtrlCreateLabel('', 20, 270, 50, 20, $WS_BORDER)
GUICtrlSetBkColor(-1, 0x00EEEA)
$Label8 = GUICtrlCreateLabel('', 20, 295, 50, 20, $WS_BORDER)
GUICtrlSetBkColor(-1, 0xFFFF00)
$Label9 = GUICtrlCreateLabel('', 20, 320, 50, 20, $WS_BORDER)
GUICtrlSetBkColor(-1, 0xFFA71C)
$Label14 = GUICtrlCreateLabel('- День начала', 75, 200, 250, 20)
$Label15 = GUICtrlCreateLabel('- Следующие 4 дня', 75, 225, 250, 20)
$Label16 = GUICtrlCreateLabel('- Следующие 5 дней', 75, 250, 250, 20)
$Label17 = GUICtrlCreateLabel('- Следующие 4 дня', 75, 275, 250, 20)
$Label18 = GUICtrlCreateLabel('- Следующий день', 75, 300, 250, 20)
$Label19 = GUICtrlCreateLabel('- Следующие 4 дня', 75, 325, 250, 20)

GUICtrlCreateGroup('', -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		Case $Button
				_Script()
	EndSwitch
WEnd

Func _Script() ; ОСНОВНОЙ ПЕРЕХОД
	MsgBox(4096, "", "РАССЧИТАТЬ")
EndFunc
 

CreatoR

Must AutoIt!
Команда форума
Администратор
Сообщения
8,671
Репутация
2,481
Re: [Время, дата] Календарь

Предупреждение За нарушение правил форума (пункт Б.5):
Имя темы должно нести смысловую нагрузку (отражать суть вопроса/проблемы)
Правильно сформулированное название темы привлекает больше внимания, и шансы получить конкретный ответ увеличиваются.


Данные правила могут пополняться локальными правилами раздела.
Как правильно называть темы

"[Время, дата] Календарь" - это неприемлемое название темы, переименуйте тему иначе она будет закрыта, а вам возможно будет выдан бан на несколько дней.

С уважением, ваш Администратор.
 
Автор
D

defens

Знающий
Сообщения
89
Репутация
5
С отображение смены месяцев вроде разобрался, осталось основную функцию сделать с подрисовкой дней согласно цветов
Код:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <DateTimeConstants.au3>
#Include <Date.au3>

Opt("MustDeclareVars", 1)

;~ Global $MCS_NOTODAY
Global $hGui, $Button1, $Date1, $Date2, $Date3, $Button2, $nMsg
Global $Group1, $Label, $Input, $Label1, $Input1, $Label2, $Input2, $Label3, $Input3, $Button
Global $Group2, $Label4, $Label5, $Label6, $Label7, $Label8, $Label9, $Label14, $Label15, $Label16, $Label17, $Label18, $Label19

Local $tDate  = _NowCalcDate() ; Текущая дата
Local $tPDate = _DateAdd("M",-1,$tDate) ; Текущая дата - 30 дней
Local $tNDate = _DateAdd("M",+1,$tDate) ; Текущая дата + 30 дней

#Region ### START Koda GUI section ### Form=
$hGui = GUICreate("ГРАФИК", 740, 370)
GUISetBkColor(0x25C3F0)
$Group1 = GUICtrlCreateGroup("", 8, 4, 557, 165)
$Button1 = GUICtrlCreateButton("ПРЕДЫДУЩИЙ", 11, 15, 20, 150, $BS_MULTILINE)
GUICtrlSetFont(-1, 9)
$Date1 = GUICtrlCreateMonthCal($tPDate, 32, 15, 168, 150, BitOR($MCS_NOTODAY, $MCS_NOTODAYCIRCLE), $WS_EX_WINDOWEDGE)
$Date2 = GUICtrlCreateMonthCal($tDate, 202, 15, 168, 150, BitOR($MCS_NOTODAY, $MCS_NOTODAYCIRCLE), $WS_EX_WINDOWEDGE)
$Date3 = GUICtrlCreateMonthCal($tNDate, 372, 15, 168, 150, BitOR($MCS_NOTODAY, $MCS_NOTODAYCIRCLE), $WS_EX_WINDOWEDGE)
$Button2 = GUICtrlCreateButton("СЛЕДУЮЩИЙ", 541, 15, 20, 150, $BS_MULTILINE)
GUICtrlSetFont(-1, 9)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$Group1 = GUICtrlCreateGroup("", 570, 4, 160, 165)
$Label = GUICtrlCreateLabel("Имя:", 580, 20, 50)
GUICtrlSetFont(-1, 13)
$Input = GUICtrlCreateInput("", 640, 20, 80, 18, BitOR($ES_CENTER, $ES_NUMBER))
$Label1 = GUICtrlCreateLabel("Число:", 580, 48, 50)
GUICtrlSetFont(-1, 13)
$Input1 = GUICtrlCreateInput("1", 640, 48, 80, 18, BitOR($ES_CENTER, $ES_NUMBER))
$Label2 = GUICtrlCreateLabel("Месяц:", 580, 77, 54)
GUICtrlSetFont(-1, 13)
$Input2 = GUICtrlCreateInput("1", 640, 77, 80, 18, BitOR($ES_CENTER, $ES_NUMBER))
$Label3 = GUICtrlCreateLabel("Год:", 580, 105, 50)
GUICtrlSetFont(-1, 13)
$Input3 = GUICtrlCreateInput("2000", 640, 105, 80, 18, BitOR($ES_CENTER, $ES_NUMBER))
;~ $Label10 = GUICtrlCreateLabel("", 56, 192, 36, 17)
;~ GUICtrlSetFont(-1, 13)
;~ $Input4 = GUICtrlCreateInput("Input3", 144, 128, 121, 21)
$Button = GUICtrlCreateButton("РАССЧИТАТЬ", 600, 133, 100, 25)
GUICtrlSetFont(-1, 11)
	GUICtrlSetColor(-1, 0xFFFFFF)
		GUICtrlSetBkColor(-1, 0x2C84C4)
GUICtrlCreateGroup("", -99, -99, 1, 1)

$Group2 = GUICtrlCreateGroup('', 8, 175, 722, 180)
$Label4 = GUICtrlCreateLabel('', 20, 195, 50, 20, $WS_BORDER)
GUICtrlSetBkColor(-1, 0xFF00EA)
$Label5 = GUICtrlCreateLabel('', 20, 220, 50, 20, $WS_BORDER)
GUICtrlSetBkColor(-1, 0xFCE0E0)
$Label6 = GUICtrlCreateLabel('', 20, 245, 50, 20, $WS_BORDER)
GUICtrlSetBkColor(-1, 0x98FFFD)
$Label7 = GUICtrlCreateLabel('', 20, 270, 50, 20, $WS_BORDER)
GUICtrlSetBkColor(-1, 0x00EEEA)
$Label8 = GUICtrlCreateLabel('', 20, 295, 50, 20, $WS_BORDER)
GUICtrlSetBkColor(-1, 0xFFFF00)
$Label9 = GUICtrlCreateLabel('', 20, 320, 50, 20, $WS_BORDER)
GUICtrlSetBkColor(-1, 0xFFA71C)
$Label14 = GUICtrlCreateLabel('- День начала', 75, 200, 250, 20)
$Label15 = GUICtrlCreateLabel('- Следующие 4 дня', 75, 225, 250, 20)
$Label16 = GUICtrlCreateLabel('- Следующие 5 дней', 75, 250, 250, 20)
$Label17 = GUICtrlCreateLabel('- Следующие 4 дня', 75, 275, 250, 20)
$Label18 = GUICtrlCreateLabel('- Следующий день', 75, 300, 250, 20)
$Label19 = GUICtrlCreateLabel('- Следующие 4 дня', 75, 325, 250, 20)

GUICtrlCreateGroup('', -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		Case $Button1
				_Prev()
		Case $Button2
				_Next()
		Case $Button
				_Script()
	EndSwitch
WEnd



Func _Prev() ; ОСНОВНОЙ ПЕРЕХОД
 $tPDate=_DateAdd("M",-1,$tPDate)
				GUICtrlSetData($Date1, $tPDate) ;
 $tDate=_DateAdd("M",-1,$tDate)
				GUICtrlSetData($Date2, $tDate) ;
 $tNDate=_DateAdd("M",-1,$tNDate)
				GUICtrlSetData($Date3, $tNDate) ;
EndFunc

Func _Next() ; ОСНОВНОЙ ПЕРЕХОД
 $tPDate=_DateAdd("M",+1,$tPDate)
				GUICtrlSetData($Date1, $tPDate) ;
 $tDate=_DateAdd("M",+1,$tDate)
				GUICtrlSetData($Date2, $tDate) ;
 $tNDate=_DateAdd("M",+1,$tNDate)
				GUICtrlSetData($Date3, $tNDate) ;
EndFunc

Func _Script() ; ОСНОВНОЙ ПЕРЕХОД
	MsgBox(4096, "", "РАССЧИТАТЬ")
EndFunc


Добавлено:
Сообщение автоматически объединено:

Подскажите, как согласно выбранной дате пометить цветом, этот день в календаре и от нее пометить цветами остальные дни дальше на остальные месяца.
 

lastangel

Новичок
Сообщения
39
Репутация
0
Так и не разобрались как отметить дни в календаре?
 
Автор
D

defens

Знающий
Сообщения
89
Репутация
5
Нет и походу надо создавать свой, а не с функцией _DateAdd
 
Верх