Solved

PaintPicture

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now