?? w_calendar_1.srw
字號:
$PBExportHeader$w_calendar_1.srw
forward
global type w_calendar_1 from w_anc_xe
end type
type st_2 from statictext within w_calendar_1
end type
type uo_2 from uo_xp_button within w_calendar_1
end type
type uo_1 from uo_xp_button within w_calendar_1
end type
type mle_record from multilineedit within w_calendar_1
end type
type sle_date from singlelineedit within w_calendar_1
end type
type st_month from statictext within w_calendar_1
end type
type ddlb_month from dropdownlistbox within w_calendar_1
end type
type st_nextmonth from statictext within w_calendar_1
end type
type st_priormonth from statictext within w_calendar_1
end type
type ddlb_year from dropdownlistbox within w_calendar_1
end type
type dw_calendar from datawindow within w_calendar_1
end type
type rr_1 from roundrectangle within w_calendar_1
end type
end forward
global type w_calendar_1 from w_anc_xe
integer width = 2871
integer height = 1484
string title = "雯田日歷記事本 "
boolean maxbox = false
boolean resizable = false
long backcolor = 33026303
boolean center = true
st_2 st_2
uo_2 uo_2
uo_1 uo_1
mle_record mle_record
sle_date sle_date
st_month st_month
ddlb_month ddlb_month
st_nextmonth st_nextmonth
st_priormonth st_priormonth
ddlb_year ddlb_year
dw_calendar dw_calendar
rr_1 rr_1
end type
global w_calendar_1 w_calendar_1
type variables
Boolean ib_MoveIn
Public:
//星期六、星期日背景色 || 星期一至星期五的背景色
constant string is_GetBackColor0 = '15780518' //淺藍(lán)(15780518)
constant string is_GetBackColor1 = '15793151' //白色(1073741824)
//鼠標(biāo)點(diǎn)擊后的背景色,鼠標(biāo)移動時(shí)的背景色
constant string is_MouseClickColor = '2685455' //亮綠(2685455)
constant string is_MouseMouseColor = '12381951' //淡黃(12381951)
//淡藍(lán)(16576967),淺藍(lán)(15780518),粉紅(14869500)
//亮綠(2685455),淡黃(12381951),白色(1073741824)
Private:
//以下變量用于恢復(fù)點(diǎn)擊對象的原值
string is_MPriorObj //保存上次鼠標(biāo)經(jīng)過對象名
string is_Ori_MColor //保存上次鼠標(biāo)經(jīng)過對象的色彩值
string is_Ori_Color //保存上次點(diǎn)擊對象的色彩值
//string is_Ori_X, is_Ori_Y //保存上次點(diǎn)擊對象的X,Y坐標(biāo)
//string is_Ori_Width, is_Ori_Height //保存上次點(diǎn)擊對象的寬度,高度
string is_Ori_Border //保存上次點(diǎn)擊對象的邊框
dwobject id_PriorObj //保存上次點(diǎn)擊對象的名稱
end variables
forward prototypes
public function integer of_checkweek (integer ai_this)
public function string wf_get_monthnum (string as_month)
public function string of_get_date (string as_type)
public function string wf_get_cweekname (date as_date)
public function integer wf_get_monthdays (string as_year, string as_month)
public function string wf_get_thisdayrecord (string as_date)
public function integer wf_get_weekdays (date ad_date)
public subroutine wf_read_record ()
public function integer wf_querysave ()
end prototypes
public function integer of_checkweek (integer ai_this);//====================================================
//功能:判斷傳入的數(shù)字(代表數(shù)據(jù)窗體中一個文本控件)
// 是否位于對應(yīng)的星期六或星期日位置列
//參數(shù):數(shù)字
//返回: 1 表示是
// -1 表示否
//日期:
//修改:
//====================================================
CHOOSE CASE ai_this
CASE 1,7,8,14,15,21,22,28,29,35,36,42
return 1
CASE ELSE
return -1
END CHOOSE
return 1
end function
public function string wf_get_monthnum (string as_month);//===============================================
// 功能:返回指定月份的數(shù)字字符
// 參數(shù):as_month string型, 月份
// 返回:integer型,該年該月的數(shù)字字符
// 時(shí)間:2003.01.23
// 作者:相如飛
// 修改:
//===============================================
string ls_month
CHOOSE CASE as_month
CASE '一月'
ls_month = '01'
CASE '二月'
ls_month = '02'
CASE '三月'
ls_month = '03'
CASE '四月'
ls_month = '04'
CASE '五月'
ls_month = '05'
CASE '六月'
ls_month = '06'
CASE '七月'
ls_month = '07'
CASE '八月'
ls_month = '08'
CASE '九月'
ls_month = '09'
CASE '十月'
ls_month = '10'
CASE '十一月'
ls_month = '11'
CASE '十二月'
ls_month = '12'
CASE ELSE
MessageBox('錯誤', '不能識別的月份!')
return 'Error'
END CHOOSE
return ls_month
end function
public function string of_get_date (string as_type);//===================================================
//功能:獲取鼠標(biāo)點(diǎn)擊日期
//參數(shù):
//返回:string型,參數(shù)為 "year" 時(shí),返回yyyy
// 參數(shù)為 "month" 時(shí),返回mm
// 參數(shù)為 "day" 時(shí),返回dd
// 其他參數(shù)返回 yyyy/mm/dd
//日期:
//作者:
//修改:
//===================================================
string ls_year, ls_month, ls_date, ls_day
if Not IsValid(id_PriorObj) then return 'Error'
ls_day = trim(dw_calendar.Describe(id_PriorObj.name + ".Text"))
//點(diǎn)擊處為空
if IsNull(ls_day) or trim(ls_day) = '' then return 'Error'
if IsNumber(left(ls_day, 1)) then
ls_day = Left(ls_day, 2)
else
ls_day = Mid(ls_day, 2, 2)
end if
ls_year = left(dw_calendar.object.t_date.text, 4)
ls_month = wf_get_monthnum(ddlb_month.text)
ls_date = ls_year + '/' + ls_month + '/' + ls_day
CHOOSE CASE lower(as_type)
CASE 'year'
return ls_year
CASE 'month'
return ls_month
CASE 'day'
return ls_day
CASE ELSE
return ls_date
END CHOOSE
return ls_date
end function
public function string wf_get_cweekname (date as_date);//========================================
//功能:獲得星期幾
//參數(shù):DATE型,日期格式字符串
//返回:STRING型,星期一-----星期日的中文字符串
//日期:2003.01.24
//
//========================================
string ls_cweekname
CHOOSE CASE lower(dayname(as_date))
CASE 'sunday'
ls_cweekname = '星期日'
CASE 'monday'
ls_cweekname = '星期一'
CASE 'tuesday'
ls_cweekname = '星期二'
CASE 'wednesday'
ls_cweekname = '星期三'
CASE 'thursday'
ls_cweekname = '星期四'
CASE 'friday'
ls_cweekname = '星期五'
CASE 'saturday'
ls_cweekname = '星期六'
END CHOOSE
return ls_cweekname
end function
public function integer wf_get_monthdays (string as_year, string as_month);//===============================================
// 功能:返回指定年月的天數(shù)
// 參數(shù):as_year string型, 年份
// as_month string型, 月份
// 返回:integer型,該年該月的天數(shù)
// 時(shí)間:2003.01.23
// 作者:相如飛
// 修改:
//===============================================
string ls_year, ls_month
integer li_days
date ld_date1, ld_date2
ls_year = as_year
ls_month = as_month
ld_date1 = date(ls_year + '/' + ls_month + '/01')
if ls_month = '12' then
ld_date2 = date(string(integer(ls_year) + 1) + '/01/01')
else
ld_date2 = date(ls_year + '/' + string(integer(ls_month) + 1) + '/01')
end if
li_days = DaysAfter(ld_date1, ld_date2)
return li_days
end function
public function string wf_get_thisdayrecord (string as_date);//===============================================
//功能:讀取選取月日的記錄信息
//參數(shù):年,月,日
//返回:Integer 型. 1 表示有記錄, 0 表示沒有記錄
//日期:2003.01.25
//===============================================
string ls_data
ls_data = ProfileString("calendar.INI", "RECORD", as_date, "")
return ls_data
end function
public function integer wf_get_weekdays (date ad_date);//=========================================
//功能:獲得指定日期為星期幾
//參數(shù):ad_date date型
//返回:星期的數(shù)字.0--星期日
// 1--星期一
// 2--星期二
// 3--星期三
// 4--星期四
// 5--星期五
// 6--星期六
//作者:
//日期:
//修改:
//=========================================
integer li_weekdays
// 1980/01/06為星期日
li_weekdays = DaysAfter(date('1980/01/06'), ad_date)
li_weekdays = Mod(li_weekdays, 7)
return li_weekdays
end function
public subroutine wf_read_record ();////將鼠標(biāo)點(diǎn)擊日期的記事內(nèi)容(如果有的話)讀取到mle_record中
string ls_date, ls_record
ls_date = of_get_date('date') //獲取鼠標(biāo)點(diǎn)擊處日期
ls_record = wf_get_thisdayrecord(ls_date)
mle_record.text = ls_record
end subroutine
public function integer wf_querysave ();if uo_1.Enabled = true then
if MessageBox('提示','修改內(nèi)容未保存!需要保存嗎?', question!, yesno!, 1) = 1 then
uo_1.TriggerEvent(clicked!)
return 1
else
uo_1.Enabled = false
return -1
end if
end if
return 1
end function
event mousemove;call super::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
dw_calendar.Modify(is_MPriorObj + ".Background.Color='" + is_Ori_MColor + "'")
SetNull(is_MPriorObj)
end event
event open;call super::open;uo_1.of_setdefault(true) //Default 按鈕
uo_1.of_setcaption('保 存')
uo_2.of_setcaption('關(guān) 閉')
uo_2.of_setdefault(true) //Default 按鈕
//gs_SkinTopic = "woodskin"
w_calendar_1.wf_destroyDC()
w_calendar_1.wf_init_draw()
dw_calendar.settransobject(sqlca)
timer(1)
dw_calendar.object.t_date.text = string(today(), 'yyyy年mm月')
//設(shè)置當(dāng)月日歷
dw_calendar.Event ue_set_calendar(ddlb_year.text, ddlb_month.text)
//打開窗體,自動設(shè)置當(dāng)日為點(diǎn)中狀態(tài)
dw_calendar.Event ue_clickday(string(today(), 'yyyy/mm/dd'))
uo_1.Enabled = FALSE
end event
event timer;call super::timer;dw_calendar.object.t_time.text = string(now())
end event
on w_calendar_1.create
int iCurrent
call super::create
this.st_2=create st_2
this.uo_2=create uo_2
this.uo_1=create uo_1
this.mle_record=create mle_record
this.sle_date=create sle_date
this.st_month=create st_month
this.ddlb_month=create ddlb_month
this.st_nextmonth=create st_nextmonth
this.st_priormonth=create st_priormonth
this.ddlb_year=create ddlb_year
this.dw_calendar=create dw_calendar
this.rr_1=create rr_1
iCurrent=UpperBound(this.Control)
this.Control[iCurrent+1]=this.st_2
this.Control[iCurrent+2]=this.uo_2
this.Control[iCurrent+3]=this.uo_1
this.Control[iCurrent+4]=this.mle_record
this.Control[iCurrent+5]=this.sle_date
this.Control[iCurrent+6]=this.st_month
this.Control[iCurrent+7]=this.ddlb_month
this.Control[iCurrent+8]=this.st_nextmonth
this.Control[iCurrent+9]=this.st_priormonth
this.Control[iCurrent+10]=this.ddlb_year
this.Control[iCurrent+11]=this.dw_calendar
this.Control[iCurrent+12]=this.rr_1
end on
on w_calendar_1.destroy
call super::destroy
destroy(this.st_2)
destroy(this.uo_2)
destroy(this.uo_1)
destroy(this.mle_record)
destroy(this.sle_date)
destroy(this.st_month)
destroy(this.ddlb_month)
destroy(this.st_nextmonth)
destroy(this.st_priormonth)
destroy(this.ddlb_year)
destroy(this.dw_calendar)
destroy(this.rr_1)
end on
event resize;call super::resize;//打開窗體,自動設(shè)置當(dāng)日為點(diǎn)中狀態(tài)
//dw_calendar.Event ue_clickday(string(today(), 'yyyy/mm/dd'))
end event
type st_2 from statictext within w_calendar_1
integer x = 731
integer y = 64
integer width = 1280
integer height = 128
integer textsize = -20
integer weight = 700
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = fixed!
fontfamily fontfamily = modern!
string facename = "楷體_GB2312"
long textcolor = 29625298
long backcolor = 33026303
boolean enabled = false
string text = "日 歷 記 事 本"
alignment alignment = center!
borderstyle borderstyle = styleraised!
boolean focusrectangle = false
end type
type uo_2 from uo_xp_button within w_calendar_1
integer x = 2414
integer y = 1216
integer taborder = 80
boolean border = false
long backcolor = 33026303
end type
on uo_2.destroy
call uo_xp_button::destroy
end on
event ue_clicked();call super::ue_clicked;string ls_date, ls_data
//詢問保存
//wf_querysave()
if uo_1.Enabled = true then
if MessageBox('提示','修改內(nèi)容未保存!需要保存嗎?', question!, yesno!, 1) = 1 then
ls_date = trim(sle_date.text)
if ls_date = '' or ls_date = '沒選中日期!' then return
ls_date = right(ls_date, 10)
ls_data = mle_record.text
if trim(ls_data) = '' then
SetProfileString("calendar.INI", "RECORD", ls_date, '')
else
SetProfileString("calendar.INI", "RECORD", ls_date, ls_data)
end if
this.Enabled = false
if uo_1.Enabled = false then
// if MessageBox('提示','修改內(nèi)容未保存!需要保存嗎?', question!, yesno!, 1) = -1 then
close(parent)
end if
end if
end if
//end if
close(parent)
end event
type uo_1 from uo_xp_button within w_calendar_1
integer x = 2011
integer y = 1216
integer taborder = 70
boolean border = false
end type
on uo_1.destroy
call uo_xp_button::destroy
end on
event ue_clicked();call super::ue_clicked;string ls_date, ls_data
ls_date = trim(sle_date.text)
if ls_date = '' or ls_date = '沒選中日期!' then return
ls_date = right(ls_date, 10)
ls_data = mle_record.text
if trim(ls_data) = '' then
SetProfileString("calendar.INI", "RECORD", ls_date, '')
else
SetProfileString("calendar.INI", "RECORD", ls_date, ls_data)
end if
this.Enabled = false
//刷新日歷數(shù)據(jù)窗口
dw_calendar.Event ue_set_calendar(ddlb_year.text, ddlb_month.text)
end event
type mle_record from multilineedit within w_calendar_1
event ue_mousemove pbm_mousemove
event ue_enchange pbm_enchange
integer x = 1902
integer y = 576
integer width = 914
integer height = 608
integer taborder = 30
boolean bringtotop = true
integer textsize = -12
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋體"
long textcolor = 33026303
long backcolor = 33026303
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -