How to write a component button so that when you hover the cursor over a button, another picture is displayed. Preferably with source. Or where to get such a component (free) for Delphi 2010?

    3 answers 3

    Put the button Button, ImageList on the form. Put in the ImageList images. In the property of the Images button, select ImageList. Next code:

    procedure TForm1.Button1MouseEnter(Sender: TObject); begin Button1.ImageIndex:= 1; end; procedure TForm1.Button1MouseLeave(Sender: TObject); begin Button1.ImageIndex:= 0; end; 

    Advanced settings for rendering components are presented in FireMonkey Delphi XE2.

    • mmm, this is what I meant toko simply without an imagelist - Mikha Nikolay

    At first it is worth considering whether TBitBtn is suitable for your tasks. You can try, using OnMouseLeave and OnMouseLeave control OnMouseLeave , to change the drawing on the fly.

      Well, I don’t know about the components, but I also had such a task, I took two pictures of the buttons, one of which is of the type at rest, and the other when it is induced, and just inserted them into the Delphi, when you hover one button in place of it, the other is put, and with the lead was put back.