?
Solved

PaintPicture

Posted on 2002-04-30
2
Medium Priority
?
300 Views
Last Modified: 2010-05-02
I'm trying to clip a picture. I'm doing it by loading the picture into one picturebox, and using the PaintPicture method to paint a part of it into another picture box. Here's the code:

    Set picSource.Picture = LoadPicture(sFile)
    picDest.Width = iWidth * Screen.TwipsPerPixelX
    picDest.Height = iHeight * Screen.TwipsPerPixelY
    picDest.PaintPicture picSource.Picture, _
                         0, _
                         0, _
                         iWidth * Screen.TwipsPerPixelX, _
                         iHeight * Screen.TwipsPerPixelY, _
                         iLeft * Screen.TwipsPerPixelX, _
                         iTop * Screen.TwipsPerPixelY, _
                         iWidth * Screen.TwipsPerPixelX, _
                         iHeight * Screen.TwipsPerPixelY

But after the PaintPicture, picDest.picture is always 0. What am I doing wrong?
0
Comment
Question by:toff_in_sydney
[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 Comments
 
LVL 13

Expert Comment

by:crazyman
ID: 6980349
set picDest.picture = picDest.Image ?
0
 
LVL 13

Accepted Solution

by:
crazyman earned 900 total points
ID: 6980368
Private Sub Command1_Click()

picDest.AutoSize = True
'load your pic
'Set picSource.Picture = LoadPicture(sFile)
picDest.PaintPicture picSource.Picture, 0, 0, picSource.Width, picSource.Height
Set picDest.Picture = picDest.Image
Debug.Print picDest.Picture
End Sub
0

Featured Post

Industry Leaders: 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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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
Course of the Month8 days, 19 hours left to enroll

764 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