效果图:
PB9代码:
创建Standard Visual ,datawindow对象,命名为:vo_hprogressbar
forward
global type vo_hprogressbar from datawindow
end type
end forward
global type vo_hprogressbar from datawindow
integer width = 2242
integer height = 202
string title = "none"
boolean border = false
boolean livescroll = true
end type
global vo_hprogressbar vo_hprogressbar
type variables
long il_backcolor = 15780518 //进度颜色
long il_fontcolor = 33554432 //字体颜色
long il_fontsize = 14 //字体大小
end variables
forward prototypes
public subroutine of_progress (long al_maxposition, long al_progress)
end prototypes
public subroutine of_progress (long al_maxposition, long al_progress);//===========================
//al_maxposition : 总进度
//al_progress : 当前进度
//===========================
long ll_width,ll_st_article_x
int li_percentage
dec ldc_article_width
string ls_text
//this.setredraw( false)
//this.object.progress.width = 0
ll_width = this.width -20
li_percentage=(100/al_maxposition) * al_progress
if al_maxposition = al_progress then
ldc_article_width = ll_width
ls_text='100%'
else
ldc_article_width = (ll_width / al_maxposition) * al_progress
ls_text=string(li_percentage)+'%'
end if
this.object.number.text = ls_text
this.object.progress.width = int(ldc_article_width)
//this.setredraw( true)
this.SetPosition("number", "header", TRUE)
end subroutine
on vo_hprogressbar.create
end on
on vo_hprogressbar.destroy
end on
event constructor;string ls_syanx
long ll_width,ll_height
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=10000 color="536870912" )' + &
'summary(height=0 color="536870912" )' + &
'footer(height=0 color="536870912" )' + &
'detail(height=0 color="536870912" )' + &
'table(column=(type=char(10) updatewhereclause=yes name=a dbname="a" )' + &
' )' + &
'text(band=header alignment="2" text="text" border="0" color="'+string(il_fontcolor)+'" x="55" y="51" height="80" width="500" html.valueishtml="0" name=number visible="1" font.face="宋体" font.height="-'+string(il_fontsize)+'" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="553648127" )' + &
'text(band=header alignment="2" text="" border="0" color="255" x="0" y="0" height="90" width="995" html.valueishtml="0" name=progress visible="1" font.face="Arial" font.height="-13" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="'+string(il_backcolor)+'" )' + &
'rectangle(band=header x="22" y="13" height="125" width="1865" name=r_border visible="1" brush.hatch="6" brush.color="553648127" pen.style="0" pen.width="4" pen.color="'+string(il_backcolor)+'" background.mode="2" background.color="553648127" )' + &
'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" )'
this.Create(ls_syanx)
this.object.number.text = '0%'
ll_width = long(this.object.number.width)
ll_height = long(this.object.number.height)
this.object.number.x = long((this.width - ll_width) / 2)
this.object.number.y = long((this.height - ll_height) / 2)
this.object.progress.x = 10
this.object.progress.y = 10
this.object.progress.width = 0
this.object.progress.height = this.height -20
this.object.r_border.x = this.object.progress.x
this.object.r_border.y = this.object.progress.y
this.object.r_border.width = this.width -20
this.object.r_border.height = this.object.progress.height
this.SetPosition("r_border", "header", false)
end event