Delphi ScrollBox1滚动框鼠标滚轮
2023-01-03 16:31:47 作者:admin
本文整理自网络,侵删。
//方法1:procedure TForm1.ScrollBoxMouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);var LTopLeft, LTopRight, LBottomLeft, LBottomRight: SmallInt; LPoint: TPoint; ScrollBox: TScrollBox;begin ScrollBox := TScrollBox(Sender); LPoint := ScrollBox.ClientToScreen(Point(0,0)); LTopLeft := LPoint.X; LTopRight := LTopLeft + ScrollBox.ClientWidth; LBottomLeft := LPoint.Y; LBottomRight := LBottomLeft + ScrollBox.ClientWidth; if (MousePos.X >= LTopLeft) and (MousePos.X <= LTopRight) and (MousePos.Y >= LBottomLeft) and (MousePos.Y <= LBottomRight) then begin ScrollBox.VertScrollBar.Position := ScrollBox.VertScrollBar.Position - WheelDelta; Handled := True; end;end;
//方法2:procedure TForm1.ScrollBox1MouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);begin Handled := True; if WheelDelta < 0 then TScrollBox(Sender).VertScrollBar.Position := TScrollBox(Sender).VertScrollBar.Position + TScrollBox(Sender).VertScrollBar.Increment else TScrollBox(Sender).VertScrollBar.Position := TScrollBox(Sender).VertScrollBar.Position - TScrollBox(Sender).VertScrollBar.Increment;end;
相关阅读 >>
Delphi 临时文件路径(支持安卓、ios)
Delphi idhttp代理设置
Delphi firedac压缩和修复ms access数据库
Delphi treeview添加背景图片
选择 Delphi 的 9 条理由
Delphi 启动程序隐藏主窗体
关于公历与农历换算和时间处理的单元 calendar.pas
Delphi 判断一目录是否共享
Delphi 简单的英文数字字符串加密解密函数(不支持中文)
Delphi中调用http xml
更多相关阅读请进入《Delphi》频道 >>
猜你喜欢
联络方式:
400-123-789
邮箱:xiachao@163.com
Q Q:12345678
微信公众号
微信二维码