⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 w_calendar_1.srw

📁 一个用PB作的小系统,欢迎大家点击看看, 如果连接不好请与QQ:4219391410联系
💻 SRW
📖 第 1 页 / 共 2 页
字号:
$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'   //浅蓝(15780518)
constant string is_GetBackColor1 = '15793151' //白色(1073741824)
//鼠标点击后的背景色,鼠标移动时的背景色
constant string is_MouseClickColor = '2685455'  //亮绿(2685455)
constant string is_MouseMouseColor = '12381951' //淡黄(12381951)
//淡蓝(16576967),浅蓝(15780518),粉红(14869500)
//亮绿(2685455),淡黄(12381951),白色(1073741824)

Private:
//以下变量用于恢复点击对象的原值
string   is_MPriorObj  //保存上次鼠标经过对象名
string   is_Ori_MColor //保存上次鼠标经过对象的色彩值
string   is_Ori_Color  //保存上次点击对象的色彩值
//string   is_Ori_X, is_Ori_Y //保存上次点击对象的X,Y坐标
//string   is_Ori_Width, is_Ori_Height //保存上次点击对象的宽度,高度
string   is_Ori_Border //保存上次点击对象的边框
dwobject id_PriorObj   //保存上次点击对象的名称
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);//====================================================
//功能:判断传入的数字(代表数据窗体中一个文本控件)
//      是否位于对应的星期六或星期日位置列
//参数:数字
//返回: 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);//===============================================
// 功能:返回指定月份的数字字符
// 参数:as_month string型, 月份
// 返回:integer型,该年该月的数字字符
// 时间: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);//===================================================
//功能:获取鼠标点击日期
//参数:
//返回:string型,参数为 "year"  时,返回yyyy
//                参数为 "month" 时,返回mm
//                参数为 "day"   时,返回dd
//                其他参数返回 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"))
//点击处为空
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);//========================================
//功能:获得星期几
//参数: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);//===============================================
// 功能:返回指定年月的天数
// 参数:as_year  string型, 年份
//      as_month string型, 月份
// 返回:integer型,该年该月的天数
// 时间: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);//===============================================
//功能:读取选取月日的记录信息
//参数:年,月,日
//返回: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);//=========================================
//功能:获得指定日期为星期几
//参数:ad_date date型
//返回:星期的数字.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 ();////将鼠标点击日期的记事内容(如果有的话)读取到mle_record中

string ls_date, ls_record

ls_date = of_get_date('date') //获取鼠标点击处日期

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('提示','修改内容未保存!需要保存吗?', 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('关  闭')
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月')
//设置当月日历
dw_calendar.Event ue_set_calendar(ddlb_year.text, ddlb_month.text)
//打开窗体,自动设置当日为点中状态
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;//打开窗体,自动设置当日为点中状态
//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('提示','修改内容未保存!需要保存吗?', 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('提示','修改内容未保存!需要保存吗?', 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
//刷新日历数据窗口
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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -