我的代码是这样写的! Private Sub Command2_Click() Picture2.Picture = Picture1.Image Picture2.Refresh End Sub 但还是一个样!一点变化都没有啊!
我试过了!如果是picture1显示的图片是硬盘上的就可以!如果是从屏幕上截取的就不可以!以下是我的程序的全部代码 Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long 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 LongPrivate Sub Command1_Click() Dim wScreen As Long Dim hScreen As Long Dim w As Long Dim h As Long Picture1.ClswScreen = Screen.Width \ Screen.TwipsPerPixelX hScreen = Screen.Height \ Screen.TwipsPerPixelYPicture1.ScaleMode = vbPixels w = Picture1.ScaleWidth h = Picture1.ScaleHeight hdcscreen = GetDC(0)r = StretchBlt(Picture1.hdc, 0, 0, w, h, hdcscreen, 0, 0, wScreen, hScreen, vbSrcCopy)End SubPrivate Sub Command2_Click() Picture2.Picture = Picture1.Image Picture2.Refresh End Sub 求高手教我!谢谢
用paint,用法和上面的StretchBlt相同
加上 private sub form_load() picture1.autoredraw=true picture2.autoredraw=true end sub
Private Sub Command2_Click()
Picture2.Picture = Picture1.Image
End Sub
Private Sub Command2_Click()
Picture2.Picture = Picture1.Image
Picture2.Refresh
End Sub
但还是一个样!一点变化都没有啊!
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
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 LongPrivate Sub Command1_Click()
Dim wScreen As Long
Dim hScreen As Long
Dim w As Long
Dim h As Long
Picture1.ClswScreen = Screen.Width \ Screen.TwipsPerPixelX
hScreen = Screen.Height \ Screen.TwipsPerPixelYPicture1.ScaleMode = vbPixels
w = Picture1.ScaleWidth
h = Picture1.ScaleHeight
hdcscreen = GetDC(0)r = StretchBlt(Picture1.hdc, 0, 0, w, h, hdcscreen, 0, 0, wScreen, hScreen, vbSrcCopy)End SubPrivate Sub Command2_Click()
Picture2.Picture = Picture1.Image
Picture2.Refresh
End Sub
求高手教我!谢谢
private sub form_load()
picture1.autoredraw=true
picture2.autoredraw=true
end sub