Solved

Adding images to buttons created at run-time.

Posted on 1998-08-10
5
198 Views
Last Modified: 2010-04-04
This is sort of a follow-up question to one I asked earlier.

I am creating a bunch of buttons at run-time, and I want each button to have a bitmap image displayed on it.

NOTE:  I've noticed that you can dynamically create TButton...but for some reason TSpeedButton and TBitButton don't want to work.  Delphi keeps flaggin the declaration telling me that no corresponding component was found on the form itself.
0
Comment
Question by:Tom Knowlton
  • 3
  • 2
5 Comments
 
LVL 10

Expert Comment

by:viktornet
ID: 1361832
Try putting this,,,,,
  RunTimeCreatedBtn.Parent := Self; //try changing the parent and see what happens
..............

0
 
LVL 10

Accepted Solution

by:
viktornet earned 10 total points
ID: 1361833
Try this.....

uses buttons;

procedure TForm1.Button1Click(Sender: TObject);
var
  Btn : TSpeedButton;
begin
  Btn := TSpeedButton.Create(self);
  with Btn do
    begin
      Parent := Self;
      Top := 100;
      Left := 100;
      Width := 50;
      Height := 50;
      Glyph := NameOfBitmap;//This would be the image
      Visible := True;
    end;
end;
---------
Regards,
Viktor Ivanov
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 1361834
Thanks Viktornet!
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 1361835
Viktornet:

Check out the latest version of the Map Editor at:

www.enol.com/~knowlton

My newest change is there is now a floating Brush Palette from which you can select the Brush you want to paint with.  Pretty cool!
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1361836
Ok I will...Talk to you later...

Regards,
Viktor Ivanov
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question