rt
解决方案 »
- DBgrideh动态添加列
- ----------------------------哪里可以撤销---------------------
- 用listview能否实现多个列中都有图标,如何实现
- 如何在ADODataSet控件查询出来的记录中进行再次筛选而不去查数据库?
- 大家有谁做共享软件的,进来说几句
- 求助:用report machine怎么做分组报表,急用,小妹在线等待
- TCustomFormClass = class of TCustomForm;其中Class of是什么含义???
- 弹出菜单问题!
- 如何向窗口输入数据?
- 谁有自荐信啊???E给我.给分.谢谢了.
- 小问题:这句话delphi老出错,说illegal characters '综采一'
- 关于读取光盘的磁道的问题
Option Explicit
Const LVM_FIRST = &H1000
Const LVM_GETTOPINDEX = (LVM_FIRST + 39)
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
lParam As Any) As Long
Private Sub Command1_Click()
Debug.Print SendMessage(ListView1.hwnd, LVM_GETTOPINDEX, 0, 0)
End Sub
Private Sub Form_Load()
Dim x As ListItem
Dim i As Integer
For i = 1 To 20
Set x = ListView1.ListItems.Add(, , "Item" + Str(i))
Next i
End Sub
点击Command1就可以得到当前位于ListView视图内最顶端的Item在ListView中的索引。
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, AppEvnts, ComCtrls;type
TListView = class(ComCtrls.TListView)
procedure WMVScroll(var Message: TMessage); message WM_VSCROLL;
procedure WMHScroll(var Message: TMessage); message WM_HSCROLL;
end;type
TForm1 = class(TForm)
ListView1: TListView;
ApplicationEvents1: TApplicationEvents;
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TListView.WMVScroll(var Message: TMessage);
begin
ShowMessage('VScroll');
end;procedure TListView.WMHScroll(var Message: TMessage);
begin
ShowMessage('HScroll');
end;end.