怎样在窗体上动态画一条线或者删除这条线?

huaxiaosxl 2002-06-24 04:41:14
怎样在窗体上动态画一条线或者删除这条线?我想动态创建Line控件,可就是不行,不知为什么?

line ln_1

w_main.openuserobject(ln_1)
ln_1.beginx=100
ln_1.beginy=100
ln_1.endx=1000
ln_1.endy=1000
ln_1.visible=true

保存时脚本时提示错误:
C0174: Type of actual parameter can not be ancestor of formal reference parameter type.
...全文
95 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
huaxiaosxl 2002-06-26
  • 打赏
  • 举报
回复
已经解决,多谢大家。
hzhxxx 2002-06-25
  • 打赏
  • 举报
回复
没落的 PB,实在不行,要 实现一点其他的功能太差了!

database 90分,
other 20分.
hzhxxx 2002-06-25
  • 打赏
  • 举报
回复
API
dotnba 2002-06-25
  • 打赏
  • 举报
回复
关键是Line是不是可继承的对象
huaxiaosxl 2002-06-25
  • 打赏
  • 举报
回复
谢谢supervisor_78() ,我用下面的代码为什么不能清除动态创建的线?

//鼠标移入时的效果

//声明变量
statictext ln_left,ln_top,ln_right,ln_bottom
boolean lb_mousein,lb_border
window ActiveWindow
ActiveWindow = w_step1

//
lb_border = this.border

lb_mousein = (xpos>0 and ypos>0 and xpos<width and ypos<height)
if lb_mousein and this.tag="mousein" then return

if lb_mousein and this.tag<>"mousein" then
SetCapture( handle( this ) )
//鼠标进入控件
this.tag = "mousein"
if isvalid(ln_left) then ActiveWindow.closeuserobject(ln_left)
if isvalid(ln_top) then ActiveWindow.closeuserobject(ln_top)
if isvalid(ln_right) then ActiveWindow.closeuserobject(ln_right)
if isvalid(ln_bottom) then ActiveWindow.closeuserobject(ln_bottom)

//
this.border = false
this.text = "in"
//画左线
ActiveWindow.openuserobject(ln_left,"statictext")
ln_left.x = this.x
ln_left.y = this.y
ln_left.height = this.height
ln_left.width = LineThickness
ln_left.border = true
ln_left.bordercolor = rgb(255,255,255)
ln_left.text = ""
ln_left.visible = true

//画顶线
ActiveWindow.openuserobject(ln_top,"statictext")
ln_top.x = this.x
ln_top.y = this.y
ln_top.height = LineThickness
ln_top.width = this.width
ln_top.border = true
ln_top.bordercolor = rgb(255,255,255)
ln_top.text = ""
ln_top.visible = true

//画右线
ActiveWindow.openuserobject(ln_right,"statictext")
ln_right.x = this.x + this.width
ln_right.y = this.y
ln_right.height = this.height
ln_right.width = LineThickness
ln_right.border = true
ln_right.bordercolor = rgb(0,0,0)
ln_right.text = ""
ln_right.visible = true

//画底线
ActiveWindow.openuserobject(ln_bottom,"statictext")
ln_bottom.x = this.x
ln_bottom.y = this.y + this.height
ln_bottom.height = LineThickness
ln_bottom.width = this.width
ln_bottom.border = true
ln_bottom.bordercolor = rgb(0,0,0)
ln_bottom.text = ""
ln_bottom.visible = true
else
ReleaseCapture( )
this.text = "out"

//鼠标离开控件
this.tag = "mouseout"
if isvalid(ln_left) then ActiveWindow.closeuserobject(ln_left)
if isvalid(ln_top) then ActiveWindow.closeuserobject(ln_top)
if isvalid(ln_right) then ActiveWindow.closeuserobject(ln_right)
if isvalid(ln_bottom) then ActiveWindow.closeuserobject(ln_bottom)

//
this.border = lb_border
this.setredraw(true)
end if
supervisor_78 2002-06-24
  • 打赏
  • 举报
回复
statictext lst_line
openuserobject(lst_line)
lst_line.x = 100
lst_line.y = 100
lst_line.height = 20
lst_line.weight = 1000
lst_line.visible = true
//只能创建水平和垂直的线,把STATICTEXT当成了线
mxlmwl 2002-06-24
  • 打赏
  • 举报
回复
同意楼上的说法,pb的破线真差劲,一点美感都没有,而且还不好用。
xiongxiao 2002-06-24
  • 打赏
  • 举报
回复
API
byfq 2002-06-24
  • 打赏
  • 举报
回复
用数据窗口可以
jeking 2002-06-24
  • 打赏
  • 举报
回复
数据窗口可以动态好多东东。
不行的话,只能用API了,以为PB的线实在是太差了
Hanson_bati_zhu 2002-06-24
  • 打赏
  • 举报
回复
试试用数据窗口
super_jack 2002-06-24
  • 打赏
  • 举报
回复
就是使用API:
Public Function ULong LineTo(Long hdc, Long x, Long y) Library "gdi32.dll"
huaxiaosxl 2002-06-24
  • 打赏
  • 举报
回复
没有其它办法吗?比如用API……
我不可能在使用时在每个窗体上都预先放上几条线呀,那样太麻烦了
愉快的登山者 2002-06-24
  • 打赏
  • 举报
回复
只有用静态产生一条线,不用时VISIBLE = FALSE;用的时候VISIBEL = TRUE,然后再给位置赋值。

1,075

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