Solved

Center image on an image

Posted on 2012-03-30
3
251 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
Comment Utility
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 36

Expert Comment

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

Accepted Solution

by:
Thommy earned 250 total points
Comment Utility
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

771 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

11 Experts available now in Live!

Get 1:1 Help Now