pb9 日历控件(源码)

PowerBuilder 专栏收录该内容
66 篇文章 8 订阅

一、效果图:

X【关闭日历】 、<【上一月份】、>【下一月份】、≤ 【上一年】、≥ 【下一年】、今天:2020/10/20 【 显示今天日期 】

二、使用方法:

1).vo_calendar对象放到需要显示的窗口上

2).获取vo_calendar对象日期:控件名称.text

3).如被其它控件遮住;可以在窗体open事件种使用 控件名称.setposition(ToTop!) 使日历显示在最上层

三、源码贡献

1).创建Custom Visual对象,命名为vo_calendar

2).源码

forward
global type vo_calendar from userobject
end type
type st_1 from statictext within vo_calendar
end type
type dw_1 from datawindow within vo_calendar
end type
type st_2 from statictext within vo_calendar
end type
type em_date from editmask within vo_calendar
end type
end forward

global type vo_calendar from userobject
integer width = 995
integer height = 1053
long backcolor = 16777215
string text = "none"
long tabtextcolor = 33554432
long picturemaskcolor = 536870912
st_1 st_1
dw_1 dw_1
st_2 st_2
em_date em_date
end type
global vo_calendar vo_calendar

type variables
long il_headerColor = rgb(84,110,122),il_Color = rgb(166,166,166)
int ii_Days[12] 

string is_arrDdate[6,7],is_arrNull[6,7]
string is_modifyLeft,is_modifyRight
boolean ib_bool = false
long il_DWHeight
end variables

forward prototypes
public subroutine of_draw_day (integer ai_year, integer ai_month)
public subroutine of_set_ii_days (integer ai_year)
public subroutine of_selected_day ()
public subroutine of_visible (boolean ab_bool)
end prototypes

public subroutine of_draw_day (integer ai_year, integer ai_month);//==================
//绘制日历,同时表格日期存储数组
//===================
int li_insertrow,li_for,li_weet,li_for2,li_for3
int li_number,li_val = 0,li_w,li_mod,ll_row,li_month,li_year
string ls_value,ls_ifCon
string ls_ifCon1='', ls_ifCon2='', ls_ifCon3='', ls_ifCon4='', ls_ifCon5='', ls_ifCon6='', ls_ifCon7=''
//long ll_arrVlaueR[]
string ls_arrVlaue[],ls_Null[]
any lany_arrVlaueR[]
date ldt_date


of_set_ii_days(ai_year)

is_arrDdate = is_arrNull

dw_1.reset( )

for li_for = 1 to 6
	dw_1.insertrow(0)
	lany_arrVlaueR[li_for] = ls_Null
next

ldt_date = date(string(ai_year)+'-'+string(ai_month)+'-01')
dw_1.object.ldate[1] = ldt_date
dw_1.object.t_years.text =string(ldt_date,'yyyy年mm月')

