我目前的方法是在listview1的滚动条事件中改变listview2和listview3的滚动条位置,但是不知道滚动条向上和向下的区别,代码运行结果在最开始和最后同步不了。
lprocedure TForm2.NewWndProc(var _msg: TMessage);
var
Scrollinfo1:TScrollinfo;
pos:integer;
begin
FOldWndProc(_msg);
with _msg do
begin
case Msg of
WM_VSCROLL:
begin
Scrollinfo1.cbSize:=sizeof(Scrollinfo1);
Scrollinfo1.fMask:=SIF_ALL;
Getscrollinfo(listview1.Handle,SB_VERT,scrollinfo1);
pos:=Scrollinfo1.nPos;
if _msg.WParam>0 then
begin
sendmessage(listview2.Handle,WM_VSCROLL,SB_LINEUP,0);
sendmessage(listview3.Handle,WM_VSCROLL,SB_LINEUP,0);
end
else
begin
sendmessage(listview2.Handle,WM_VSCROLL,SB_LINEDOWN,0);
sendmessage(listview3.Handle,WM_VSCROLL,SB_LINEDOWN,0);
end;
end;
end;
end;
end;
lprocedure TForm2.NewWndProc(var _msg: TMessage);
var
Scrollinfo1:TScrollinfo;
pos:integer;
begin
FOldWndProc(_msg);
with _msg do
begin
case Msg of
WM_VSCROLL:
begin
Scrollinfo1.cbSize:=sizeof(Scrollinfo1);
Scrollinfo1.fMask:=SIF_ALL;
Getscrollinfo(listview1.Handle,SB_VERT,scrollinfo1);
pos:=Scrollinfo1.nPos;
if _msg.WParam>0 then
begin
sendmessage(listview2.Handle,WM_VSCROLL,SB_LINEUP,0);
sendmessage(listview3.Handle,WM_VSCROLL,SB_LINEUP,0);
end
else
begin
sendmessage(listview2.Handle,WM_VSCROLL,SB_LINEDOWN,0);
sendmessage(listview3.Handle,WM_VSCROLL,SB_LINEDOWN,0);
end;
end;
end;
end;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货