StretchBlt API

i read in alot of places that StretchBlt srtetches an image. But when i use it... it doesnt stretch at all.
I need source code that will take a bmp file and stretch it into a picture box.... thx1e6!
TCPIP2600Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TTCommented:
Put the following declaration in the
module's general declaration :

Public Const SRCCOPY = &HCC0020 ' (DWORD) dest = source

Public Declare Function StretchBlt Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long

Put 2 picture boxes on the form,
the smaller picture box (Pic1) added
with a bitmap image to its Picture
property.

the Larger picture box (Pic2) without
Picture inside.

Put a command button on form and at the
command_Click event call the following
code :

StretchBlt (Pic2.HDC, 0, 0, _
              Pic2.ScaleWidth, _
              Pic2.ScaleHeight, _
              Pic1.HDC, 0, 0, _
              Pic1.ScaleWidth, _
              Pic1.ScaleHeight, _
              SRCCOPY)

a stretch version of picture in Pic1 will display on Pic2.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TCPIP2600Author Commented:
1st of all. this is wrong:
StretchBlt (Pic2.HDC, 0, 0, _
                                                  Pic2.ScaleWidth, _
                                                  Pic2.ScaleHeight, _
                                                  Pic1.HDC, 0, 0, _
                                                  Pic1.ScaleWidth, _
                                                  Pic1.ScaleHeight, _
                                                  SRCCOPY)
its either:
StretchBlt Pic2.HDC, 0, 0, _
                                                  Pic2.ScaleWidth, _
                                                  Pic2.ScaleHeight, _
                                                  Pic1.HDC, 0, 0, _
                                                  Pic1.ScaleWidth, _
                                                  Pic1.ScaleHeight, _
                                                  SRCCOPY
or
dim rc
rc = StretchBlt (Pic2.HDC, 0, 0, _
                                                  Pic2.ScaleWidth, _
                                                  Pic2.ScaleHeight, _
                                                  Pic1.HDC, 0, 0, _
                                                  Pic1.ScaleWidth, _
                                                  Pic1.ScaleHeight, _
                                                  SRCCOPY)

2nd, neither of them work.... so whats wrong with my comp?
0
TTCommented:
1) Is there any error message or it just
   simply not work ?
2) check if your Gdi32.dll exists

0
TCPIP2600Author Commented:
no error, jsut doesnt do anything... GDI32 does exist. But also... BitBlt works fine... just stretchBlt doesnt work
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.