li_insertrow = 1
for li_for = 1 to ii_Days[ai_month]
	li_weet = daynumber(date(string(ai_year)+'-'+string(ai_month)+'-'+string(li_for)+''))
	if li_weet = 1 then 
		li_weet = 7
	else
		li_weet = li_weet -1
		if li_weet = 1 and li_for <> 1 then li_insertrow  = li_insertrow + 1
	end if 
	dw_1.setitem(li_insertrow,'d_'+string(li_weet), string(li_for))
	is_arrDdate[li_insertrow ,li_weet] = string(date(string(ai_year)+'-'+string(ai_month)+'-'+string(li_for)),'yyyy-mm-dd')

	//显示当前月份上月和下月日期
	if li_for = 1 then
		for li_for2 = li_weet -1 to 1 step -1
			if ai_month -1 <=0 then
				li_month = 12
				li_year = ai_year -1
			else
				li_year = ai_year
				li_month = ai_month -1
			end if			
			ls_value = string(ii_Days[li_month] -(li_weet - li_for2 - 1))
			dw_1.setitem(li_insertrow,'d_'+string(li_for2), ls_value)
			is_arrDdate[li_insertrow ,li_for2] = string(date(string(li_year)+'-'+string(li_month)+'-'+ls_value),'yyyy-mm-dd')	
			ls_arrVlaue[upperbound(ls_arrVlaue) + 1] = ls_value
		next
		lany_arrVlaueR[li_insertrow] = ls_arrVlaue
	elseif ii_Days[ai_month] = li_for then
		ls_value = '0'
		ls_arrVlaue = ls_Null
		
		if li_weet = 6 then //
			li_number = (li_insertrow ) * 7 
		else
			li_number = (li_insertrow ) * 7 -(6 -li_weet)
		end if

		for li_for2 = li_number to 42
			ls_value = string(long(ls_value) + 1)
			li_mod = mod(li_for2,7)
			ll_row = int(long(li_for2)/7)  

			if li_mod = 0 then 
				li_mod = 7
			else
				ll_row  = ll_row + 1
			end if
			
			//if ll_row = 6 then ls_arrVlaue = ls_Null
			
			if ai_month + 1 > 12 then
				li_month =1 
				li_year = ai_year +1
			else
				li_year = ai_year
				li_month = ai_month + 1
			end if
			
			dw_1.setitem(ll_row,'d_'+string(li_mod), ls_value)
			is_arrDdate[ll_row,li_mod] = string(date(string(li_year)+'-'+string(li_month)+'-'+string(ls_value)),'yyyy-mm-dd')
			
			ls_arrVlaue[upperbound(ls_arrVlaue) + 1] = ls_value
			lany_arrVlaueR[ll_row] = ls_arrVlaue
		next
	end if
next



//拼接dw表达式
for li_for = 1 to  upperbound(lany_arrVlaueR) 
	ls_arrVlaue = lany_arrVlaueR[li_for]
	if upperbound(ls_arrVlaue) > 0 then
		for li_for3 = 1 to  7
			ls_ifCon = ''
			for li_for2 = 1 to  upperbound(ls_arrVlaue) 
				ls_value = ls_arrVlaue[li_for2]
				if ls_ifCon = '' then
					ls_ifCon = "(d_"+string(li_for3)+" = '"+ls_value+"'"
				else
					ls_ifCon = ls_ifCon + "or d_"+string(li_for3)+" = '"+ls_value+"'"
				end if
			next
			
			if ls_ifCon <> '' then 
				ls_ifCon = ls_ifCon + ') and (getrow()='+string(li_for)+')'
				if li_for3 = 1 then
					if ls_ifCon1 = '' then
						 ls_ifCon1= "("+ls_ifCon
					else
						ls_ifCon1 =ls_ifCon1 + " or ("+ls_ifCon
					end if
					ls_ifCon1 = ls_ifCon1+")"
					
				elseif li_for3 = 2 then
					if ls_ifCon2 = '' then
						 ls_ifCon2= "("+ls_ifCon
					else
						ls_ifCon2 =ls_ifCon2 + " or ("+ls_ifCon
					end if
					ls_ifCon2 = ls_ifCon2+")"
					
				elseif li_for3 = 3 then
					if ls_ifCon3 = '' then
						 ls_ifCon3= "("+ls_ifCon
					else
						ls_ifCon3 =ls_ifCon3 + " or ("+ls_ifCon
					end if
					ls_ifCon3 = ls_ifCon3+")"
					
				elseif li_for3 = 4 then
					if ls_ifCon4 = '' then
						 ls_ifCon4= "("+ls_ifCon
					else
						ls_ifCon4 =ls_ifCon4 + " or ("+ls_ifCon
					end if
					ls_ifCon4 = ls_ifCon4+")"
				elseif li_for3 = 5 then
					if ls_ifCon5 = '' then
						 ls_ifCon5= "("+ls_ifCon
					else
						ls_ifCon5 =ls_ifCon5 + " or ("+ls_ifCon
					end if
					ls_ifCon5 = ls_ifCon5+")"
				elseif li_for3 = 6 then
					if ls_ifCon6 = '' then
						 ls_ifCon6= "("+ls_ifCon
					else
						ls_ifCon6 =ls_ifCon6 + " or ("+ls_ifCon
					end if
					ls_ifCon6 = ls_ifCon6+")"
				elseif li_for3 = 7 then
					if ls_ifCon7 = '' then
						 ls_ifCon7= "("+ls_ifCon
					else
						ls_ifCon7 =ls_ifCon7 + " or ("+ls_ifCon
					end if
					ls_ifCon7 = ls_ifCon7+")"
				end if
			end if
		next
	end if
