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

📄 form1.frm

📁 自解Diablo II 的DC6图像文件格式(附自编文章)
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form1 
   Appearance      =   0  'Flat
   BackColor       =   &H00000000&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Form1"
   ClientHeight    =   3600
   ClientLeft      =   150
   ClientTop       =   840
   ClientWidth     =   4320
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   240
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   288
   StartUpPosition =   3  '窗口缺省
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   3720
      Top             =   3750
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.Frame Frame1 
      Appearance      =   0  'Flat
      BorderStyle     =   0  'None
      Enabled         =   0   'False
      ForeColor       =   &H80000008&
      Height          =   585
      Left            =   0
      TabIndex        =   1
      Top             =   2370
      Width           =   4305
      Begin VB.CommandButton Stop_x 
         Caption         =   "■"
         Enabled         =   0   'False
         Height          =   310
         Left            =   1300
         TabIndex        =   8
         ToolTipText     =   "停止"
         Top             =   150
         Width           =   500
      End
      Begin VB.CommandButton Command6 
         Caption         =   ">|"
         Height          =   310
         Left            =   3700
         TabIndex        =   7
         ToolTipText     =   "下一帧集"
         Top             =   150
         Width           =   500
      End
      Begin VB.CommandButton Command5 
         Caption         =   "|<"
         Height          =   310
         Left            =   3100
         TabIndex        =   6
         ToolTipText     =   "上一帧集"
         Top             =   150
         Width           =   500
      End
      Begin VB.CommandButton Command4 
         Caption         =   ">"
         Height          =   310
         Left            =   2500
         TabIndex        =   5
         ToolTipText     =   "下一帧"
         Top             =   150
         Width           =   500
      End
      Begin VB.CommandButton Command3 
         Caption         =   "<"
         Height          =   315
         Left            =   1900
         TabIndex        =   4
         ToolTipText     =   "上一帧"
         Top             =   150
         Width           =   500
      End
      Begin VB.CommandButton Pasue 
         Caption         =   "||"
         Enabled         =   0   'False
         Height          =   310
         Left            =   700
         TabIndex        =   3
         ToolTipText     =   "暂停"
         Top             =   150
         Width           =   500
      End
      Begin VB.CommandButton Play 
         Caption         =   "->"
         Height          =   310
         Left            =   100
         TabIndex        =   2
         ToolTipText     =   "播放"
         Top             =   150
         Width           =   500
      End
   End
   Begin VB.PictureBox Picture1 
      Appearance      =   0  'Flat
      BackColor       =   &H00404040&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   2370
      Left            =   0
      ScaleHeight     =   158
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   288
      TabIndex        =   0
      Top             =   0
      Width           =   4320
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      BackColor       =   &H00000000&
      Caption         =   "Label1"
      ForeColor       =   &H80000008&
      Height          =   645
      Left            =   0
      TabIndex        =   9
      Top             =   2970
      Width           =   4320
   End
   Begin VB.Menu File_0 
      Caption         =   "Flie[&F]"
      Begin VB.Menu Open 
         Caption         =   "Open[&O]"
      End
      Begin VB.Menu x 
         Caption         =   "-"
      End
      Begin VB.Menu Exit 
         Caption         =   "Exit[&X]"
      End
   End
   Begin VB.Menu Option 
      Caption         =   "Option[&P]"
      Begin VB.Menu Sel_Pal 
         Caption         =   "Select Pallet[&S]"
      End
   End
   Begin VB.Menu Help 
      Caption         =   "Help[&H]"
      Begin VB.Menu About 
         Caption         =   "About[&A]"
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Loaded As Boolean

Private Sub Command3_Click()
  
  Play_DC6.Frame = Play_DC6.Frame - 1
  If Play_DC6.Frame = -1 Then Play_DC6.Frame = Header.Frames_Per_Dir - 1
  
  DisPlay_Frame Picture1 ', Play_DC6.Frame

End Sub

Private Sub Command4_Click()
  
  Play_DC6.Frame = Play_DC6.Frame + 1
  If Play_DC6.Frame = Header.Frames_Per_Dir Then Play_DC6.Frame = 0
  
  DisPlay_Frame Picture1 ', Play_DC6.Frame
  
End Sub

Private Sub Form_Load()

  Loaded = False
  
  With Play_DC6
    
    .Play = False
    .Pause = False
    .Stop = True
    .Direction = 0
    .Frame = 0
    .Buffer = 1
    
  End With
  
End Sub

Private Sub Form_Unload(Cancel As Integer)
Stop_x_Click
End Sub

Private Sub Picture1_Paint()
  
  If Loaded Then
    Call SetDIBitsToDevice(Picture1.hDC, 0, 0, bi.bmiHeader.biWidth, bi.bmiHeader.biHeight, 0, 0, 0, bi.bmiHeader.biHeight, MapData(0), bi, DIB_RGB_COLORS)
  End If
  
End Sub

Private Sub Open_Click()

    With CommonDialog1
        .DialogTitle = "打开DC6文件"
        .CancelError = False
        'ToDo: 设置 common dialog 控件的标志和属性
        .Filter = "DC6文件|*.dc6"
        .ShowOpen
        If Len(.FileName) = 0 Then
            Exit Sub
        End If
        sFile = .FileName
    End With
    Form_Load
    Op
    
End Sub

Private Sub Op()
  
  Load_Palette "Fechar.dat" '"act1.dat" '色盘即调色板
  
  Open CommonDialog1.FileName For Binary As #1
  
  Load_DC6_File_Header 1
  Load_DC6_Frame_Header 1
  Find_Frame_Box
  
  Picture1.Width = w
  Picture1.Height = h
  
  If Me.ScaleWidth <= Picture1.Width Then
    
    Me.Width = Picture1.Width * 24
    
  Else
    
    Picture1.Left = (Me.ScaleWidth - Picture1.Width) \ 2
     
  End If
  
  If Me.ScaleHeight <= Picture1.Height + Frame1.Height + Label1.Height Then
    
    Me.Height = (Picture1.Height + Frame1.Height + Label1.Height + 29) * 16
    Label1.Top = Me.ScaleHeight - Label1.Height
    Frame1.Top = Me.ScaleHeight - Frame1.Height - Label1.Height
    
  Else
    
    Label1.Top = Me.ScaleHeight - Label1.Height
    Frame1.Top = Me.ScaleHeight - Frame1.Height - Label1.Height
    Picture1.Top = (Me.ScaleHeight - Picture1.Height - Frame1.Height - Label1.Height) \ 2
    
  End If
  
  DeCompres_DC6_Frame 1, 0
  
  
  DisPlay_Frame Picture1 ', 1
  
  Loaded = True
  Frame1.Enabled = True
  
  Close #1

End Sub

Private Sub Play_Click()

  Play_DC6.Stop = False
  Play_DC6.Play = True
  Stop_x.Enabled = True
  Play.Enabled = False
  Play_DC6_File Picture1
  
End Sub

Private Sub Stop_x_Click()
  
  Play_DC6.Stop = True
  Stop_x.Enabled = False
  Play.Enabled = True
  
End Sub

⌨️ 快捷键说明

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