起步软件技术论坛-X3

 找回密码
 立即注册
搜索
查看: 151|回复: 4

滚动DocView ?**

[复制链接]
发表于 2009-1-10 12:37:07 | 显示全部楼层 |阅读模式
代码滚动DocView,应该怎么写代码?
即代码操作表单的滚动条。
ScrollBy方法是什么意思呢?dvInfo.ScrollBy(0,20);   没有什么效果。
回复

使用道具 举报

发表于 2009-1-10 14:12:00 | 显示全部楼层
TWinControl.ScrollBy

Scroll control contents.
procedure ScrollBy(DeltaX, DeltaY: Integer);
Description
Call ScrollBy to scroll the contents within the control. While ScrollBy can be used for any TWinControl, it makes the most sense to use it for descendants of TScrollingWinControl.
Applications seldom need to call the ScrollBy method unless they implement their own scrolling interface rather than relying on a scroll bar.
The DeltaX parameter is the change in pixels along the X axis. A positive DeltaX value scrolls the contents to the right; a negative value scrolls the contents to the left. The DeltaY parameter is the change in pixels along the Y axis. A positive DeltaY value scrolls the contents down; a negative value scrolls the contents up.

这个方法可以移动当前显示区域内的内容。不过在Docview上使用不合适,Docview显示的是view的内容,如果要调用,应该这样:dvInfo.view.ScrollBy(0,20);

楼主想要做什么呢?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-1-10 15:06:43 | 显示全部楼层
表单比较长,想代码移动表单的滚动条,不用鼠标往下拉,该怎么做呢?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-1-12 09:46:06 | 显示全部楼层
顶一下。
回复 支持 反对

使用道具 举报

发表于 2009-1-12 10:33:57 | 显示全部楼层
楼主,你这样处理吧:
1、在窗体上放一个ScrollBox
2、将DocView放到ScrollBox中,DocView的高度和宽度要设置的和文档一样。
3、通过Windows消息来控制ScrollBox的滚动
   Borland.Delphi.Windows.PostMessage(ScrollBox1.Handle, Borland.Delphi.Messages.WM_VSCROLL,
         Borland.Delphi.Windows.SB_LINEDOWN, 0);
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Justep Inc.

GMT+8, 2025-7-28 20:44 , Processed in 0.042885 second(s), 15 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表