Recent

Author Topic: Change button background color  (Read 2433 times)

dodgebros

  • Full Member
  • ***
  • Posts: 165
Re: Change button background color
« Reply #15 on: June 26, 2024, 05:56:47 am »
Thanks to all for trying to help.  In the end, I added a panel to my main form, then I added another panel to that panel, one for each button.  I used the MouseEnter and the MouseLeace events to mimic the look of a button and of course the onClick event to run additional code.  Please see the attached
picture.

TD

cdbc

  • Hero Member
  • *****
  • Posts: 1535
    • http://www.cdbc.dk
Re: Change button background color
« Reply #16 on: June 26, 2024, 10:02:40 am »
Hi
Yup, "Easy Peasy" right  :D
Good on you mate  8)
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

LBoxPO

  • New Member
  • *
  • Posts: 15
Re: Change button background color
« Reply #17 on: September 17, 2024, 12:24:05 am »
Thanks to all for trying to help.  In the end, I added a panel to my main form, then I added another panel to that panel, one for each button.  I used the MouseEnter and the MouseLeace events to mimic the look of a button and of course the onClick event to run additional code.  Please see the attached
picture.

TD

But what if you need buttons with rounded corners?  :)

Joanna

  • Hero Member
  • *****
  • Posts: 1099
Re: Change button background color
« Reply #18 on: September 17, 2024, 03:56:17 am »
This is easy just use tcdbutton from customdrawncontrols
✨ 🙋🏻‍♀️ More Pascal enthusiasts are needed on IRC .. https://libera.chat/guides/ IRC.LIBERA.CHAT  Ports [6667 plaintext ] or [6697 secure] channel #fpc  #pascal Please private Message me if you have any questions or need assistance. 💁🏻‍♀️

dbannon

  • Hero Member
  • *****
  • Posts: 3095
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Change button background color
« Reply #19 on: September 17, 2024, 09:34:30 am »
An approach I used is to use TBitButton and fill it with a suitable sized bitmap. Displayed text is in the bitmap too of course. Does not scale....

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

 

TinyPortal © 2005-2018