如何判断ScrollBar滑块是向上运动还是向下运动???我怎么才能知道,我拖动滑块时是向上拖动的,还是向下拖动的.
解决方案 »
- 几种图片的遍历算法,可是不成功。请高手赐教
- Delphi中有没有像Photoshop那样的“历史”按钮或面板,可以撤销多步的?
- 用InstallShield For Delphi制作安装文件时,数据库路径应怎样配置?
- 請教一個procedure edtCodeButtonClick(Sender: TObject; AbsoluteIndex: Integer)是什麼控件!
- TbitBtn控件的问题
- 哪位大哥有DELPHI中文帮助文件 ?????
- 用SQL创建表
- 创建MDI child时,提示没有acitve MDI Form。但是MDI 主窗口确实在,而且还在程序中Active,不知是否设置有问题
- 请问怎样动态声明多个变量!
- 运行关于SQL的问题,出现下面的错误,应该怎么办呢?在线等。。。。
- 字段的拆分问题??在线求教~~
- 如何屏蔽ctrl+alt+del组合?
VScroll1.Value = (VScroll1.Min + VScroll1.Max) \ 2
Old_Value = VScroll1.Value
Label1.Caption = ""
End SubPrivate Sub VScroll1_Change()
If Old_Value > VScroll1.Value Then
Label1.Caption = "向上"
Else
Label1.Caption = "向下"
End If
Old_Value = VScroll1.Value
End SubPrivate Sub VScroll1_Scroll()
VScroll1_Change
End Sub
unit Unit1;//Powered by Jadeluo, 2005/05/21interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
ScrollBar1: TScrollBar;
Label1: TLabel;
procedure FormCreate(Sender: TObject);
procedure ScrollBar1Scroll(Sender: TObject; ScrollCode: TScrollCode;
var ScrollPos: Integer);
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
begin
ScrollBar1.Position := (ScrollBar1.Min + ScrollBar1.Max) div 2;
Label1.Caption := '';
end;procedure TForm1.ScrollBar1Scroll(Sender: TObject; ScrollCode: TScrollCode;
var ScrollPos: Integer);
begin
case ScrollCode of
scLineUp : Label1.Caption := 'Up or Left';
scLineDown : Label1.Caption := 'Down or Right';
scPageUp : Label1.Caption := 'PageUp';
scPageDown : Label1.Caption := 'PageDown';
scEndScroll: Label1.Caption := 'Finished';
end;
end;end.
谢谢; VB 和DElphi 的例子都看.但是,我想知道的是用鼠标点住滑块拖动时的方向.
不是按钮和翻页时的方向
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
ScrollBar1: TScrollBar;
Label1: TLabel;
Label2: TLabel;
procedure ScrollBar1Scroll(Sender: TObject; ScrollCode: TScrollCode;
var ScrollPos: Integer);
end;var
Form1: TForm1;implementation{$R *.dfm}var
OldValue : Integer;procedure TForm1.ScrollBar1Scroll(Sender: TObject; ScrollCode: TScrollCode;
var ScrollPos: Integer);
begin
case ScrollCode of
scLineUp : Label1.Caption := 'Up or Left';
scLineDown : Label1.Caption := 'Down or Right';
scPageUp : Label1.Caption := 'PageUp';
scPageDown : Label1.Caption := 'PageDown';
scEndScroll: Label1.Caption := 'Finished';
scTrack : begin
if OldValue < ScrollPos then
Label2.Caption := 'Moving Down'
else
Label2.Caption := 'Moving Up';
OldValue := ScrollPos;
end;
end;
end;end.
我当时把Oldvale变量放到了ScrollBar1Scroll事件中.
在OnCheng事件里对比的Oldvale 和ScrollBar1.Postion的值,这样做,慢点拖还行,快了就不行了。
没想到都放 ScrollBaScroll中就行了。。呵呵再次对帮助过我的朋友们进行感谢。。*^_^*