----所需物件: PictureBox 一个。

 

 ----程式码(一):tile.bas

Declare Function BitBlt Lib "GDI" (ByVal hDestDC%, ByVal X%, ByVal Y%, _

ByVal nWidth%, ByVal nHeight%, ByVal hSrcDC%, ByVal XSrc%, ByVal YSrc%, _

ByVal dwRop&) As Integer

 

 ----程式码(二):

Sub Form_Paint ()

    Const PIXEL = 3

    Picture1.ScaleMode = PIXEL

    Me.ScaleMode = PIXEL

    X% = 0: Y% = 0

    nWidth% = Picture1.Width

    nHeight% = Picture1.Height

    dwRop& = &HCC0020

    Do While Y% < ScaleHeight

        Do While X% < ScaleWidth

            Suc% = BitBlt(Me.hDC, X%, Y%, nWidth%, nHeight%, Picture1.hDC, 0, 0, dwRop&)

            X% = X% + nWidth%

        Loop

        X% = 0

        Y% = Y% + nHeight%

    Loop

End Sub