Custom Button lazarus / 39-Graphics ---------------------------------------------------------------------- dtpfl · 2021-09-22 15:50 Hello, i wanna try to create my own component. It should be a rounded button (like attachment). 1. Whats the best way and where should i inherited from? TComponent? 2. I guess that i need to paint the component by my self. Is there a easy way to paint a round rectangle with  antialiasing? thanks! ---------------------------------------------------------------------- Zoran · 2021-09-22 17:10 Quote from: dtpfl on September 22, 2021, 05:50:31 pm1. Whats the best way and where should i inherited from? TComponent? If you want your button to be able to receive focus (so that it can be accessed by keyboard, like TButton), inherit from TCustomControl. If you don't want the focus (like TSpeedButton, which cannot be accesed by keyboard), inherit from TGraphicControl. Both these classes provide the canvas you can paint on. Both classes have virtual method named Paint, and you should override it and do painting on canvas there. Quote from: dtpfl on September 22, 2021, 05:50:31 pm2. I guess that i need to paint the component by my self. Is there a easy way to paint a round rectangle with  antialiasing? You can use TCanvas methods to paint, but I don't know about antialiasing, for that perhaps you can use bgra library. Some wiki links which might be useful: https://wiki.freepascal.org/Graphics_-_Working_with_TCanvas https://wiki.freepascal.org/TCanvas https://wiki.lazarus.freepascal.org/Developing_with_Graphics ---------------------------------------------------------------------- devEric69 · 2021-09-22 18:22 As said, basically, the structure of the code to be implemented should look like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  TRoundedButton = class(TCustomControl)  ...\...  protected    procedure Paint; override;  ...\...   ...\...procedure TRoundedButton.Paint(Sender: TObject);begin  with Self.Canvas do begin    { color the shape }    Brush.Color:= clActiveCaption;    RoundRect(0, 0, 50, 25);    { draw its borders }    Pen.Color := clActiveBorder;    ...\...end; Here's an example: https://stackoverflow.com/questions/46651543/delphi-7-how-to-fill-a- rounded-rectangle-with-brush .