用鼠标中键自动滚屏

pino 2000-09-03 03:32:00
在“写字板”和“记事本”中,按下鼠标中键,鼠标就会变成双箭头,移动鼠标就能自动滚动文本,我该怎样来实现?是不是有什么扩展的鼠标消息?
用 VB6 做的程序好像不需要特别处理就会自动支持,但是在Delphi中的Tmemo、Trichedit却都不支持,要等 Delphi 6 吗?
...全文
470 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
robyman 2001-11-09
  • 打赏
  • 举报
回复
我要,谢谢
qiuzhiman@263.net
andygood 2000-09-15
  • 打赏
  • 举报
回复

This problem is too easy le!

When the user pushes the middle button in your client area, Windows will send a WM_MBUTTONDOWN message, similar as WM_LBUTTONDOWN too u. You can overload it to implement your action. When the middle button is moving(let's just say so), u will receive a WM_MOUSEWHEEL message. You can process this message just as you process WM_VSCROLL, but is easier.

By the way, if u want to have some special cursor, u'll have to use standard LoadCursor(From your own resource) and SetCursor API, according to the mouse action.

Why the default window does not implement this is because that it is imposible to know your scroll limit. You can provide your own class(which use virtual functions) to have the default process.
netsong 2000-09-15
  • 打赏
  • 举报
回复
我要,谢谢。
netsongs@etang.com
andygood 2000-09-15
  • 打赏
  • 举报
回复

谁需要了我Email给他。
pino 2000-09-15
  • 打赏
  • 举报
回复
我又重新做了一下试验,纠正一个错误
实际上 TMemo,TListBox,TComboBox 都支持中键自动滚屏,该功能由系统完成,
而 TRichEdit 确实不支持,实际上是系统不支持,看来只有自己编写滚屏部分了。

最后再问一个问题,谁知道滚屏的光标在那个系统文件里面?就是那个几个箭头!
有人答了马上分点数
pino 2000-09-14
  • 打赏
  • 举报
回复
加分了!现在是180
pino 2000-09-14
  • 打赏
  • 举报
回复
加分了!现在是不是180
pino 2000-09-07
  • 打赏
  • 举报
回复
补充一点,Tlistbox 却支持中键滚屏,奇怪,是不是在继承时有消息被过滤掉了?
HF 2000-09-07
  • 打赏
  • 举报
回复
关注!
pandaxj 2000-09-03
  • 打赏
  • 举报
回复
还有我!
zhyy 2000-09-03
  • 打赏
  • 举报
回复
关注!

5,379

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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