Delphi dbgrid连续滚动 [英] Delphi dbgrid continuous scrolling

查看:359
本文介绍了Delphi dbgrid连续滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个持有订单和打印发票的应用程序。我的表单上有一些标签,ted,tmemos,按钮,数据源,adotable,popupmenu和dbgrid。



当我构建程序并向下滚动dbgrid滚动条,它在我释放鼠标按钮后滚动。但是我想要连续滚动。



问候语

解决方案

跟踪。导出一个新类来覆盖滚动行为。使用插入程序类的示例:

 键入
TDBGrid = class(DBGrids.TDBGrid)
private
程序WmVScroll(var Message:TWMVScroll);消息WM_VSCROLL;
结束

TForm1 = class(TForm)
DBGrid1:TDBGrid;
..

实现

程序TDBGrid.WmVScroll(var Message:TWMVScroll);
begin
如果Message.ScrollCode = SB_THUMBTRACK然后
Message.ScrollCode:= SB_THUMBPOSITION;
继承;
结束


您还可以替换 WindowProc 想要推出一个新课。所有您需要做的是处理 WM_VSCROLL 消息。 这里是如何做到的示例。


I'm making an application that holds orders and prints invoices. I have some labels, tedits, tmemos, buttons, a datasource, an adotable, a popupmenu, and a dbgrid on my form.

When I build the program and scroll down the dbgrid scrollbar, it scrolls after I release mouse button. But i want continuous scrolling.

Greetings

解决方案

That's called thumb tracking. Derive a new class to override scrolling behavior. Example of using an interposer class:

type
  TDBGrid = class(DBGrids.TDBGrid)
  private
    procedure WmVScroll(var Message: TWMVScroll); message WM_VSCROLL;
  end;

  TForm1 = class(TForm)
    DBGrid1: TDBGrid;
    ..

implementation

procedure TDBGrid.WmVScroll(var Message: TWMVScroll);
begin
  if Message.ScrollCode = SB_THUMBTRACK then
    Message.ScrollCode := SB_THUMBPOSITION;
  inherited;
end;


You can also replace the WindowProc of the control if you don't want to derive a new class. All you need to do is to handle WM_VSCROLL message. Here is an example how to do that.

这篇关于Delphi dbgrid连续滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