TTabControl: tabs are displayed from right to left

I program in Hebrew, so I want the tabs on the top panel of TTabControl to be displayed from right to left. The BiDiMode property does not affect the tabs, but rather the text contained in the control.

I tried the following code

SetWindowLong (tc.Handle, GWL_EXSTYLE,
               GetWindowLong(tc.Handle, GWL_EXSTYLE)  or
               WS_EX_LAYOUTRTL or WS_EX_NOINHERITLAYOUT);

which correctly displays tabs, but prevents the appearance of controls inside ttabcontrol, and therefore its use is somewhat limited.

Any ideas? By the way, I am using Delphi 7.

TIA, No'am

+3
source share
3 answers

. - , , , .

procedure TForm1.FormCreate(Sender: TObject);
const
  LVM_FIRST = $1000;
  LVM_GETHEADER = LVM_FIRST + 31;
var
  header: thandle;
begin
  header:= SendMessage (TabControl1.Handle, LVM_GETHEADER, 0, 0);
  SetWindowLong (header, GWL_EXSTYLE,
                 GetWindowLong (header, GWL_EXSTYLE)  or
                 WS_EX_LAYOUTRTL or WS_EX_NOINHERITLAYOUT);

  SetWindowLong (TabControl1.Handle, GWL_EXSTYLE,
                 GetWindowLong (lv.Handle, GWL_EXSTYLE)  or
                 WS_EX_LAYOUTRTL or WS_EX_NOINHERITLAYOUT);
  lv.invalidate;  
end;
+2

D2007, windows7.

Raize, PageControl TabControl RightToLeft - .

+1

Source: https://habr.com/ru/post/1725401/


All Articles