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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

StretchBlt trouble

Status
Not open for further replies.

MikeCox

Programmer
Jun 4, 2001
340
US
Hi!

I'm having trouble making StretchBlt work as advertised. Consider the following code:
--------------------------
With frmPics.picLogo
StretchBlt picMain.hdc, 50, 50, .width, .height, .hdc, 0, 0, .width, .height, vbMergePaint
End With
--------------------------

This passes arguments that make it work just like BitBlt (i.e. no stretching, just a one for one).

Here's my problem:
--------------------------
'THIS WORKS:
Dim width As Long
Dim height As Long

width = frmPics.picLogo.width
height = frmPics.picLogo.height

With frmPics.picLogo
StretchBlt picMain.hdc, 50, 50, width, height, .hdc, 0, 0, .width, .height, vbMergePaint
End With

THIS DOES NOT:
Dim width As Long
Dim height As Long

width = frmPics.picLogo.width + 1
height = frmPics.picLogo.height + 1

With frmPics.picLogo
StretchBlt picMain.hdc, 50, 50, width, height, .hdc, 0, 0, .width, .height, vbMergePaint
End With

--------------------------

It doesn't seem to matter what I store into width and height, nothing gets painted if it is different than the source width and height. I've tried several different raster operations, AutoRedraw is True on all pictureboxes, refreshing pictureboxes only cause the first two examples to stop working (no change in the problem code), and I've simply run out of things to try. Examples on all websites seem to indicate I'm doing nothing wrong. Can anyone give any suggestions?

Thanks!

-Mike
Any man willing to sacrifice liberty for security deserves neither liberty nor security.

-Ben Franklin
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top