home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1999 February
/
VPR9902A.BIN
/
Vpr_data
/
Program
/
vb
/
prog
/
FormMain.frm
next >
Wrap
Text File
|
1998-11-17
|
9KB
|
275 lines
VERSION 5.00
Begin VB.Form FormMain
BorderStyle = 0 'なし
Caption = "Form1"
ClientHeight = 3060
ClientLeft = 0
ClientTop = 0
ClientWidth = 5685
BeginProperty Font
Name = "MS Pゴシック"
Size = 12
Charset = 128
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
ScaleHeight = 3060
ScaleMode = 0 'ユーザー
ScaleWidth = 5685
ShowInTaskbar = 0 'False
StartUpPosition = 3 'Windows の既定値
Begin VB.PictureBox PictureClockDraw
Appearance = 0 'フラット
BackColor = &H00000000&
BorderStyle = 0 'なし
BeginProperty Font
Name = "Courier New"
Size = 14.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 2775
Left = 1920
ScaleHeight = 2775
ScaleWidth = 3615
TabIndex = 1
Top = 120
Width = 3615
End
Begin VB.Timer TimerClockDraw
Interval = 1000
Left = 120
Top = 1440
End
Begin VB.PictureBox PictureBlack
Appearance = 0 'フラット
AutoRedraw = -1 'True
BackColor = &H00404040&
BorderStyle = 0 'なし
BeginProperty Font
Name = "MS Pゴシック"
Size = 9
Charset = 128
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 1215
Left = 120
ScaleHeight = 1215
ScaleWidth = 1575
TabIndex = 0
Top = 120
Width = 1575
End
End
Attribute VB_Name = "FormMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Const Pi = 3.14159265358979
Private Const TwoPi = Pi + Pi
Private Const HalfPi = Pi / 2
Private Sub Form_Load()
Dim Res As Long
Dim ResMCIStr As String * 256
Dim hwndSrc As Long, hSrcDC As Long
'デスクトップ画面全体をコピー
Left = 0
Top = 0
Width = Screen.Width
Height = Screen.Height
Move 0, 0, Screen.Width, Screen.Height
PictureBlack.Move 0, 0, Screen.Width, Screen.Height
Show
PictureBlack.ScaleMode = vbPixels
hwndSrc = GetDesktopWindow()
hSrcDC = GetDC(hwndSrc)
Res = BitBlt(PictureBlack.hdc, 0, 0, PictureBlack.ScaleWidth, _
PictureBlack.ScaleHeight, hSrcDC, 0, 0, SRCAND)
Res = ReleaseDC(hwndSrc, hSrcDC)
'CD演奏
Res = mciSendString("open cdaudio", ResMCIStr, 256, 0)
Res = mciSendString("play cdaudio", ResMCIStr, 256, 0)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Dim Res As Long
Dim ResMCIStr As String * 256
'CD停止
Res = mciSendString("stop cdaudio", ResMCIStr, 256, 0)
Res = mciSendString("close cdaudio", ResMCIStr, 256, 0)
End Sub
Private Sub PictureBlack_Click()
flagQuit = True
End Sub
Private Sub PictureBlack_KeyDown(KeyCode As Integer, Shift As Integer)
flagQuit = True
End Sub
Private Sub PictureBlack_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Static ptrXlast As Integer
Static ptrYlast As Integer
Dim ptrXnow As Integer
Dim ptrYnow As Integer
ptrXnow = x
ptrYnow = y
If ptrXlast = 0 And ptrYlast = 0 Then
ptrXlast = ptrXnow
ptrYlast = ptrYnow
Exit Sub
End If
If ptrXnow <> ptrXlast Or ptrYnow <> ptrYlast Then
flagQuit = True
End If
End Sub
Private Sub TimerClockDraw_Timer()
Dim Res As Long
Dim valTimeH As Integer
Dim valTimeM As Integer
Dim valTimeS As Integer
Dim valDegH As Double
Dim valDegM As Double
Dim valDegS As Double
Dim valPtHx As Double
Dim valPtHy As Double
Dim valPtMx As Double
Dim valPtMy As Double
Dim valPtSx As Double
Dim valPtSy As Double
Dim ResMCIStr As String * 256
Static countMove As Integer
'現在の秒の値を追跡
Static LastSecond
'秒の更新チェック
If Second(Now) = LastSecond Then
Exit Sub
Else
LastSecond = Second(Now)
End If
'背景イメージ復活
With PictureClockDraw
.Visible = False
.ScaleMode = vbPixels
If countMove <= 0 Then
countMove = 4
' .Width = .Height / 3 * 4
.Left = Int(Rnd * (FormMain.Width - .Width))
.Top = Int(Rnd * (FormMain.Height - .Height))
End If
countMove = countMove - 1
.Visible = True
.Cls
End With
PictureBlack.ScaleMode = vbPixels
Res = BitBlt(PictureClockDraw.hdc, 0, 0, _
PictureClockDraw.ScaleWidth, PictureClockDraw.ScaleHeight, _
PictureBlack.hdc, _
FormMain.ScaleX(PictureClockDraw.Left, vbTwips, vbPixels), _
FormMain.ScaleY(PictureClockDraw.Top, vbTwips, vbPixels), _
SRCCOPY)
'時刻変数更新
valTimeH = Hour(Now)
valTimeM = Minute(Now)
valTimeS = Second(Now)
'針の角度計算
valDegH = TwoPi * (valTimeH + valTimeM / 60) / 12 - HalfPi
valDegM = TwoPi * (valTimeM + valTimeS / 60) / 60 - HalfPi
valDegS = TwoPi * valTimeS / 60 - HalfPi
'針の終端点計算
valPtHx = 0.4 * Cos(valDegH)
valPtHy = 0.4 * Sin(valDegH)
valPtMx = 0.7 * Cos(valDegM)
valPtMy = 0.7 * Sin(valDegM)
valPtSx = 0.9 * Cos(valDegS)
valPtSy = 0.9 * Sin(valDegS)
'時計縁取り表示
Dim rat As Single
PictureClockDraw.Scale
rat = PictureClockDraw.ScaleWidth / PictureClockDraw.ScaleHeight
PictureClockDraw.Scale (-1, -1)-(1, 1)
PictureClockDraw.DrawWidth = 3
PictureClockDraw.Circle (0, 0), 0.95, RGB(50, 100, 50), , , 1 / rat
PictureClockDraw.Scale (-rat, -1)-(rat, 1)
PictureClockDraw.DrawWidth = 5
PictureClockDraw.Circle (0, 0), 0.8, RGB(50, 50, 150)
'新しい針を描画
PictureClockDraw.DrawWidth = 3
PictureClockDraw.Line (0, 0)-(valPtMx, valPtMy), RGB(255, 255, 255)
PictureClockDraw.DrawWidth = 3
PictureClockDraw.Line (0, 0)-(valPtHx, valPtHy), RGB(255, 255, 255)
PictureClockDraw.DrawWidth = 1
PictureClockDraw.Line (0, 0)-(valPtSx, valPtSy), RGB(255, 255, 255)
Dim strPrint As String
Dim ptrX As Integer
Dim ptrY As Integer
'現在時刻表示
PictureClockDraw.ScaleMode = vbPixels
strPrint = Format$(Now, "hh:mm:ss")
ptrX = PictureClockDraw.ScaleWidth \ 2
ptrY = PictureClockDraw.ScaleHeight \ 2
PictureClockDraw.CurrentX = ptrX - PictureClockDraw.TextWidth(strPrint) \ 2
PictureClockDraw.CurrentY = -50 + ptrY - PictureClockDraw.TextHeight(strPrint) \ 2
PictureClockDraw.Print strPrint
'演奏中トラック表示
Res = mciSendString("status cdaudio media present", ResMCIStr, 256, 0)
If StrComp(ResMCIStr, "True", vbTextCompare) Then
Exit Sub
End If
Res = mciSendString("status cdaudio current track", ResMCIStr, 256, 0)
PictureClockDraw.ScaleMode = vbPixels
Res = Val(ResMCIStr)
strPrint = "Track " + Format$(Res, "#0")
ptrX = PictureClockDraw.ScaleWidth \ 2
ptrY = PictureClockDraw.ScaleHeight \ 2
PictureClockDraw.CurrentX = ptrX - PictureClockDraw.TextWidth(strPrint) \ 2
PictureClockDraw.CurrentY = 50 + ptrY - PictureClockDraw.TextHeight(strPrint) \ 2
PictureClockDraw.Print strPrint
'演奏中ポジション表示
Res = mciSendString("status cdaudio position", ResMCIStr, 256, 0)
PictureClockDraw.ScaleMode = vbPixels
strPrint = "Position " + Left(ResMCIStr, 5)
ptrX = PictureClockDraw.ScaleWidth \ 2
ptrY = PictureClockDraw.ScaleHeight \ 2
PictureClockDraw.CurrentX = ptrX - PictureClockDraw.TextWidth(strPrint) \ 2
PictureClockDraw.CurrentY = 20 + ptrY - PictureClockDraw.TextHeight(strPrint) \ 2
PictureClockDraw.Print strPrint
End Sub