[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Center image on an image

Posted on 2012-03-30
3
Medium Priority
?
259 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 38

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 750 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

650 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