Solved

PaintPicture

Posted on 2002-04-30
2
298 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 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

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
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…

730 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