next

dw_1.modify("d_"+string(1)+".color =~"0~tif("+ls_ifCon1+" ,"+string(il_Color)+",0)~"")
dw_1.modify("d_"+string(2)+".color =~"0~tif("+ls_ifCon2+" ,"+string(il_Color)+",0)~"")
dw_1.modify("d_"+string(3)+".color =~"0~tif("+ls_ifCon3+" ,"+string(il_Color)+",0)~"")
dw_1.modify("d_"+string(4)+".color =~"0~tif("+ls_ifCon4+" ,"+string(il_Color)+",0)~"")
dw_1.modify("d_"+string(5)+".color =~"0~tif("+ls_ifCon5+" ,"+string(il_Color)+",0)~"")
dw_1.modify("d_"+string(6)+".color =~"0~tif("+ls_ifCon6+" ,"+string(il_Color)+",0)~"")
dw_1.modify("d_"+string(7)+".color =~"0~tif("+ls_ifCon7+" ,"+string(il_Color)+",0)~"")

//messagebox("",dw_1.Describe("datawindow.syntax"))


end subroutine

public subroutine of_set_ii_days (integer ai_year);//==================================
//当前年份,每月天数
//=========================
ii_Days = {31,28,31,30,31,30,31,31,30,31,30,31}

If ( (Mod(ai_year,4) = 0 And Mod(ai_year,100) <> 0) Or (Mod(ai_year,400) = 0) ) Then
	ii_Days[2] = 29
End If

end subroutine

public subroutine of_selected_day ();//========================================
//文本框日期day,默认背景色
//==============================
int li_years,li_month,li_day
date ldt_date
int li_for ,li_for2

ldt_date = date(em_date.text)
if ldt_date <> date('1900-01-01') then
	for li_for =1 to 7
		dw_1.modify("d_"+string(li_for)+".background.color =536870912")
	next
	
	for li_for =1 to 6
		for li_for2 = 1 to 7
			if is_arrDdate[li_for,li_for2] = string(ldt_date,'yyyy-mm-dd') then
				li_day = day(ldt_date)
				//	messagebox("","d_"+string(li_for2)+".background.color =~"0~tif(d_"+string(li_for2)+"='"+string(li_day)+"' and getrow() = "+string(li_for + 1)+" and '"+string(ldt_date)+"' = '"+string(ldt_date)+"',"+string(il_headerColor)+",536870912)~"")
				
				dw_1.modify("d_"+string(li_for2)+".background.color =~"0~tif(d_"+string(li_for2)+"='"+string(li_day)+"' and getrow() = "+string(li_for)+" and '"+string(ldt_date)+"' = '"+string(ldt_date)+"',"+string(il_headerColor)+",536870912)~"")
			end if
		next
	next
end if

	


end subroutine

public subroutine of_visible (boolean ab_bool);//======================
//显示,隐藏日历;
//显示:日历上默认文本框日期day背景色,使用文本框日期绘制日历
//隐藏:重置border属性
//====================
date ldt_date
int li_year,li_month,li_for

if ab_bool then
	this.height = il_DWHeight
	ldt_date = date(em_date.text)
	if ldt_date <> date('1900-01-01') then
		li_year = year(ldt_date)
		li_month = month(ldt_date)
		of_draw_day(li_year,li_month)
		of_selected_day()
	end if
	ib_bool = true
	this.width = dw_1.width 
else
	for li_for = 1 to 7 //重置背景
		dw_1.modify("d_"+string(li_for)+".border ='0'")	
	next
	dw_1.modify("t_close.color ='0'")	
	ib_bool = false
	this.height = em_date.height 
	this.width = em_date.width 
end if

dw_1.x = 0
dw_1.y = em_date.y + em_date.height 
end subroutine

on vo_calendar.create
this.st_1=create st_1
this.dw_1=create dw_1
this.st_2=create st_2
this.em_date=create em_date
this.Control[]={this.st_1,&
this.dw_1,&
this.st_2,&
this.em_date}
end on

