TMainMenu and OwnerDraw
- From: "Darko" <dodododic2000@xxxxxxxxx>
- Date: Mon, 26 Sep 2005 20:17:37 +0200
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;
.
- Prev by Date: Re: Delphi Class TviLED
- Next by Date: Re: Auto-saving the registry
- Previous by thread: Pascal Look - help you understand your pascal unit file .
- Next by thread: Debugging
- Index(es):