Solved

Auto resizing a picture to fit

Posted on 2003-11-24
7
254 Views
Last Modified: 2012-05-04
Hi,
When I load a picture into a picture object, it's too big and is truncated to the right and bottom. So I am trying to re-size it.
I tried 2 things:
1. Picture.AutoSize = true
It complains that "Method or data member not found". I am using VB6.

2. A solution I found at this site:
Dim AspectRatio As Single
Dim NewHeight As Long
Dim TmpPic As StdPictureSet Picture1.Picture = LoadPicture("pic")

AspectRatio = TmpPic.Width / TmpPic.Height
NewHeight = Picture1.ScaleWidth / AspectRatio

Picture1.AutoRedraw = True    ' Necessary to keep the picture from being erased when window gets repainted
Picture1.PaintPicture TmpPic, 0, (Picture1.ScaleHeight - NewHeight) / 2, Picture1.ScaleWidth, NewHeight
' Arguments are as follows:   Source picture, Destination X, Destination Y, New Width, New Height

It also complains that "Method or data member not found" at Picture1.ScaleWidth

Thank you for your help.
Phil
0
Comment
Question by:spoowiz
7 Comments
 
LVL 18

Expert Comment

by:bobbit31
ID: 9813970
picture1.autosize = true should work
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 9813981
oh and you may need this:

Picture1.autoRedraw = true
Picture1.autosize = true
0
 

Author Comment

by:spoowiz
ID: 9814029
I was using the wrong object. Please ignore this question. Sorry.
How do I delete this question?
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

Author Comment

by:spoowiz
ID: 9814079
p.s. fyi to anyone who can use this:

option 1 picture1.autosize = true did not work.
option 2 does
0
 
LVL 2

Expert Comment

by:robbrownuk
ID: 9814397
To delete - post a 0 point question in the Community Support forum at:

http://experts-exchange.com/Community_Support/


PS: Don't Accept this as an answer!

robbrownuk
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 9831776
PAQed, with points refunded (250)

Computer101
E-E Admin
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

803 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