Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Auto resizing a picture to fit

Posted on 2003-11-24
7
Medium Priority
?
262 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
[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
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

609 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