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 Const SRCCOPY = &HCC0020 Private WithEvents pic1 As PictureBox
Sub Form_Load() Me.Move 0, 0, 11000, 8500 Set pic1 = Controls.Add("vb.picturebox", "pic1", Me) With pic1 .Visible = True .Move 3600, 2700, 3600, 2700 .ScaleMode = 3 .Appearance = 0 .BackColor = Me.BackColor .CurrentX = 0 .CurrentY = 0 .FontSize = 60 .ForeColor = vbBlue .FontName = "隶书" End With End Sub
Sub Form_Click() Dim w As Integer, h As Integer pic1.Print "人之初" & vbCrLf & "性本善" w = pic1.ScaleWidth h = pic1.ScaleHeight StretchBlt Me.hdc, w, h, -w, h, pic1.hdc, 0, 0, w, h, SRCCOPY StretchBlt Me.hdc, 3 * w, h, -w, h, pic1.hdc, 0, 0, w, h, SRCCOPY StretchBlt Me.hdc, w, h, w, -h, pic1.hdc, 0, 0, w, h, SRCCOPY StretchBlt Me.hdc, w, 3 * h, w, -h, pic1.hdc, 0, 0, w, h, SRCCOPY End Sub
效果如下:


|