on vo_calendar.destroy
destroy(this.st_1)
destroy(this.dw_1)
destroy(this.st_2)
destroy(this.em_date)
end on

event constructor;string ls_syanx


ls_syanx = 'release 9;&
datawindow(units=0 timer_interval=0 color=1073741824 processing=0 HTMLDW=no print.printername="" print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 96 print.margin.bottom = 96 print.paper.source = 0 print.paper.size = 0 print.canusedefaultprinter=yes print.prompt=no print.buttons=no print.preview.buttons=no print.cliptext=no print.overrideprintjob=no print.collate=yes hidegrayline=no )&
header(height=282 color="536870912" )&
summary(height=90 color="536870912" )&
footer(height=0 color="536870912" )&
detail(height=86 color="536870912" )&
table(column=(type=char(10) updatewhereclause=no name=d_2 dbname="a" )&
 column=(type=char(10) updatewhereclause=no name=d_3 dbname="b" )&
 column=(type=char(10) updatewhereclause=no name=d_4 dbname="c" )&
 column=(type=char(10) updatewhereclause=no name=d_5 dbname="d" )&
 column=(type=char(10) updatewhereclause=no name=d_6 dbname="e" )&
 column=(type=char(10) updatewhereclause=no name=d_7 dbname="f" )&
 column=(type=char(10) updatewhereclause=no name=d_1 dbname="g" )&
 column=(type=char(255) updatewhereclause=no name=posmsg dbname="name_1")&
 column=(type=date updatewhereclause=no name=ldate dbname="name_2" )&
 )&
