📄 frmmain.frm
字号:
VERSION 5.00
Begin VB.Form frmMain
AutoRedraw = -1 'True
BackColor = &H000000FF&
BorderStyle = 0 'None
Caption = "cfmp3"
ClientHeight = 930
ClientLeft = 105
ClientTop = 105
ClientWidth = 1845
Icon = "frmMain.frx":0000
LinkTopic = "cfmp3"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 930
ScaleWidth = 1845
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Begin VB.Image Nimg
Height = 165
Left = 660
Top = 720
Width = 465
End
Begin VB.Image Bimg
Height = 165
Left = 180
Top = 720
Width = 255
End
Begin VB.Image Simg
Height = 225
Left = 690
Top = 420
Width = 435
End
Begin VB.Image Pimg
Height = 165
Left = 120
Top = 450
Width = 405
End
Begin VB.Image Mp3Play
Height = 240
Left = 315
Top = 0
Width = 315
End
Begin VB.Image Mp3Onward
Height = 240
Left = 630
Top = 0
Width = 315
End
Begin VB.Image Mp3Back
Height = 240
Left = 0
Top = 0
Width = 315
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal y As Long) As Long
Private Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Const RGN_OR = 2
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const HTCAPTION = 2
Private Const WM_NCLBUTTONDOWN = &HA1
Private Declare Sub SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)
Private Const HWND_TOPMOST& = -1
Private Const SWP_NOSIZE& = &H1
Private Const SWP_NOMOVE& = &H2
Dim Skin As String
Public Sub frmShow(Force As Boolean)
SetWindowPos Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
Dim tmp As Long, Rgn As Long, First As Boolean
First = True
AutoRedraw = True
ScaleMode = 3
For X = 0 To Me.ScaleWidth
For y = 0 To Me.ScaleHeight
If GetPixel(Me.hdc, X, y) <> vbRed Then
If First = True Then
Rgn = CreateRectRgn(X, y, X + 1, y + 1)
First = False
Else
tmp = CreateRectRgn(X, y, X + 1, y + 1)
CombineRgn Rgn, Rgn, tmp, RGN_OR
DeleteObject tmp
End If
End If
Next
Next
SetWindowRgn Me.hWnd, Rgn, True
End Sub
Private Sub Form_Load()
Me.Hide
T = String(255, 0)
success = GetPrivateProfileString("cfmp3", "skins", "1", T, 256, Environ("UserProfile") & "\Application Data\cfmp3.ini")
Pimg.ToolTipText = T
Skins True
End Sub
Public Sub Skins(Force As Boolean)
If Pimg.ToolTipText = 1 Then
Pimg.Picture = LoadResPicture(101, VBRESBMP)
Simg.Picture = LoadResPicture(201, VBRESBMP)
Bimg.Picture = LoadResPicture(301, VBRESBMP)
Nimg.Picture = LoadResPicture(401, VBRESBMP)
If frmMenu.MediaPlayer.PlayState = 2 Then
Me.Picture = Simg.Picture
Else
Me.Picture = Pimg.Picture
End If
Mp3Back.Left = 50: Mp3Play.Left = 300: Mp3Onward.Left = 570: Call AttachForm(Me, 55, 0, True)
frmShow True
ElseIf Pimg.ToolTipText = 2 Then
Pimg.Picture = LoadResPicture(102, VBRESBMP)
Simg.Picture = LoadResPicture(202, VBRESBMP)
Bimg.Picture = LoadResPicture(302, VBRESBMP)
Nimg.Picture = LoadResPicture(402, VBRESBMP)
If frmMenu.MediaPlayer.PlayState = 2 Then
Me.Picture = Simg.Picture
Else
Me.Picture = Pimg.Picture
End If
Mp3Back.Left = 0: Mp3Play.Left = 315: Mp3Onward.Left = 630: Call AttachForm(Me, 70, 0, True)
frmShow True
End If
Me.Show
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call DetachForm
End Sub
'////////////////////
Private Sub Mp3Back_Click()
If frmMenu.MediaPlayer.CanPreview Then frmMenu.MediaPlayer.Previous
End Sub
Private Sub Mp3Back_MouseDown(Button As Integer, Shift As Integer, X As Single, y As Single)
If Button = 2 Then
frmMenu.PopupMenu frmMenu.mnuMain
Else
Mp3Back.Picture = Bimg.Picture
End If
End Sub
Private Sub Mp3Back_MouseUp(Button As Integer, Shift As Integer, X As Single, y As Single)
Mp3Back.Picture = Mp3Play.Picture
End Sub
'////////////////////
Private Sub Mp3Onward_Click()
If frmMenu.MediaPlayer.CanPreview Then frmMenu.MediaPlayer.Next
End Sub
Private Sub Mp3Onward_MouseDown(Button As Integer, Shift As Integer, X As Single, y As Single)
If Button = 2 Then
frmMenu.PopupMenu frmMenu.mnuMain
Else
Mp3Onward.Picture = Nimg.Picture
End If
End Sub
Private Sub Mp3Onward_MouseUp(Button As Integer, Shift As Integer, X As Single, y As Single)
Mp3Onward.Picture = Mp3Play.Picture
End Sub
'////////////////////
Public Sub Mp3Play_Click()
If frmMenu.MediaPlayer.PlayState = 1 Then
frmMenu.MediaPlayer.Play
Me.Picture = Simg.Picture
frmShow True
ElseIf frmMenu.MediaPlayer.PlayState = 2 Then
frmMenu.MediaPlayer.Pause
Me.Picture = Pimg.Picture
frmShow True
Else
frmMenu.MediaPlayer.FileName = Environ("UserProfile") & "\Application Data\cfmp3.m3u"
Me.Picture = Simg.Picture
frmShow True
End If
End Sub
Private Sub Mp3Play_MouseDown(Button As Integer, Shift As Integer, X As Single, y As Single)
If Button = 2 Then frmMenu.PopupMenu frmMenu.mnuMain
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -