?? w_calendar_1.srw
字號:
boolean autovscroll = true
end type
event ue_mousemove;
if ib_MoveIn = false then
this.Backcolor = rgb(238,255,238)
this.textcolor = rgb(0,0,255)
ib_MoveIn = true
end if
end event
event ue_enchange;uo_1.Enabled = true
end event
event constructor;
ib_MoveIn = false
this.Backcolor = rgb(237,237,237)
this.textcolor = rgb(26,39,54)
end event
type sle_date from singlelineedit within w_calendar_1
integer x = 1902
integer y = 512
integer width = 914
integer height = 64
integer taborder = 20
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋體"
long textcolor = 65280
long backcolor = 0
end type
type st_month from statictext within w_calendar_1
integer x = 2139
integer y = 260
integer width = 402
integer height = 224
integer textsize = -48
integer weight = 700
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "華文行楷"
long textcolor = 128
long backcolor = 16777215
string text = "1"
alignment alignment = center!
boolean focusrectangle = false
end type
type ddlb_month from dropdownlistbox within w_calendar_1
integer x = 1600
integer y = 232
integer width = 283
integer height = 836
integer taborder = 10
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋體"
long textcolor = 33554432
long backcolor = 15780518
boolean sorted = false
string item[] = {"一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"}
borderstyle borderstyle = stylelowered!
end type
event constructor;
integer li_month
li_month = integer(string(today(), 'mm'))
this.Selectitem(li_month)
end event
event selectionchanged;
//詢問保存
wf_querysave()
dw_calendar.Event ue_set_calendar(ddlb_year.text, ddlb_month.text)
//模擬鼠標點擊當前選中的日期所在的文本控件,可以自動刷新與日期有關的事件處理
dw_calendar.Event ue_click(id_PriorObj)
end event
type st_nextmonth from statictext within w_calendar_1
integer x = 1161
integer y = 240
integer width = 73
integer height = 68
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋體"
long textcolor = 33554432
long backcolor = 12639424
string text = ">>"
boolean border = true
borderstyle borderstyle = styleraised!
boolean focusrectangle = false
end type
event clicked;
integer li_year, li_month
//詢問保存
wf_querysave()
li_year = integer(trim(ddlb_year.text))
if trim(ddlb_month.text) = '十二月' then
if li_year = 2050 then
messagebox('提示','已經到達年份上限!')
return
else
ddlb_year.text = string(li_year + 1)
ddlb_month.text = '一月'
end if
else
li_month = integer(wf_get_monthnum(trim(ddlb_month.text)))
ddlb_month.SelectItem(li_month + 1)
end if
ddlb_year.TriggerEvent ("Selectionchanged")
end event
type st_priormonth from statictext within w_calendar_1
integer x = 654
integer y = 240
integer width = 73
integer height = 68
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋體"
long textcolor = 33554432
long backcolor = 12639424
string text = "<<"
boolean border = true
borderstyle borderstyle = styleraised!
boolean focusrectangle = false
end type
event clicked;
integer li_year, li_month
//詢問保存
wf_querysave()
li_year = integer(trim(ddlb_year.text))
if trim(ddlb_month.text) = '一月' then
if li_year = 2000 then
messagebox('提示','已經到達年份下限!')
return
else
ddlb_year.text = string(li_year - 1)
ddlb_month.text = '十二月'
end if
else
li_month = integer(wf_get_monthnum(trim(ddlb_month.text)))
ddlb_month.SelectItem(li_month - 1)
end if
ddlb_year.TriggerEvent ("Selectionchanged")
end event
type ddlb_year from dropdownlistbox within w_calendar_1
integer x = 37
integer y = 228
integer width = 283
integer height = 644
integer taborder = 10
integer textsize = -9
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋體"
long textcolor = 33554432
long backcolor = 15780518
boolean sorted = false
boolean vscrollbar = true
string item[] = {"2000","2001","2002","2003","2004","2005","2006","2007","2008","2009","2010","2011","2012","2013","2014","2015","2016","2017","2018","2019","2020"}
borderstyle borderstyle = stylelowered!
end type
event constructor;
integer li_year
for li_year = 2000 to 2099
this.insertitem(string(li_year), li_year - 2000 + 1)
next
this.text = string(today(), 'yyyy')
end event
event selectionchanged;
ddlb_month.TriggerEvent("selectionchanged")
end event
type dw_calendar from datawindow within w_calendar_1
event ue_init ( )
event ue_set_calendar ( string as_year, string as_month )
event ue_clickday ( string as_date )
event ue_click ( any aa_dwo )
event ue_mousemove pbm_mousemove
integer x = 37
integer y = 224
integer width = 1829
integer height = 1056
integer taborder = 10
string title = "none"
string dataobject = "d_calendar"
boolean border = false
boolean livescroll = true
borderstyle borderstyle = stylelowered!
end type
event ue_init();
integer i
this.SetRedraw(false)
//數據窗體并無數據行,是由文本控件組成
this.InsertRow(0)
for i = 1 to 42
this.Modify("t_" + string(i) + ".text = ''")
next
this.SetRedraw(true)
end event
event ue_set_calendar(string as_year, string as_month);//功能:設置指定年月的日歷
//
string ls_date, ls_month, ls_day, ls_record
integer li_days, i, li_col
//☆★●
ls_month = wf_get_monthnum(as_month) //獲得月份(中文)的數字字符
li_days = wf_get_monthdays(as_year, ls_month) //某年某月有多少天
dw_calendar.TriggerEvent("ue_init")
//標題日期
dw_calendar.object.t_date.text = as_year + '年' + ls_month + '月'
//該月的第 1 號應放在數據窗體的第幾列
li_col = wf_get_weekdays(date(as_year + '/' + ls_month + '/01')) + 1
//求得第 1 號位于第幾列位置,然后每個文本控件(編號為t_1, t_2, t_3...)
//依次賦值即可
for i = 1 to li_days
ls_day = string(i, '00')
ls_date = as_year + '/' + ls_month + '/' + ls_day
ls_record = wf_get_thisdayrecord(ls_date)
if trim(ls_record) <> "" and (Not IsNull(ls_record)) then ls_day = ls_day + '~r~n ●'
dw_calendar.Modify("t_" + string(i + li_col - 1) + ".text = '" + ls_day + "'")
next
////提示今日時間
//if as_year = string(today(), 'yyyy') and as_month = string(today(), 'mm') then
//
//end if
//月份提示
st_month.text = string(integer(ls_month))
end event
event ue_clickday(string as_date);//========================================================
//功能:選中指定日期(模擬鼠標點擊效果)
//參數:無
//返回:無
//日期:2003.01.24
//========================================================
dwobject ld_day
integer li_weeknum, li_curday, li_days
//得到當日的數字
li_curday = integer(right(as_date, 2))
//獲得當月第 1 號為星期幾
li_weeknum = wf_get_weekdays(date(left(as_date, 8) + '/01'))
//確定應該選擇哪個文本控件為點擊對象
li_days = li_curday + li_weeknum
//
CHOOSE CASE li_days
CASE 1
ld_day = dw_calendar.object.t_1
CASE 2
ld_day = dw_calendar.object.t_2
CASE 3
ld_day = dw_calendar.object.t_3
CASE 4
ld_day = dw_calendar.object.t_4
CASE 5
ld_day = dw_calendar.object.t_5
CASE 6
ld_day = dw_calendar.object.t_6
CASE 7
ld_day = dw_calendar.object.t_7
CASE 8
ld_day = dw_calendar.object.t_8
CASE 9
ld_day = dw_calendar.object.t_9
CASE 10
ld_day = dw_calendar.object.t_10
CASE 11
ld_day = dw_calendar.object.t_11
CASE 12
ld_day = dw_calendar.object.t_12
CASE 13
ld_day = dw_calendar.object.t_13
CASE 14
ld_day = dw_calendar.object.t_14
CASE 15
ld_day = dw_calendar.object.t_15
CASE 16
ld_day = dw_calendar.object.t_16
CASE 17
ld_day = dw_calendar.object.t_17
CASE 18
ld_day = dw_calendar.object.t_18
CASE 19
ld_day = dw_calendar.object.t_19
CASE 20
ld_day = dw_calendar.object.t_20
CASE 21
ld_day = dw_calendar.object.t_21
CASE 22
ld_day = dw_calendar.object.t_22
CASE 23
ld_day = dw_calendar.object.t_23
CASE 24
ld_day = dw_calendar.object.t_24
CASE 25
ld_day = dw_calendar.object.t_25
CASE 26
ld_day = dw_calendar.object.t_26
CASE 27
ld_day = dw_calendar.object.t_27
CASE 28
ld_day = dw_calendar.object.t_28
CASE 29
ld_day = dw_calendar.object.t_29
CASE 30
ld_day = dw_calendar.object.t_30
CASE 31
ld_day = dw_calendar.object.t_31
CASE 32
ld_day = dw_calendar.object.t_32
CASE 33
ld_day = dw_calendar.object.t_33
CASE 34
ld_day = dw_calendar.object.t_34
CASE 35
ld_day = dw_calendar.object.t_35
CASE 36
ld_day = dw_calendar.object.t_36
CASE 37
ld_day = dw_calendar.object.t_37
END CHOOSE
this.Event ue_click(ld_day)
end event
event ue_click(any aa_dwo);
integer li_num
dwobject ld_dwo
ld_dwo = aa_dwo
//詢問保存
//wf_querysave()
this.SetRedraw(false)
if ld_dwo.type = "text" then
//恢復原來的屬性值
if IsValid(id_PriorObj) then
this.Modify(id_PriorObj.name + ".Background.Color='" + is_Ori_Color + "'")
this.Modify(id_PriorObj.name + ".Border='" + is_Ori_Border + "'")
end if
//保存當前點擊對象屬性值,以便下次恢復
id_PriorObj = ld_dwo
// is_Ori_Color = this.Describe(ld_dwo.name + ".Background.Color")
//================================================================
//此處處理由于[Clicked]和[ue_mousemove]交叉事件引起的沖突
li_num = integer(Mid(string(ld_dwo.name), 3, 2))
if of_checkweek(li_num) = 1 then
is_Ori_Color = is_GetBackColor0
else
is_Ori_Color = is_GetBackColor1
end if
is_Ori_MColor = is_MouseClickColor
//================================================================
is_Ori_Border = this.Describe(ld_dwo.name + ".Border")
//改變當前點擊對象的背景色,邊框,位置,大小
this.Modify(ld_dwo.name + ".Background.Color='" + is_MouseClickColor + "'")
this.Modify(ld_dwo.name + ".Border='5'")
end if
this.SetRedraw(true)
//===================================================================
//以下處理鼠標點擊獲取日期后的事務
if of_get_date('date') = 'Error' then
sle_date.text = '沒選中日期!'
mle_record.text = ''
mle_record.Enabled = false
else
sle_date.text = '日期:'+ of_get_date('date')
wf_read_record()
mle_record.Enabled = true
end if
end event
event ue_mousemove;
if ib_MoveIn = true then
mle_record.Backcolor = rgb(237,237,237)
mle_record.textcolor = rgb(26,39,54)
ib_MoveIn = false
end if
string ls_obj
ls_obj = Getobjectatpointer()
ls_obj = Left(ls_obj, pos(ls_obj, '~t') - 1)
if is_MPriorObj = ls_obj then return
//若鼠標移至當前點擊的日期對象,則返回
if this.Describe(ls_obj + ".Border") = '5' then
//恢復原來的背景色
if Trim(is_MPriorObj) <> '' then
this.Modify(is_MPriorObj + ".Background.Color='" + is_Ori_MColor + "'")
end if
SetNull(is_MPriorObj)
return
end if
if Pos(ls_obj, 't_') > 0 and IsNumber(Mid(ls_obj, 3, 1)) then
this.SetRedraw(false)
//恢復原來的背景色
if Trim(is_MPriorObj) <> '' then
this.Modify(is_MPriorObj + ".Background.Color='" + is_Ori_MColor + "'")
end if
//保存當前對象屬性值,以便下次恢復
is_MPriorObj = ls_obj
//============================================================
//此處處理由于[Clicked]和[ue_mousemove]交叉事件引起的沖突
if this.Describe(ls_obj + ".Border") = '0' then
is_Ori_MColor = this.Describe(ls_obj + ".Background.Color")
else
is_Ori_MColor = is_MouseClickColor
end if
//============================================================
//改變當前對象的背景色
this.Modify(ls_obj + ".Background.Color='" + is_MouseMouseColor + "'")
this.SetRedraw(true)
else
//恢復原來的背景色
if Trim(is_MPriorObj) <> '' then
this.Modify(is_MPriorObj + ".Background.Color='" + is_Ori_MColor + "'")
end if
SetNull(is_MPriorObj)
end if
end event
event clicked;
if row <= 0 then return
this.Event ue_click(dwo)
end event
event dberror;
return 1
end event
type rr_1 from roundrectangle within w_calendar_1
long linecolor = 33554432
integer linethickness = 4
long fillcolor = 16777215
integer x = 2085
integer y = 256
integer width = 521
integer height = 236
integer cornerheight = 40
integer cornerwidth = 46
end type
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -