⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 snakex地图编辑器.frm

📁 数据结构课程设计 描述如下: 现有一个大小为Map_Long * Map_Width的方格地图(每一方格尺寸为BoxSize * BoxSize)
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   BackColor       =   &H00FFFFFF&
   BorderStyle     =   4  'Fixed ToolWindow
   Caption         =   "SnakeX地图编辑器(简版)"
   ClientHeight    =   5025
   ClientLeft      =   3555
   ClientTop       =   2625
   ClientWidth     =   7050
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   335
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   470
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton Command1 
      Caption         =   "显示地图"
      Height          =   1215
      Left            =   45
      TabIndex        =   4
      Top             =   3540
      Width           =   375
   End
   Begin VB.TextBox Text1 
      Height          =   1335
      Left            =   480
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   3
      Top             =   3480
      Width           =   6015
   End
   Begin VB.PictureBox Picture1 
      AutoRedraw      =   -1  'True
      Height          =   255
      Left            =   7560
      Picture         =   "SnakeX地图编辑器.frx":0000
      ScaleHeight     =   195
      ScaleWidth      =   195
      TabIndex        =   1
      Top             =   720
      Width           =   255
   End
   Begin VB.PictureBox Picture2 
      AutoRedraw      =   -1  'True
      Height          =   255
      Left            =   7560
      Picture         =   "SnakeX地图编辑器.frx":0182
      ScaleHeight     =   13
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   13
      TabIndex        =   0
      Top             =   1200
      Width           =   255
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFFFFF&
      Caption         =   "Label1"
      Height          =   255
      Left            =   2640
      TabIndex        =   2
      Top             =   75
      Width           =   1215
   End
   Begin VB.Line Line5 
      X1              =   32
      X2              =   432
      Y1              =   22
      Y2              =   22
   End
   Begin VB.Line Line3 
      X1              =   31
      X2              =   31
      Y1              =   23
      Y2              =   223
   End
   Begin VB.Line Line2 
      X1              =   432
      X2              =   432
      Y1              =   23
      Y2              =   223
   End
   Begin VB.Line Line1 
      X1              =   32
      X2              =   432
      Y1              =   223
      Y2              =   223
   End
   Begin VB.Menu ClearMap 
      Caption         =   "清除地图(&C)"
   End
   Begin VB.Menu MapRr 
      Caption         =   "地图刷新(&R)"
   End
   Begin VB.Menu aboutme 
      Caption         =   "关于程序(&A)"
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False





Private Sub aboutme_Click()
Text1.Text = "程序开发: PhiL Cheng  (陈诚)" & vbCrLf & " (C) PhiL Cheng Soft 2007"
End Sub

Private Sub ClearMap_Click()
Dim i As Integer
Dim j As Integer
For j = 0 To Map_Width - 1
For i = 0 To Map_Long - 1
MAP(i, j) = EmptyPlace
Next
Next

For j = 0 To Map_Width - 1
For i = 0 To Map_Long - 1
BitBlt Me.hDC, i * BoxSize + 32, j * BoxSize + 23, 10, 10, Picture1.hDC, 0, 0, vbSrcCopy
Next
Next
End Sub

Private Sub Command1_Click()
Dim i As Integer
Dim j As Integer
Dim str As String
str = ""
For i = 0 To Map_Long - 1
For j = 0 To Map_Width - 1
str = str & MAP(i, j) & ","
Next
str = str & vbCrLf
Next
Text1.Text = str
DoEvents
End Sub

Private Sub Form_Load()
Dim i As Integer
Dim j As Integer
For j = 0 To Map_Width - 1
For i = 0 To Map_Long - 1
MAP(i, j) = EmptyPlace
Next
Next
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim KickX As Integer
Dim KickY As Integer
Dim BlockX As Integer
Dim BlockY As Integer
KickX = X - 32
KickY = Y - 23
BlockX = Fix(KickX / BoxSize)
BlockY = Fix(KickY / BoxSize)
If BlockX > 39 Then BlockX = 39
If BlockY > 19 Then BlockY = 19

If X > 31 And X < 432 And Y < 223 And Y > 22 And Button = 1 Then
BitBlt Me.hDC, BlockX * BoxSize + 32, BlockY * BoxSize + 23, 10, 10, Picture2.hDC, 0, 0, vbSrcCopy
MAP(BlockX, BlockY) = NotEmptyPlace
End If

If X > 31 And X < 432 And Y < 223 And Y > 22 And Button = 2 Then
BitBlt Me.hDC, BlockX * BoxSize + 32, BlockY * BoxSize + 23, 10, 10, Picture1.hDC, 0, 0, vbSrcCopy
MAP(BlockX, BlockY) = EmptyPlace
End If
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label1.Caption = "(" & X & "," & Y & ")"
End Sub

Private Sub MapRr_Click()
Dim i As Integer
Dim j As Integer
For j = 0 To Map_Width - 1
For i = 0 To Map_Long - 1
If MAP(i, j) = NotEmptyPlace Then
BitBlt Me.hDC, i * BoxSize + 32, j * BoxSize + 23, 10, 10, Picture2.hDC, 0, 0, vbSrcCopy
End If
If MAP(i, j) = EmptyPlace Then
BitBlt Me.hDC, i * BoxSize + 32, j * BoxSize + 23, 10, 10, Picture1.hDC, 0, 0, vbSrcCopy
End If
Next
Next

End Sub

⌨️ 快捷键说明

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