[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Auto resizing a picture to fit

Posted on 2003-11-24
7
Medium Priority
?
264 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
6 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
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.

 

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

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 debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

873 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