Public Class Form1 Private Declare Function StretchBlt Lib "gdi32" Alias "StretchBlt" _ (ByVal hdc As Integer, ByVal x As Integer, ByVal y As Integer, _ ByVal nWidth As Integer, ByVal nHeight As Integer, _ ByVal hSrcDC As Integer, _ ByVal xSrc As Integer, ByVal ySrc As Integer, _ ByVal nSrcWidth As Integer, ByVal nSrcHeight As Integer, _ ByVal dwRop As Integer) As Integer Private Const SRCCOPY = &HCC0020 ' (DWORD) dest = source Private x As Integer Private y As Integer Private Sub Form1_Load(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles Me.Load Dim gr1 As Graphics Dim gr2 As Graphics Me.PictureBox1.Image = New Bitmap(480, 256) Me.PictureBox1.Width = Me.PictureBox1.Image.Width Me.PictureBox1.Height = Me.PictureBox1.Image.Height gr1 = Graphics.FromImage(Me.PictureBox1.Image) gr1.DrawImage(Image.FromFile("..\..\..\chipset13.png"), 0, 0) gr1.Dispose() Me.PictureBox2.Image = New Bitmap(32, 32) x = 0 y = 0 End Sub Private Sub Button1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button1.Click Dim g1 As Graphics = PictureBox1.CreateGraphics() Dim g2 As Graphics = PictureBox2.CreateGraphics() Dim srcdc As IntPtr = g1.GetHdc() Dim destdc As IntPtr = g2.GetHdc() Dim retval As Integer retval = StretchBlt(destdc, 0, 0, 32, 32, _ srcdc, x, y, 16, 16, SRCCOPY) g2.ReleaseHdc(destdc) g1.ReleaseHdc(srcdc) g2.Dispose() g1.Dispose() x += 16 If x > 320 Then x = 0 y += 16 End If End Sub End Class