Correct a BiDi bug in Delphi

Correct a BiDi bug in Delphi

When you set the BiDiMode in you form to bdRightToLeft, you do only HALF mirroring.

Since Win98 (Hebrew/Arabic version) mirror it’s envirement completly
(the Minimize, Close, Maxmize buttons are on the Left, and the Icon is on the right).
How can we do it in delphi ?

{...}
const
WS_EX_LAYOUTRTL = $00400000;
WS_EX_LAYOUT_RTL = WS_EX_LAYOUTRTL;

{...}

TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure CreateParams(var Params : TCreateParams); override;
end;

{...}

implementation

procedure TForm1.CreateParams(var Params : TCreateParams);
begin
inherited CreateParams(Params);
Params.ExStyle := WS_EX_LEFT or WS_EX_RTLREADING or WS_EX_LEFTSCROLLBAR or WS_EX_LAYOUT_RTL;
{WS_EX_LEFT to set the text caption to the right,
use WS_EX_RIGHT to set the caption to the left}
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
BiDiMode := bdLeftToRight; //A must !!!
end;

The result is Right to Left (including the buttons, the icon and the system menu)