虚拟树视图将垂直滚动条放在从右到左双向模式的右侧

Virtual treeview place the vertical scrollbar on right side in the RightToLeft bidimode

是否可以将Virtual treeview的垂直滚动条在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常量用于post.

中使代码更紧凑

另见