Я использую следующий код для размещения вертикальной полосы прокрутки VirtualTreeView с правой стороны в бидимоде RightToLeft и с левой стороны в режиме LeftToRight.
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;
Это работает правильно, но есть проблема, когда дерево находится в режиме сетки и имеет столбцы заголовка. Пожалуйста, смотрите скриншот:
![enter image description here](https://i.stack.imgur.com/f07Oe.png)