Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

resize window to image size

Posted on 2004-08-11
10
Medium Priority
?
299 Views
Last Modified: 2010-04-05
I have an app that allows users to edit an image.   I want to resize the window to be the same size as the image.   I have tried editing just the width and height of the form, but it always cuts off the bottom (I assume its not taking into account the wise of the bar.

What is the BEST way of doing what I am doing?
0
Comment
Question by:hibbidiji
[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
  • 2
  • 2
  • +3
10 Comments
 
LVL 12

Accepted Solution

by:
Ivanov_G earned 1000 total points
ID: 11770474
Instead of Width and Height use ClientWidth and ClientHeight
0
 
LVL 16

Expert Comment

by:xDamox
ID: 11771478
ok,

if you have a bar at the bottom of your window try

form1.clientwidth := image1.clientwidth;
form1.clientheight := (image1.clientheight - statusBar.width);
0
 
LVL 16

Expert Comment

by:xDamox
ID: 11771492
erm I think the I made an aerror it shoould be

(image1.clientheight + statusBar.width);

plus not minus :S
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 12

Expert Comment

by:Ivanov_G
ID: 11771555
"image1.clientheight + statusBar.width"

xDamox, how come you combine ClientHeight and Width ???
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 11771755
download working examples from:
page:        http://www.geocities.com/esoftbg/
  link:        Q_20951029.zip
  link:        Q_21046446.zip
0
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 11772648
Well, there should be an interesting trick here that takes into account all the toolbars on the left, top, right and bottom by setting the Align property of the image to alClient. Then you use the difference between the TImage.Width/Height and the TImage.Picture.Bitmap.Width/Height. Like this:

Width := Width + TImage.Picture.Bitmap.Width - TImage.Width;
Height := Height + TImage.Picture.Bitmap.Height - TImage.Height;

This just modifies width and height with the difference between the image width and the real bitmap width.
0
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 11772657
Oh, TImage is of course your image object. Don't use the class!!! Use your TImage variable. :-)
0
 
LVL 2

Expert Comment

by:-Karamja-
ID: 11773902
Image1.Top:= 0;
Image1.Left:= 0;
Image1.AutoSize:= True;
Form1.AutoSize:= True;
0
 
LVL 1

Author Comment

by:hibbidiji
ID: 11774940
I will be trying these soon,   one thing to karamja, I dont want to use autosize because i have a draggable object on the canvas and I t will increase the window size when moved at runtime
0
 
LVL 1

Author Comment

by:hibbidiji
ID: 11776756
thanks everyone for your suggestions.   Ivanov_G's was just what I needed
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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 I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
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…
Suggested Courses

688 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