Option Explicit Private Declare Function StretchBlt Lib "gdi32.dll" (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 Const SRCCOPY As Long = &HCC0020Private Sub Command1_Click() '保存个铲铲c:\chanchan_1.bmp SavePicture Picture1.Image, "c:\chanchan_1.bmp" End SubPrivate Sub Form_Load() Picture2.ScaleMode = 3 Picture1.ScaleMode = 3 Picture2.AutoRedraw = True Picture1.AutoRedraw = True '先在picture2上加载个铲铲 Picture2.Picture = LoadPicture("c:\chanchan.jpg") '缩放个铲铲到picture1 Call StretchBlt(Picture1.hdc, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, Picture2.hdc, 0, 0, Picture2.ScaleWidth, Picture2.ScaleHeight, SRCCOPY) 'Picture1.Refresh End Sub
picturebox 没有 savepicture
你能做就发代码来。
Private Declare Function StretchBlt Lib "gdi32.dll" (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 Const SRCCOPY As Long = &HCC0020Private Sub Command1_Click()
'保存个铲铲c:\chanchan_1.bmp
SavePicture Picture1.Image, "c:\chanchan_1.bmp"
End SubPrivate Sub Form_Load()
Picture2.ScaleMode = 3
Picture1.ScaleMode = 3
Picture2.AutoRedraw = True
Picture1.AutoRedraw = True
'先在picture2上加载个铲铲
Picture2.Picture = LoadPicture("c:\chanchan.jpg")
'缩放个铲铲到picture1
Call StretchBlt(Picture1.hdc, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, Picture2.hdc, 0, 0, Picture2.ScaleWidth, Picture2.ScaleHeight, SRCCOPY)
'Picture1.Refresh
End Sub
Private Sub Form_Load()
Picture1.AutoRedraw = True
Picture1.Picture = LoadPicture("c:\ 缩放前.jpg")
Picture1.Width = Picture1.Width / 2
Picture1.Height = Picture1.Height / 2
Picture1.PaintPicture Picture1, 0, 0, Picture1.Width, Picture1.Height
SavePicture Picture1.Image, "c:\缩放后.jpg"
End Sub