PDA

Click to See Complete Forum and Search --> : StretchBlt


MattIdaho
Jan 7th, 2001, 07:31 PM
I have used StretchBlt with some success on perfect stretches such as an image of 20,20 stretching to 40,40 but if I try and stretch it to 20,40 or something unsquare it fails. Also unsuccessful in shrinking with it. Is it something I'm doing wrong or is StretchBlt only capable of perfect stretching

Jan 8th, 2001, 02:26 PM
Works fine for me.

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

Private Sub Command1_Click()
AutoRedraw = True
StretchBlt hdc, 0, 0, 100, 150, Picture1.hdc, 0, 0, Picture1.Width / 15, Picture1.Height / 15, vbSrcCopy
Refresh
End Sub


If, for whatever reason, it still doesn't work for you, try using the PaintPicture method. It's quite similar.

amitabh
Jan 11th, 2001, 11:04 AM
You might try using "SetStretchBltMode" Api call before calling "StretchBlt". Use "HalfTone" or "DeleteScans" parameter for "SetStretchBltMode"