Código Delphi
[-]procedure TForm1.MenuItemDrawItem(Sender: TObject; ACanvas: TCanvas; ARect: TRect; Selected: Boolean);
begin
ACanvas.Font.Name := 'Comic Sans MS';
ACanvas.Font.Color := clGreen;
ACanvas.FillRect(ARect);
Inc(ARect.Left, 5);
with Sender as TMenuItem do
DrawText(ACanvas.Handle, PChar(Caption), Length(Caption), ARect, 0)
end;
DFM;
Código:
object PopupMenu1: TPopupMenu
OwnerDraw = True
object MenuItem1: TMenuItem
Caption = '&Cut'
OnDrawItem = MenuItemDrawItem
end
object MenuItem2: TMenuItem
Caption = '&Copy'
OnDrawItem = MenuItemDrawItem
end
object MenuItem3: TMenuItem
Caption = '&Paste'
OnDrawItem = MenuItemDrawItem
end
object MenuItem4: TMenuItem
Caption = '&Delete'
OnDrawItem = MenuItemDrawItem
end
end