Solved

Center image on an image

Posted on 2012-03-30
3
253 Views
Last Modified: 2012-04-18
Need a example how to place a small image centered on a larger image. Thanks for the help.
0
Comment
Question by:2meathome
  • 2
3 Comments
 
LVL 19

Expert Comment

by:Thommy
ID: 37786286
Image1 = larger image
Image2 = smaller image

Image2.Left:=Image1.Left+(image1.Width-Image2.Width) div 2;
Image2.Top :=Image1.Top+(image1.Height-Image2.Height) div 2;

Open in new window

0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 37786311
you'll need
Image2.BringToFront to place it on top of image1
0
 
LVL 19

Accepted Solution

by:
Thommy earned 250 total points
ID: 37786314
As a procedure...

procedure CenterImage(ImageLarge,ImageSmall:TImage);
begin
  ImageSmall.Left:=ImageLarge.Left+(imageLarge.Width-ImageSmall.Width) div 2;
  ImageSmall.Top :=ImageLarge.Top+(imageLarge.Height-ImageSmall.Height) div 2;
  ImageSmall.BringToFront;
end

Open in new window

0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

813 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

15 Experts available now in Live!

Get 1:1 Help Now