home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 2000 February / VPR0002A.BIN / VPR_DATA / PROGRAM / VB / Form1.frm next >
Text File  |  1999-11-23  |  9KB  |  291 lines

  1. VERSION 5.00
  2. Object = "{C1A8AF28-1257-101B-8FB0-0020AF039CA3}#1.1#0"; "MCI32.OCX"
  3. Begin VB.Form Form1 
  4.    BorderStyle     =   1  '固定(実線)
  5.    Caption         =   "Sound Player"
  6.    ClientHeight    =   2340
  7.    ClientLeft      =   36
  8.    ClientTop       =   264
  9.    ClientWidth     =   3744
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    Picture         =   "Form1.frx":0000
  13.    ScaleHeight     =   195
  14.    ScaleMode       =   3  'ピクセル
  15.    ScaleWidth      =   312
  16.    StartUpPosition =   3  'Windows の既定値
  17.    Begin VB.PictureBox Pbutton 
  18.       AutoSize        =   -1  'True
  19.       BorderStyle     =   0  'なし
  20.       Height          =   180
  21.       Index           =   5
  22.       Left            =   3000
  23.       Picture         =   "Form1.frx":15FD4
  24.       ScaleHeight     =   180
  25.       ScaleWidth      =   480
  26.       TabIndex        =   8
  27.       Top             =   1320
  28.       Width           =   480
  29.    End
  30.    Begin VB.PictureBox Pbutton 
  31.       AutoSize        =   -1  'True
  32.       BorderStyle     =   0  'なし
  33.       Height          =   180
  34.       Index           =   4
  35.       Left            =   2400
  36.       Picture         =   "Form1.frx":16720
  37.       ScaleHeight     =   180
  38.       ScaleWidth      =   480
  39.       TabIndex        =   7
  40.       Top             =   1320
  41.       Width           =   480
  42.    End
  43.    Begin VB.PictureBox Pbutton 
  44.       AutoSize        =   -1  'True
  45.       BorderStyle     =   0  'なし
  46.       Height          =   180
  47.       Index           =   3
  48.       Left            =   1800
  49.       Picture         =   "Form1.frx":16E6C
  50.       ScaleHeight     =   180
  51.       ScaleWidth      =   480
  52.       TabIndex        =   6
  53.       Top             =   1320
  54.       Width           =   480
  55.    End
  56.    Begin VB.PictureBox Slider 
  57.       AutoSize        =   -1  'True
  58.       BorderStyle     =   0  'なし
  59.       Height          =   120
  60.       Left            =   120
  61.       Picture         =   "Form1.frx":175B8
  62.       ScaleHeight     =   120
  63.       ScaleWidth      =   240
  64.       TabIndex        =   5
  65.       Top             =   1560
  66.       Width           =   240
  67.    End
  68.    Begin VB.PictureBox Pbutton 
  69.       AutoSize        =   -1  'True
  70.       BorderStyle     =   0  'なし
  71.       Height          =   180
  72.       Index           =   2
  73.       Left            =   1200
  74.       Picture         =   "Form1.frx":17854
  75.       ScaleHeight     =   180
  76.       ScaleWidth      =   480
  77.       TabIndex        =   3
  78.       Top             =   1320
  79.       Width           =   480
  80.    End
  81.    Begin VB.PictureBox Pbutton 
  82.       AutoSize        =   -1  'True
  83.       BorderStyle     =   0  'なし
  84.       Height          =   180
  85.       Index           =   1
  86.       Left            =   600
  87.       Picture         =   "Form1.frx":17FA0
  88.       ScaleHeight     =   180
  89.       ScaleWidth      =   480
  90.       TabIndex        =   2
  91.       Top             =   1320
  92.       Width           =   480
  93.    End
  94.    Begin VB.PictureBox Pbutton 
  95.       AutoSize        =   -1  'True
  96.       BorderStyle     =   0  'なし
  97.       Height          =   180
  98.       Index           =   0
  99.       Left            =   0
  100.       Picture         =   "Form1.frx":186EC
  101.       ScaleHeight     =   180
  102.       ScaleWidth      =   480
  103.       TabIndex        =   1
  104.       Top             =   1320
  105.       Width           =   480
  106.    End
  107.    Begin MCI.MMControl MMControl1 
  108.       Height          =   372
  109.       Left            =   0
  110.       TabIndex        =   0
  111.       Top             =   1800
  112.       Visible         =   0   'False
  113.       Width           =   3012
  114.       _ExtentX        =   5313
  115.       _ExtentY        =   656
  116.       _Version        =   393216
  117.       UpdateInterval  =   100
  118.       PrevEnabled     =   -1  'True
  119.       NextEnabled     =   -1  'True
  120.       PlayEnabled     =   -1  'True
  121.       PauseEnabled    =   -1  'True
  122.       StopEnabled     =   -1  'True
  123.       Silent          =   -1  'True
  124.       DeviceType      =   "Sequencer"
  125.       FileName        =   ""
  126.    End
  127.    Begin VB.Image Clbutton 
  128.       Height          =   132
  129.       Left            =   720
  130.       Top             =   1560
  131.       Width           =   252
  132.    End
  133.    Begin VB.Label Label1 
  134.       Alignment       =   2  '中央揃え
  135.       AutoSize        =   -1  'True
  136.       BackColor       =   &H00000000&
  137.       BeginProperty Font 
  138.          Name            =   "MS Pゴシック"
  139.          Size            =   9
  140.          Charset         =   128
  141.          Weight          =   700
  142.          Underline       =   0   'False
  143.          Italic          =   0   'False
  144.          Strikethrough   =   0   'False
  145.       EndProperty
  146.       ForeColor       =   &H0000FF00&
  147.       Height          =   180
  148.       Left            =   480
  149.       TabIndex        =   4
  150.       Top             =   1560
  151.       Width           =   108
  152.    End
  153. End
  154. Attribute VB_Name = "Form1"
  155. Attribute VB_GlobalNameSpace = False
  156. Attribute VB_Creatable = False
  157. Attribute VB_PredeclaredId = True
  158. Attribute VB_Exposed = False
  159. '********************************************************************
  160. '*
  161. '* サウンドプレイヤーサンプル1
  162. '*
  163. '*  MMControlを使う
  164. '*
  165. '* Copyright(c) 1999' Impress,Grandmaster
  166. '*
  167. '********************************************************************
  168. Option Explicit
  169. Dim Filename As String
  170. '********************************************************************
  171. '* フォームのロード
  172. '********************************************************************
  173. Private Sub Form_Load()
  174.     'フォームのサイズを設定する
  175.     Me.Width = Me.Width - Me.ScaleWidth * Screen.TwipsPerPixelX + 300 * Screen.TwipsPerPixelX
  176.     Me.Height = Me.Height - Me.ScaleHeight * Screen.TwipsPerPixelY + 100 * Screen.TwipsPerPixelY
  177.     Me.Left = 0
  178.     Me.Top = 0
  179.     'ボタンのサイズを設定する
  180.     Label1.Move 29, 33, 255, 20
  181.     Slider.Move 15, 57, 20, 10
  182.     Pbutton(0).Move 20, 80, 40, 15
  183.     Pbutton(1).Move 60, 80, 40, 15
  184.     Pbutton(2).Move 100, 80, 40, 15
  185.     Pbutton(3).Move 140, 80, 40, 15
  186.     Pbutton(4).Move 180, 80, 40, 15
  187.     Pbutton(5).Move 243, 80, 40, 15
  188.     Clbutton.Move 287, 3, 9, 8
  189.     'ボタンのVisibleを設定する
  190.     Pbutton(0).Visible = False
  191.     Pbutton(1).Visible = True
  192.     Pbutton(2).Visible = False
  193.     Pbutton(3).Visible = False
  194.     Pbutton(4).Visible = False
  195.     Filename = "Sample.MID"
  196.    
  197. End Sub
  198. '********************************************************************
  199. '* ラベルのtop位置設定
  200. '********************************************************************
  201. Private Sub label1_Change()
  202.     'VBのラベルはラベル内の文字の上下位置がセンターに
  203.     'なるプロパティがないので、ラベルのtop位置を固定
  204.     'すると、フォント環境によって文字が上よりになったり
  205.     'してしまう。
  206.     'そこでラベルのAutosizeをTrueにしておき、ラベルを表
  207.     '示する領域の高さからラベルの高さを引き、それを2で
  208.     '割って真ん中にくるようにtop位置を調節する
  209.     Label1.Top = Int(33 + (20 - Label1.Height) / 2)
  210.     
  211. End Sub
  212.  
  213. '********************************************************************
  214. '* MMコントロールのアップデートイベント
  215. '********************************************************************
  216. Private Sub MMControl1_StatusUpdate()
  217.     
  218.     'ポーズ中
  219.     If MMControl1.Mode = mciModePause Then
  220.         Label1.Caption = Filename + "... Pausing"
  221.     '停止中
  222.     ElseIf MMControl1.Mode = mciModeStop Then
  223.         MMControl1.Command = "Prev" '巻き戻す
  224.         Label1.Caption = Filename + "... Stopped"
  225.         Pbutton(0).Visible = False '各ボタンを設定する
  226.         Pbutton(1).Visible = True
  227.         Pbutton(2).Visible = False
  228.         Pbutton(3).Visible = False
  229.         Pbutton(4).Visible = False
  230.     '再生中
  231.     ElseIf MMControl1.Mode = mciModePlay Then
  232.         Label1.Caption = Filename + " ...Playing"
  233.     End If
  234.     
  235. End Sub
  236.  
  237. '********************************************************************
  238. '* ボタンのクリック
  239. '********************************************************************
  240. Private Sub Pbutton_Click(Index As Integer)
  241. Dim t As Single
  242.  
  243.     'ボタン位置を下げる
  244.     Pbutton(Index).Top = Pbutton(Index).Top + 1
  245.     Pbutton(Index).Refresh
  246.     '少し時間を空ける
  247.     t = Timer
  248.     Do While Timer < t + 0.2
  249.     Loop
  250.     
  251.     'ボタンごとの処理
  252.     Select Case Index
  253.         '前へボタン
  254.         Case 0
  255.             MMControl1.Command = "Prev"
  256.         '再生ボタン
  257.         Case 1
  258.             MMControl1.Filename = App.Path + "\" + Filename
  259.             MMControl1.Command = "Open"
  260.             MMControl1.Command = "Play"
  261.             Pbutton(0).Visible = True
  262.             Pbutton(1).Visible = False
  263.             Pbutton(2).Visible = True
  264.             Pbutton(3).Visible = True
  265.             Pbutton(4).Visible = True
  266.         '停止ボタン
  267.         Case 2
  268.             MMControl1.Command = "Stop"
  269.             MMControl1.Command = "Prev"
  270.         'ポーズボタン
  271.         Case 3
  272.             MMControl1.Command = "Pause"
  273.         '次へボタン
  274.         'クリックしたとき、頭に戻るのはバグではない
  275.         'トラックが一つの場合、Nextを送ると頭に戻る
  276.         Case 4
  277.             MMControl1.Command = "Next"
  278.     End Select
  279.     
  280.     'ボタン位置を上げる
  281.     Pbutton(Index).Top = Pbutton(Index).Top - 1
  282.     
  283. End Sub
  284. '********************************************************************
  285. '* 終了ボタンクリック
  286. '********************************************************************
  287. Private Sub Clbutton_Click()
  288.     End
  289. End Sub
  290.  
  291.