首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >虚拟树视图将垂直滚动条放置在右侧的RightToLeft双模式中

虚拟树视图将垂直滚动条放置在右侧的RightToLeft双模式中
EN

Stack Overflow用户
提问于 2018-11-01 06:07:02
回答 1查看 135关注 0票数 1

是否可以将虚拟树视图的垂直滚动条放置在右侧的RightToLeft双模式中,并将其放置在左侧的LeftToRight模式中?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-11-01 07:18:25

为什么不行?如果TVirtualTreeView使用系统滚动条,则可以通过设置适当的扩展样式来完成。

代码语言:javascript
复制
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常量用于使post中的代码更加紧凑。

另请参阅

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53095995

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档