home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form TileForm
- Caption = "Tile"
- ClientHeight = 4350
- ClientLeft = 1740
- ClientTop = 1185
- ClientWidth = 5535
- Height = 5040
- Left = 1680
- LinkTopic = "Form1"
- ScaleHeight = 290
- ScaleMode = 3 'Pixel
- ScaleWidth = 369
- Top = 555
- Width = 5655
- Begin VB.PictureBox Canvas
- AutoRedraw = -1 'True
- Height = 4335
- Left = 1200
- ScaleHeight = 285
- ScaleMode = 3 'Pixel
- ScaleWidth = 285
- TabIndex = 0
- Top = 0
- Width = 4335
- End
- Begin VB.Image Tile
- Height = 405
- Index = 4
- Left = 0
- Picture = "TileHex.frx":0000
- Top = 3240
- Width = 465
- End
- Begin VB.Image Mask
- Height = 405
- Index = 4
- Left = 600
- Picture = "TileHex.frx":07A2
- Top = 3240
- Visible = 0 'False
- Width = 465
- End
- Begin VB.Image Mask
- Height = 405
- Index = 3
- Left = 600
- Picture = "TileHex.frx":0F44
- Top = 2760
- Visible = 0 'False
- Width = 465
- End
- Begin VB.Image Tile
- Height = 405
- Index = 3
- Left = 0
- Picture = "TileHex.frx":16E6
- Top = 2760
- Width = 465
- End
- Begin VB.Image Tile
- Height = 735
- Index = 2
- Left = 0
- Picture = "TileHex.frx":1E88
- Top = 1920
- Width = 735
- End
- Begin VB.Image Mask
- Height = 735
- Index = 2
- Left = 840
- Picture = "TileHex.frx":2CBE
- Top = 1920
- Visible = 0 'False
- Width = 735
- End
- Begin VB.Image Tile
- Height = 735
- Index = 1
- Left = 0
- Picture = "TileHex.frx":3AF4
- Top = 1080
- Width = 735
- End
- Begin VB.Image Mask
- Height = 735
- Index = 1
- Left = 840
- Picture = "TileHex.frx":492A
- Top = 1080
- Visible = 0 'False
- Width = 735
- End
- Begin VB.Image Mask
- Height = 975
- Index = 0
- Left = 840
- Picture = "TileHex.frx":5760
- Top = 0
- Visible = 0 'False
- Width = 1110
- End
- Begin VB.Image Tile
- Height = 975
- Index = 0
- Left = 0
- Picture = "TileHex.frx":5AB6
- Top = 0
- Width = 1110
- End
- Begin VB.Menu mnuFile
- Caption = "&File"
- Begin VB.Menu mnuFileExit
- Caption = "E&xit"
- End
- End
- Attribute VB_Name = "TileForm"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- Const MAX_TILE = 4
- Const MERGEPAINT = &HBB0226
- Const SRCAND = &H8800C6
- Dim TileChoice As Integer
- Dim ColDx(0 To MAX_TILE) As Integer
- Dim RowDx(0 To MAX_TILE) As Integer
- Dim RowDy(0 To MAX_TILE) As Integer
- ' ************************************************
- ' Tile the control with the Tile.
- ' ************************************************
- Sub TilePicture(pic As PictureBox, tile_image As Image, mask_image As Image, cdx As Integer, rdx As Integer, rdy As Integer)
- Dim x As Integer
- Dim y As Integer
- Dim x1 As Integer
- Dim x2 As Integer
- Dim startx As Integer
- pic.Cls ' Clear the picture box.
- ' Start above and to the left of the drawing area.
- y = -tile_image.Height
- x1 = -tile_image.Width
- x2 = x1 + rdx
- startx = x1
- ' Copy the tile until we're to the right and
- ' below the drawing area.
- Do While y <= pic.ScaleHeight
- x = startx
- Do While x <= pic.ScaleWidth
- ' Copy the mask with MERGEPAINT.
- pic.PaintPicture mask_image.Picture, x, y, , , , , , , MERGEPAINT
-
- ' Copy the mask with SRCAND.
- pic.PaintPicture tile_image.Picture, x, y, , , , , , , SRCAND
- x = x + cdx
- Loop
- If startx = x1 Then
- startx = x2
- Else
- startx = x1
- End If
- y = y + rdy
- Loop
- End Sub
- ' ************************************************
- ' Initialize row and column offsets.
- ' ************************************************
- Private Sub Form_Load()
- ColDx(0) = 108
- RowDx(0) = 54
- RowDy(0) = 31
- ColDx(1) = 72
- RowDx(1) = 35
- RowDy(1) = 20
- ColDx(2) = ColDx(1)
- RowDx(2) = RowDx(1)
- RowDy(2) = RowDy(1)
- ColDx(3) = ColDx(1)
- RowDx(3) = RowDx(1)
- RowDy(3) = RowDy(1)
- ColDx(4) = 46
- RowDx(4) = 23
- RowDy(4) = 13
- End Sub
- ' ************************************************
- ' Tile the form.
- ' ************************************************
- Private Sub Form_Resize()
- Canvas.Move Canvas.Left, 0, _
- TileForm.ScaleWidth - Canvas.Left, _
- TileForm.ScaleHeight
- TilePicture Canvas, Tile(TileChoice), Mask(TileChoice), ColDx(TileChoice), RowDx(TileChoice), RowDy(TileChoice)
- End Sub
- Private Sub mnuFileExit_Click()
- Unload Me
- End Sub
- Private Sub Tile_Click(Index As Integer)
- MousePointer = vbHourglass
- TileChoice = Index
- TilePicture Canvas, Tile(TileChoice), Mask(TileChoice), ColDx(TileChoice), RowDx(TileChoice), RowDy(TileChoice)
- MousePointer = vbDefault
- End Sub
-