TMainMenu and OwnerDraw



I draw the menuitems with this code. The accelerator keys are shown but the
combination ALT + key does not work.

When OwnerDraw is set to False everything is ok.
I work in D5.

Any help is welcome !



procedure TfrmMain.miFileDrawItem(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; Selected: Boolean);
var iOffsetLeft, iOffsetTop:integer;
begin
iOffsetLeft := 5;
iOffsetTop := 2;
with ACanvas do
begin
Pen.Style := psSolid;
Pen.Color := clBlack;
Brush.Style := bsSolid;
if Selected then
Brush.Color := $00DF967A
else
Brush.Color := $00996633;
Rectangle( ARect );
Font.Color := clWhite;
ARect.Left := ARect.Left + iOffsetLeft;
ARect.Top := ARect.Top + iOffsetTop;
DrawText(ACanvas.Handle, PChar((Sender as TMenuItem).Caption),
Length((Sender as TMenuItem).Caption), ARect, 0);
end;
end;


.