Solved

Center image on an image

Posted on 2012-03-30
3
255 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
error 1.1 400 Bad request idhttp delphi 18 203
HTML text in the body of an email (delphi code) 12 210
PHP preg_replace code convert to Delphi 14 80
Multi-layered image in FireMonkey 9 67
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…
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…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

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