delphi - 虚拟树视图将垂直滚动条放在 RightToLeft 双模的右侧
问题描述
是否可以将虚拟树视图的垂直滚动条放在 RightToLeft 双模的右侧,并将其放在 LeftToRight 模式的左侧?
解决方案
为什么不?如果TVirtualTreeView
使用系统滚动条,可以通过设置适当的扩展样式来完成。
procedure TForm1.Button2Click(Sender: TObject);
const
LSB = WS_EX_LEFTSCROLLBAR;
var
ExStyle: LONG_PTR;
begin
ExStyle := GetWindowLongPtr(AVTV.Handle, GWL_EXSTYLE);
// Check if RTL alignment specified for you component
if AVTV.BiDiMode = bdRightToLeft then
begin
// If so, then exclude LSB-constant and allow Windows place
// scrollbar on the right side of window
if (ExStyle and LSB) = LSB then
SetWindowLongPtr(AVTV.Handle, GWL_EXSTYLE, ExStyle and not LSB);
end
else
if AVTV.BiDiMode = bdLeftToRight then
begin
// The same as operation above but for LTR order
if (ExStyle and LSB) <> LSB then
SetWindowLongPtr(AVTV.Handle, GWL_EXSTYLE, ExStyle or LSB);
end;
end;
LSB 常量用于使代码在后期更加紧凑。
也可以看看
推荐阅读
- ios - 发送用户设置权限的正确方法是什么
- typescript - 记录的自键入键
- python - lambda 每次迭代都会执行函数参数吗?
- u-boot - 如何在u-boot阶段替换fat分区中的文件
- macos - 带有子菜单的 SwiftUI 上下文菜单
- docker - 创建dockerfile entrypoint.sh后docker mysql 4.0.27启动问题
- r - R使用基于组的某些列中的条件完成值
- lua - 我有什么办法可以解决这个 if 语句吗?
- reactjs - 如何通过反应 FullCalendar 悬停每天的每个单元格?
- python - Django ImageField 上传到与 url 属性报告的路径不同的路径?