frmtiles.frm

来自「VB编写的RPG游戏演示,适合VB游戏初学者的参考。」· FRM 代码 · 共 78 行

FRM
78 行
字号
VERSION 5.00
Begin VB.Form frmTiles 
   AutoRedraw      =   -1  'True
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Tile Set"
   ClientHeight    =   7200
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   9600
   ForeColor       =   &H000000FF&
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   480
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   640
End
Attribute VB_Name = "frmTiles"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()

    'Paint the form
    Form_Paint

End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)

    'Change the active tile when form is clicked
    gintTileX = x \ TILE_WIDTH
    gintTileY = y \ TILE_HEIGHT
    frmInfo.UpdateInfo
        
    'Repaint the form
    Form_Paint
    
End Sub

Private Sub DrawBox()

Dim intX As Integer
Dim intY As Integer

    'Draw a box
    intX = gintTileX * TILE_WIDTH
    intY = gintTileY * TILE_HEIGHT
    MoveToEx Me.hdc, intX, intY, gudtPoint
    LineTo Me.hdc, intX + TILE_WIDTH, intY
    LineTo Me.hdc, intX + TILE_WIDTH, intY + TILE_HEIGHT
    LineTo Me.hdc, intX, intY + TILE_HEIGHT
    LineTo Me.hdc, intX, intY

End Sub

Private Sub Form_Paint()

    'Clear the form
    Me.Cls

    'Display the bitmap
    StretchDIBits Me.hdc, 0, 0, gBMPInfo.bmiHeader.biWidth, gBMPInfo.bmiHeader.biHeight, 0, 0, gBMPInfo.bmiHeader.biWidth, gBMPInfo.bmiHeader.biHeight, gBMPData(0), gBMPInfo, DIB_RGB_COLORS, vbSrcCopy
    
    'Draw the box
    DrawBox
    
End Sub

Private Sub Form_Unload(Cancel As Integer)
    
    'Check for dirtiness before exiting
    Cancel = ExitProgram()

End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?