Solved

PaintPicture

Posted on 2002-04-30
2
296 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
  • 2
2 Comments
 
LVL 13

Expert Comment

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

Accepted Solution

by:
crazyman earned 300 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

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
passing parameter in sql procedure 9 63
Copy a row 12 62
IF ELSE Statement in Excel Macro VBA 16 64
Automatic Email Reminder 4 38
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.
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…

777 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