rectangle(band=header x="0" y="0" height="198" width="1719"  name=r_backcolor visible="1" brush.hatch="6" brush.color="134217731" pen.style="5" pen.width="4" pen.color="1073741824"  background.mode="2" background.color="33554432" )&
column(band=header id=9 alignment="0" tabsequence=32766 border="0" color="33554432" x="0" y="0" height="77" width="571" format="[general]" html.valueishtml="0"  name=ldate visible="0" edit.limit=0 edit.case=any edit.autoselect=yes edit.imemode=0  font.face="宋体" font.height="-8" font.weight="400"  font.family="2" font.pitch="2" font.charset="134" background.mode="2" background.color="1073741824" )&
text(band=header alignment="2" text=">" border="0" color="33554432" x="750" y="26" height="125" width="99" html.valueishtml="0"  name=t_right visible="1"  font.face="微软雅黑" font.height="-18" font.weight="400"  font.family="2" font.pitch="2" font.charset="134" background.mode="2" background.color="1073741824" ) &
text(band=header alignment="2" text="≥" border="0" color="33554432" x="856" y="26" height="125" width="99" html.valueishtml="0"  name=t_1 visible="1"  font.face="微软雅黑" font.height="-18" font.weight="400"  font.family="2" font.pitch="2" font.charset="134" background.mode="2" background.color="1073741824" ) &
text(band=header alignment="2" text="≤" border="0" color="33554432" x="15" y="26" height="125" width="99" html.valueishtml="0"  name=t_2 visible="1"  font.face="微软雅黑" font.height="-18" font.weight="400"  font.family="2" font.pitch="2" font.charset="134" background.mode="2" background.color="1073741824" ) &
text(band=header alignment="2" text="<" border="0" color="33554432" x="11" y="26" height="125" width="121" html.valueishtml="0"  name=t_left visible="1"  font.face="微软雅黑" font.height="-18" font.weight="400"  font.family="2" font.pitch="2" font.charset="134" background.mode="2" background.color="1073741824" )&
text(band=header alignment="2" text="2020年10月" border="0" color="33554432" x="252" y="54" height="86" width="475" html.valueishtml="0"  name=t_years visible="1"  font.face="微软雅黑" font.height="-12" font.weight="400"  font.family="2" font.pitch="2" font.charset="134" background.mode="2" background.color="1073741824" )&
text(band=header alignment="2" text="一" border="0" color="33554432" x="22" y="208" height="64" width="121" html.valueishtml="0"  name=w_1 visible="1"  font.face="微软雅黑" font.height="-9" font.weight="400"  font.family="2" font.pitch="2" font.charset="134" background.mode="2" background.color="1073741824" )&
text(band=header alignment="2" text="二" border="0" color="33554432" x="157" y="208" height="64" width="121" html.valueishtml="0"  name=w_2 visible="1"  font.face="微软雅黑" font.height="-9" font.weight="400"  font.family="2" font.pitch="2" font.charset="134" background.mode="2" background.color="1073741824" )&
text(band=header alignment="2" text="三" border="0" color="33554432" x="293" y="208" height="64" width="121" html.valueishtml="0"  name=w_3 visible="1"  font.face="微软雅黑" font.height="-9" font.weight="400"  font.family="2" font.pitch="2" font.charset="134" background.mode="2" background.color="1073741824" )&
text(band=header alignment="2" text="四" border="0" color="33554432" x="428" y="208" height="64" width="121" html.valueishtml="0"  name=w_4 visible="1"  font.face="微软雅黑" font.height="-9" font.weight="400"  font.family="2" font.pitch="2" font.charset="134" background.mode="2" background.color="1073741824" )&
text(band=header alignment="2" text="五" border="0" color="33554432" x="563" y="208" height="64" width="121" html.valueishtml="0"  name=w_5 visible="1"  font.face="微软雅黑" font.height="-9" font.weight="400"  font.family="2" font.pitch="2" font.charset="134" background.mode="2" background.color="1073741824" )&
text(band=header alignment="2" text="六" border="0" color="33554432" x="699" y="208" height="64" width="121" html.valueishtml="0"  name=w_6 visible="1"  font.face="微软雅黑" font.height="-9" font.weight="400"  font.family="2" font.pitch="2" font.charset="134" background.mode="2" background.color="1073741824" )&
text(band=header alignment="2" text="日" border="0" color="33554432" x="834" y="208" height="64" width="121" html.valueishtml="0"  name=w_7 visible="1"  font.face="微软雅黑" font.height="-9" font.weight="400"  font.family="2" font.pitch="2" font.charset="134" background.mode="2" background.color="1073741824" )&
column(band=detail id=2 alignment="2" tabsequence=32766 border="0" color="33554432" x="293" y="3" height="77" width="121" format="[general]" html.valueishtml="0"  name=d_3 visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0  font.face="微软雅黑" font.height="-9" font.weight="400"  font.family="2" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )&
column(band=detail id=3 alignment="2" tabsequence=32766 border="0" color="33554432" x="428" y="3" height="77" width="121" format="[general]" html.valueishtml="0"  name=d_4 visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0  font.face="微软雅黑" font.height="-9" font.weight="400"  font.family="2" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )&
column(band=detail id=4 alignment="2" tabsequence=32766 border="0" color="33554432" x="563" y="3" height="77" width="121" format="[general]" html.valueishtml="0"  name=d_5 visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0  font.face="微软雅黑" font.height="-9" font.weight="400"  font.family="2" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )&
column(band=detail id=5 alignment="2" tabsequence=32766 border="0" color="33554432" x="699" y="3" height="77" width="121" format="[general]" html.valueishtml="0"  name=d_6 visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0  font.face="微软雅黑" font.height="-9" font.weight="400"  font.family="2" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )&
column(band=detail id=6 alignment="2" tabsequence=32766 border="0" color="33554432" x="830" y="3" height="77" width="124" format="[general]" html.valueishtml="0"  name=d_7 visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0  font.face="微软雅黑" font.height="-9" font.weight="400"  font.family="2" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )&
column(band=detail id=7 alignment="2" tabsequence=32766 border="0" color="33554432" x="22" y="3" height="77" width="121" format="[general]" html.valueishtml="0"  name=d_1 visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0  font.face="微软雅黑" font.height="-9" font.weight="400"  font.family="2" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )&
column(band=detail id=1 alignment="2" tabsequence=32766 border="0" color="33554432" x="157" y="3" height="77" width="121" format="[general]" html.valueishtml="0"  name=d_2 visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0  font.face="微软雅黑" font.height="-9" font.weight="400"  font.family="2" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )&
compute(band=summary alignment="0" expression="date(today())"border="0" color="33554432" x="395" y="19" height="64" width="421" format="[General]" html.valueishtml="0"  name=today visible="1"  font.face="微软雅黑" font.height="-9" font.weight="700"  font.family="2" font.pitch="2" font.charset="134" background.mode="2" background.color="1073741824" )&
text(band=summary alignment="1" text="今天:" border="0" color="33554432" x="223" y="19" height="64" width="165" html.valueishtml="0"  name=t_11 visible="1"  font.face="微软雅黑" font.height="-9" font.weight="700"  font.family="2" font.pitch="2" font.charset="134" background.mode="2" background.color="1073741824" )&
text(band=summary alignment="2" text="×" border="0" color="33554432" x="830" y="3" height="74" width="124" html.valueishtml="0"  name=t_close visible="1"  font.face="Arial" font.height="-16" font.weight="400"  font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="1073741824" )&
column(band=header id=8 alignment="0" tabsequence=32766 border="0" color="33554432" x="1017" y="67" height="64" width="260" format="[general]" html.valueishtml="0"  name=posmsg visible="1" ddlb.limit=0 ddlb.allowedit=no ddlb.case=any ddlb.imemode=0  font.face="微软雅黑" font.height="-9" font.weight="400"  font.family="2" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )&
htmltable(border="1" )&
htmlgen(clientevents="1" clientvalidation="1" clientcomputedfields="1" clientformatting="0" clientscriptable="0" generatejavascript="1" encodeselflinkargs="1" netscapelayers="0" )&
export.xml(headgroups="1" includewhitespace="0" metadatatype=0 savemetadata=0 )&
import.xml()&
export.pdf(method=0 distill.custompostscript="0" xslfop.print="0" )&
'
dw_1.Create(ls_syanx)
 
