This is how you can colorize your items:
1. Create your MenuItems with Designer and apply to each Item that you want to colorize a different Tag number, let it 0 to be unchanged
2. Create a OnDraw handler for the PopupMenu1
3. Copy and paste this code into that handler:
procedure TForm1.PopupMenu1DrawItem(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; AState: TOwnerDrawState);
var
MenuItem: TMenuItem;
begin
if (Sender is TMenuItem) then
begin
MenuItem := (Sender as TMenuItem);
ACanvas.Brush.Style := bsClear;
case MenuItem.Tag of
1: ACanvas.Brush.Color := clRed;
2: ACanvas.Brush.Color := clSkyBlue;
3: ACanvas.Brush.Color := clMoneyGreen;
else
ACanvas.Brush.Color := clNone;
end;
ACanvas.FillRect(ARect);
ACanvas.TextRect(ARect, ARect.Left + 5, ARect.Top + 2, MenuItem.Caption);
end;
end;
4. Remove the handler from PopupMenu1 again
5. Assign this handler now to all MenuItems
6. Run app.