一个简单的鼠标事件问题

miqier1209 2003-04-19 06:09:08
就这么几句话,总是不太好用。请dx指点。
if (xpos>=p_2.x and xpos<=p_2.x+p_2.width) and (ypos>=p_2.y and ypos<=p_2.y+p_2.height) then
p_2.visible=false;
else
p_2.visible=true;
end if
...全文
36 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
madking 2003-04-19
  • 打赏
  • 举报
回复
你把代码稍微改一下,比如说写到一个command button的mousemove事件里
先声明实例变量picturebutton_tr和local external functions
IF picturebutton_tr=True THEN
SetCapture(Handle(This))
Picturebutton_tr=False
this.visible = false
ELSEIF (Xpos<0 Or Ypos<0 Or Xpos>This.Width Or Ypos>This.Height) THEN
ReleaseCapture()
Picturebutton_tr=True
this.visible = true
END IF

这样鼠标移到按钮上时按钮就消失了,呵呵
miqier1209 2003-04-19
  • 打赏
  • 举报
回复
那好,我去掉了,我也是那样想的,但qqf(我就是我) 的方法我用不起来,不知道哪位能贴个源码上来给看看。
madking 2003-04-19
  • 打赏
  • 举报
回复
呵呵,我知道去掉分号一样,只是在pb里语句后面加分号看着别扭。
miqier1209 2003-04-19
  • 打赏
  • 举报
回复
随便定义了一个事件,ID是:pbm_mousemove
去掉分号还是一样。谢谢madking(爱一个人好难)
qqf 2003-04-19
  • 打赏
  • 举报
回复
定义实例变量:
Boolean Picturebutton_tr=true
声明函数:
FUNCTION ulong SetCapture(ulong hwnd) LIBRARY "user32.dll"
//跟踪鼠标
FUNCTION ulong ReleaseCapture() LIBRARY "user32.dll"
//释放鼠标

pbm_mousermove:
IF picturebutton_tr=True THEN
SetCapture(Handle(This))
Picturebutton_tr=False
ELSEIF (Xpos<0 Or Ypos<0 Or Xpos>This.Width Or Ypos>This.Height) THEN
ReleaseCapture()
Picturebutton_tr=True
END IF
madking 2003-04-19
  • 打赏
  • 举报
回复
你写到什么事件里了?
madking 2003-04-19
  • 打赏
  • 举报
回复
去掉分号

1,077

社区成员

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

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