Delphi dbgrid连续滚动 [英] Delphi dbgrid continuous scrolling
问题描述
当我构建程序并向下滚动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屋!