Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

StretchBlt API

Status
Not open for further replies.

mangocinn

Programmer
Jul 26, 2001
66
US
I have the following code...

dim file as string
dim result as integer

file = "C:myFile.bmp"
Picture1.Picture = LoadPicture(file)
result = StretchBlt(Picture2.hdc, 0, 0, 150, 130, Picture1.hdc, 0, 0, 8055, 4095, SRCPAINT)
Picture2.Refresh

When I run the code, Picture2 displays a black box of the width and height specified...the image is not copied. Any help?

BTW, after the StretchBlt call, it returns True...so, that appears as working...

Thanks in advance
 
ive had something similar.

Private 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

Dim file As String
Dim result As Integer

Private Const SRCPAINT = &HEE0086 ' (DWORD) dest = source OR dest

Private Sub Command1_Click()
result = StretchBlt(Picture2.hdc, 0, 0, Picture2.Width, Picture2.Height, Picture1.hdc, 0, 0, Picture1.Width, Picture1.Height, SRCPAINT)
' Picture2.Refresh
End Sub

Private Sub Form_Load()

file = "C:\Documents and Settings\Administrator\My Documents\Visual Basic\New Work\itl.bmp"
Picture1.Picture = LoadPicture(file)

End Sub

and for whatever reason removing the picture2.refresh bit displays the image (wheras leaving it in makes my picture2 blank) allbeit a shaded version of the original.

ive currently going through dan applemans book looking for reasons why?!?!?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top