Recent

Author Topic: [CLOSED] Custom PopUpMenu  (Read 5144 times)

Pe3s

  • Hero Member
  • *****
  • Posts: 533
[CLOSED] Custom PopUpMenu
« on: November 30, 2021, 09:45:16 pm »
How can I fix the code to get rid of this gray frame.
Code: Pascal  [Select][+][-]
  1. procedure TForm1.PopupMenu1DrawItem(Sender: TObject; ACanvas: TCanvas;
  2.   ARect: TRect; AState: TOwnerDrawState);
  3. var
  4.   x, y: Integer;
  5. begin
  6.   ACanvas.Font.Assign(Screen.MenuFont);
  7.  
  8.   if AState * [odSelected, odFocused] <> [] then begin
  9.     ACanvas.Brush.Color := RGBToColor(216, 215, 255);
  10.     ACanvas.Pen.Color := RGBToColor(190, 190, 230);
  11.     ACanvas.Rectangle(ARect);
  12.     //ACanvas.Font.Style := [fsBold];
  13.   end
  14.   else
  15.     ACanvas.GradientFill(ARect, clSkyBlue, clSkyBlue, gdHorizontal);
  16.  
  17.   x := 2;
  18.   y := (ARect.Top + ARect.Bottom - ImageList1.Height) div 2;
  19.   ImageList1.Draw(ACanvas, x, y, TMenuItem(Sender).ImageIndex, TMenuItem(Sender).Enabled);;
  20.  
  21.   x := x + ImageList1.Width + 4;
  22.   ACanvas.Pen.Color := clGray;
  23.   ACanvas.Line(x, ARect.Top, x, ARect.Bottom);
  24.  
  25.   x := x + 4;
  26.   y := (ARect.Top + ARect.Bottom - ACanvas.TextHeight('Tg')) div 2;
  27.   ACanvas.Brush.Style := bsClear;
  28.   ACanvas.TextOut(x, y,  TMenuItem(Sender).Caption);
  29.  
  30. end;                                      
« Last Edit: December 01, 2021, 07:52:15 pm by Pe3s »

Pe3s

  • Hero Member
  • *****
  • Posts: 533
Re: Custom PopUpMenu
« Reply #1 on: December 01, 2021, 07:38:34 am »
@Jamie My point was to fill the entire background of the menu with color.  I don't want to remove the shadow. Remove white border
« Last Edit: December 01, 2021, 01:33:51 pm by Pe3s »

Pe3s

  • Hero Member
  • *****
  • Posts: 533
Re: Custom PopUpMenu
« Reply #2 on: December 01, 2021, 07:51:53 pm »
Thank you

 

TinyPortal © 2005-2018