string ls_date
date ld_date
int li_year,li_month

ld_date =today()//dw_1.getitemdate(1, 'ld_date')
li_year = year(ld_date)
li_month = month(ld_date)
ls_date = string(ld_date,'yyyy年mm')

dw_1.modify("t_years.text = "+ls_date+"")	
dw_1.modify("t_years.Background.Mode = 1")	
dw_1.modify("t_left.Background.Mode = 1")	
dw_1.modify("t_1.Background.Mode = 1")	
dw_1.modify("t_2.Background.Mode = 1")	
dw_1.modify("t_right.Background.Mode = 1")	
dw_1.modify("t_years.color = '16777215'")	
dw_1.modify("t_1.color = '16777215'")	
dw_1.modify("t_2.color = '16777215'")	
dw_1.modify("t_left.color = '16777215'")	
dw_1.modify("t_right.color = '16777215'")	
dw_1.modify("r_backcolor.brush.color ='"+string(il_headerColor)+"'")

dw_1.modify("d_1.Background.Mode = 2")	
dw_1.modify("d_2.Background.Mode = 2")	
dw_1.modify("d_3.Background.Mode = 2")	
dw_1.modify("d_4.Background.Mode = 2")	
dw_1.modify("d_5.Background.Mode = 2")	
dw_1.modify("d_6.Background.Mode = 2")	
dw_1.modify("d_7.Background.Mode = 2")	

dw_1.modify("w_1.Background.Mode = 1")	
dw_1.modify("w_2.Background.Mode = 1")	
dw_1.modify("w_3.Background.Mode = 1")	
dw_1.modify("w_4.Background.Mode = 1")	
dw_1.modify("w_5.Background.Mode = 1")	
dw_1.modify("w_6.Background.Mode = 1")	
dw_1.modify("w_7.Background.Mode = 1")	

il_DWHeight = em_date.height + dw_1.height 

text= ''
of_draw_day(li_year,li_month)
of_visible(false)

//dw_1.modify('posmsg.values="2012	2012/')	
//this.backcolor= parent.backcolor

end event

type st_1 from statictext within vo_calendar
boolean visible = false
integer x = 373
integer y = 6
integer width = 102
integer height = 70
integer textsize = -14
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
long backcolor = 16777215
string text = "▼"
alignment alignment = center!
borderstyle borderstyle = styleshadowbox!
boolean focusrectangle = false
end type

