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?
 
TTConnect With a Mentor Commented:
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
 
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
All Courses

From novice to tech pro — start learning today.