Solved

Adding images to buttons created at run-time.

Posted on 1998-08-10
5
193 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:knowlton
  • 3
  • 2
5 Comments
 
LVL 10

Expert Comment

by:viktornet
Comment Utility
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
Comment Utility
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:knowlton
Comment Utility
Thanks Viktornet!
0
 
LVL 5

Author Comment

by:knowlton
Comment Utility
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
Comment Utility
Ok I will...Talk to you later...

Regards,
Viktor Ivanov
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now