event clicked;//of_visible()
end event

type dw_1 from datawindow within vo_calendar
event ue_dwmousemove pbm_dwnmousemove
integer x = 7
integer y = 131
integer width = 976
integer height = 902
integer taborder = 10
string title = "none"
boolean livescroll = true
end type

event ue_dwmousemove;int li_for
string ls_date
this.setredraw( false)
if dwo.name = 't_left' or dwo.name = 't_right' or dwo.name = 't_2' or dwo.name = 't_1' then 
	this.modify(string(dwo.name)+".color =255")	
elseif pos(dwo.name,'d_') > 0 and row > 0 then
	for li_for = 1 to 7 //重置border
		this.modify("d_"+string(li_for)+".border ='0'")	
	next
	ls_date = this.getitemstring( row, string(dwo.name))
	if ls_date <> '' and not isnull(ls_date) then this.modify(string(dwo.name)+".border ='0~tif(getrow() = "+string(row)+",2,0)'")	
elseif dwo.name = 't_close' then
	this.modify("t_close.color ='255'")	
else
	this.modify("t_1.color =536870912")	
	this.modify("t_2.color =536870912")	
	this.modify("t_left.color =536870912")	
	this.modify("t_right.color =536870912")	
	for li_for = 1 to 7 //重置border
		this.modify("d_"+string(li_for)+".border ='0'")	
	next
	this.modify("t_close.color ='0'")	
end if
this.setredraw( true)
end event

event clicked;string ls_years,ls_month
int li_years,li_month,li_for
date ldt_date
string ls_data,ls_name

this.setredraw( false)
if dwo.name = 't_left' or dwo.name = 't_right' then
	ldt_date = dw_1.getitemdate(1, 'ldate')
	li_years = year(ldt_date)
	li_month = month(ldt_date)	
	if dwo.name = 't_left' then	
		if li_month -1 > 0 then
			li_month = li_month -1
		else
			li_month = 12
			li_years = li_years -1
		end if
	elseif dwo.name = 't_right' then
		if li_month +1 < 13 then
			li_month = li_month +1
		else
			li_month = 1
			li_years = li_years +1
		end if
	end if
	
	of_draw_day(li_years,li_month)
	of_selected_day()
elseif dwo.name = 't_1' or dwo.name = 't_2' then
	ldt_date = dw_1.getitemdate(1, 'ldate')
	li_years = year(ldt_date)
	li_month = month(ldt_date)	
	if dwo.name = 't_1' then
		li_years = li_years + 1
	elseif dwo.name = 't_2' then
		li_years = li_years - 1
	end if
	of_draw_day(li_years,li_month)
	of_selected_day()
elseif pos(dwo.name,'d_') > 0 and row > 0 then
	ls_name = dwo.name
	ls_data = is_arrDdate[row ,long(right(ls_name,1))]
	if ls_data <> '' then
		em_date.text = ls_data
		text = ls_data
		of_visible(false)
	end if
	
elseif dwo.name = 'today' then
	ldt_date = date(dw_1.getitemdatetime(1, 'today'))
	em_date.text = string(ldt_date)
	text = string(ldt_date)
	of_visible(false)
	
elseif dwo.name = 't_close' then
	of_visible(false)
	
end if
this.setredraw( true)

end event

type st_2 from statictext within vo_calendar
integer x = 563
integer y = 16
integer width = 121
integer height = 83
boolean bringtotop = true
integer textsize = -20
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
long backcolor = 10789024
string text = "▼"
alignment alignment = center!
borderstyle borderstyle = styleshadowbox!
boolean focusrectangle = false
end type

event clicked;if ib_bool = false then
	of_visible(true)
else
	of_visible(false)
end if
end event

type em_date from editmask within vo_calendar
integer width = 699
integer height = 115
integer taborder = 10
integer textsize = -18
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
long textcolor = 33554432
string text = "none"
maskdatatype maskdatatype = datemask!
string mask = "yyyy-mm-dd"
end type

event getfocus;of_visible(false)
end event

 

  • 0
    点赞
  • 0
    评论
  • 5
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

©️2021 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值