网站公告列表

  没有公告

加入收藏
设为首页
联系站长
您现在的位置: 网络学院 >> 程序设计 >> PowerBuilder >> 文章正文
  Powerbuilder 中制作进度条            【字体:
Powerbuilder 中制作进度条
作者:佚名    文章来源:不详    点击数:    更新时间:2007-8-16    
在VB和Delphi等语言中都提供了“进度条”控件,PB中没有现成的控件提供,但我们可以做一个“进度条”的用户定义对象(user object),象控件一样在程序中调用。
具体方法如下:
  新建一个用户对象UO_PROGRESSBAR,加上两个长方形(rectangle)控件r_1和r_2,同时加上两条线(line)控件ln_1和ln_2。线用于增加r_1的立体效果,r_2颜色为兰色,用于显示进度。
R_1属性为:
X=5 y=4 width=1408 height=64
Visible=true LineColor=33554431
FillColor=33554431 FillPattern=solid!
LineStyle=continuous! LineThickness=12
R_2属性为:
X=5 y=4 width=41 height=60
Visible=true LineColor=16777215
FillColor=16711680 FillPattern=vertical!
LineStyle=continuous! LineThickness=12
 
先定义窗口的实例变量(Instance Variables):
private:
int thick; //进度条与外框的距离
int b
public:
long max,min; //max,min
long pos; //pos
long color;
 
窗口Constructor的Script:
long w,h
thick=5
b=1
w=this.width
h=this.height
r_1.x=thick
r_1.y=thick
r_2.x=thick
r_2.y=thick
r_1.width=w
r_1.height=h
r_2.height=h
ln_1.beginx=thick
ln_1.beginy=thick
ln_1.endx=w - 2*thick
ln_1.endy=thick
ln_2.beginx=thick
ln_2.beginy=thick
ln_2.endx=thick
ln_2.endy=h - 2*thick
 
窗口Progress的Script:
long bet
bet=(max - min)/10
if min$#@62;max then
return
end if
if pos=max then
r_2.width=r_1.width
b=1
return
end if
if pos$#@62;=min and pos$#@60;max then
if pos$#@62;=b*bet then
r_2.resize(r_1.width*(abs((pos - min)/(max - min))),r_2.height)
b=b+1
end if
end if
以上便完成了用户对象,以后只需调用即可,比如:
int i
uo_1.min=0
uo_1.max=10000
for i=1 to 10000
uo_1.pos=i
uo_1.triggerevent("progress")
next
其中,uo_1为进度条用户对象。

站内文章搜索 高级搜索
文章录入:admin    责任编辑:admin 
  • 上一篇文章:

  • 下一篇文章:
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    最新热点 最新推荐 相关文章
     在PB程序中实现ODBC数据…
     用PB5 设计 串口通讯程序
     如何用VC创建可在PB中调…
     PB连接Microsoft  SQL S…
     用PB编写多线程应用程序
  • weblogic 9.1的domain配置my…

  • 保留weblogic 中jsp编译后生…

  • 浅析Spring框架下PropertyPl…

  • SPRING+STRUTS+HIBERNATE登录…

  • POJO 和 PO 的概念

  • SIP简介,第2部分:SIP SERV…

  • JavaWeb中的Session、Sessio…

  • tomcat下配置jspservletbean…

  • 在Ubuntu上搭建E-Ink AM-100…

  • chapter one

  •   网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    网络学院©2007 www.23book.net
    为您提供web编程,vb编程,vc编程,服务器架设管理,数据库设计等方面的知识 站长:David