home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 2000 February
/
VPR0002A.BIN
/
VPR_DATA
/
PROGRAM
/
VB
/
Form1.frm
next >
Wrap
Text File
|
1999-11-23
|
9KB
|
291 lines
VERSION 5.00
Object = "{C1A8AF28-1257-101B-8FB0-0020AF039CA3}#1.1#0"; "MCI32.OCX"
Begin VB.Form Form1
BorderStyle = 1 '固定(実線)
Caption = "Sound Player"
ClientHeight = 2340
ClientLeft = 36
ClientTop = 264
ClientWidth = 3744
LinkTopic = "Form1"
MaxButton = 0 'False
Picture = "Form1.frx":0000
ScaleHeight = 195
ScaleMode = 3 'ピクセル
ScaleWidth = 312
StartUpPosition = 3 'Windows の既定値
Begin VB.PictureBox Pbutton
AutoSize = -1 'True
BorderStyle = 0 'なし
Height = 180
Index = 5
Left = 3000
Picture = "Form1.frx":15FD4
ScaleHeight = 180
ScaleWidth = 480
TabIndex = 8
Top = 1320
Width = 480
End
Begin VB.PictureBox Pbutton
AutoSize = -1 'True
BorderStyle = 0 'なし
Height = 180
Index = 4
Left = 2400
Picture = "Form1.frx":16720
ScaleHeight = 180
ScaleWidth = 480
TabIndex = 7
Top = 1320
Width = 480
End
Begin VB.PictureBox Pbutton
AutoSize = -1 'True
BorderStyle = 0 'なし
Height = 180
Index = 3
Left = 1800
Picture = "Form1.frx":16E6C
ScaleHeight = 180
ScaleWidth = 480
TabIndex = 6
Top = 1320
Width = 480
End
Begin VB.PictureBox Slider
AutoSize = -1 'True
BorderStyle = 0 'なし
Height = 120
Left = 120
Picture = "Form1.frx":175B8
ScaleHeight = 120
ScaleWidth = 240
TabIndex = 5
Top = 1560
Width = 240
End
Begin VB.PictureBox Pbutton
AutoSize = -1 'True
BorderStyle = 0 'なし
Height = 180
Index = 2
Left = 1200
Picture = "Form1.frx":17854
ScaleHeight = 180
ScaleWidth = 480
TabIndex = 3
Top = 1320
Width = 480
End
Begin VB.PictureBox Pbutton
AutoSize = -1 'True
BorderStyle = 0 'なし
Height = 180
Index = 1
Left = 600
Picture = "Form1.frx":17FA0
ScaleHeight = 180
ScaleWidth = 480
TabIndex = 2
Top = 1320
Width = 480
End
Begin VB.PictureBox Pbutton
AutoSize = -1 'True
BorderStyle = 0 'なし
Height = 180
Index = 0
Left = 0
Picture = "Form1.frx":186EC
ScaleHeight = 180
ScaleWidth = 480
TabIndex = 1
Top = 1320
Width = 480
End
Begin MCI.MMControl MMControl1
Height = 372
Left = 0
TabIndex = 0
Top = 1800
Visible = 0 'False
Width = 3012
_ExtentX = 5313
_ExtentY = 656
_Version = 393216
UpdateInterval = 100
PrevEnabled = -1 'True
NextEnabled = -1 'True
PlayEnabled = -1 'True
PauseEnabled = -1 'True
StopEnabled = -1 'True
Silent = -1 'True
DeviceType = "Sequencer"
FileName = ""
End
Begin VB.Image Clbutton
Height = 132
Left = 720
Top = 1560
Width = 252
End
Begin VB.Label Label1
Alignment = 2 '中央揃え
AutoSize = -1 'True
BackColor = &H00000000&
BeginProperty Font
Name = "MS Pゴシック"
Size = 9
Charset = 128
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FF00&
Height = 180
Left = 480
TabIndex = 4
Top = 1560
Width = 108
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'********************************************************************
'*
'* サウンドプレイヤーサンプル1
'*
'* MMControlを使う
'*
'* Copyright(c) 1999' Impress,Grandmaster
'*
'********************************************************************
Option Explicit
Dim Filename As String
'********************************************************************
'* フォームのロード
'********************************************************************
Private Sub Form_Load()
'フォームのサイズを設定する
Me.Width = Me.Width - Me.ScaleWidth * Screen.TwipsPerPixelX + 300 * Screen.TwipsPerPixelX
Me.Height = Me.Height - Me.ScaleHeight * Screen.TwipsPerPixelY + 100 * Screen.TwipsPerPixelY
Me.Left = 0
Me.Top = 0
'ボタンのサイズを設定する
Label1.Move 29, 33, 255, 20
Slider.Move 15, 57, 20, 10
Pbutton(0).Move 20, 80, 40, 15
Pbutton(1).Move 60, 80, 40, 15
Pbutton(2).Move 100, 80, 40, 15
Pbutton(3).Move 140, 80, 40, 15
Pbutton(4).Move 180, 80, 40, 15
Pbutton(5).Move 243, 80, 40, 15
Clbutton.Move 287, 3, 9, 8
'ボタンのVisibleを設定する
Pbutton(0).Visible = False
Pbutton(1).Visible = True
Pbutton(2).Visible = False
Pbutton(3).Visible = False
Pbutton(4).Visible = False
Filename = "Sample.MID"
End Sub
'********************************************************************
'* ラベルのtop位置設定
'********************************************************************
Private Sub label1_Change()
'VBのラベルはラベル内の文字の上下位置がセンターに
'なるプロパティがないので、ラベルのtop位置を固定
'すると、フォント環境によって文字が上よりになったり
'してしまう。
'そこでラベルのAutosizeをTrueにしておき、ラベルを表
'示する領域の高さからラベルの高さを引き、それを2で
'割って真ん中にくるようにtop位置を調節する
Label1.Top = Int(33 + (20 - Label1.Height) / 2)
End Sub
'********************************************************************
'* MMコントロールのアップデートイベント
'********************************************************************
Private Sub MMControl1_StatusUpdate()
'ポーズ中
If MMControl1.Mode = mciModePause Then
Label1.Caption = Filename + "... Pausing"
'停止中
ElseIf MMControl1.Mode = mciModeStop Then
MMControl1.Command = "Prev" '巻き戻す
Label1.Caption = Filename + "... Stopped"
Pbutton(0).Visible = False '各ボタンを設定する
Pbutton(1).Visible = True
Pbutton(2).Visible = False
Pbutton(3).Visible = False
Pbutton(4).Visible = False
'再生中
ElseIf MMControl1.Mode = mciModePlay Then
Label1.Caption = Filename + " ...Playing"
End If
End Sub
'********************************************************************
'* ボタンのクリック
'********************************************************************
Private Sub Pbutton_Click(Index As Integer)
Dim t As Single
'ボタン位置を下げる
Pbutton(Index).Top = Pbutton(Index).Top + 1
Pbutton(Index).Refresh
'少し時間を空ける
t = Timer
Do While Timer < t + 0.2
Loop
'ボタンごとの処理
Select Case Index
'前へボタン
Case 0
MMControl1.Command = "Prev"
'再生ボタン
Case 1
MMControl1.Filename = App.Path + "\" + Filename
MMControl1.Command = "Open"
MMControl1.Command = "Play"
Pbutton(0).Visible = True
Pbutton(1).Visible = False
Pbutton(2).Visible = True
Pbutton(3).Visible = True
Pbutton(4).Visible = True
'停止ボタン
Case 2
MMControl1.Command = "Stop"
MMControl1.Command = "Prev"
'ポーズボタン
Case 3
MMControl1.Command = "Pause"
'次へボタン
'クリックしたとき、頭に戻るのはバグではない
'トラックが一つの場合、Nextを送ると頭に戻る
Case 4
MMControl1.Command = "Next"
End Select
'ボタン位置を上げる
Pbutton(Index).Top = Pbutton(Index).Top - 1
End Sub
'********************************************************************
'* 終了ボタンクリック
'********************************************************************
Private Sub Clbutton_Click()
End
End Sub