superstar_v2/PrimaryFormParts/PrimaryForm.MultiPagePanel.cs

585 lines
24 KiB
C#
Raw Normal View History

2025-04-15 13:16:32 +08:00
using DBObj;
using IniParser.Model;
using IniParser;
2025-04-15 13:16:32 +08:00
using System.IO;
using System.Text;
2025-04-15 13:16:32 +08:00
namespace DualScreenDemo
{
2025-08-08 10:31:59 +08:00
public partial class PrimaryForm : Form
{
2025-04-15 13:16:32 +08:00
public class MultiPagePanel : Panel
{
private const int ItemHeight = 70;
private const int RowGap = 2;
2025-08-08 10:31:59 +08:00
private int itemsPerPage
2025-04-15 13:16:32 +08:00
{
get
{
Screen screen = Screen.PrimaryScreen;
int screenWidth = screen.Bounds.Width;
int screenHeight = screen.Bounds.Height;
2025-08-08 10:31:59 +08:00
if (screenWidth == 1440 && screenHeight == 900)
2025-04-15 13:16:32 +08:00
{
2025-08-08 10:31:59 +08:00
return 14;
2025-04-15 13:16:32 +08:00
}
2025-08-08 10:31:59 +08:00
else if (screenWidth == 1024 && screenHeight == 768)
2025-04-15 13:16:32 +08:00
{
2025-08-08 10:31:59 +08:00
return 12;
2025-04-15 13:16:32 +08:00
}
2025-08-08 10:31:59 +08:00
else if (screenWidth == 1920 && screenHeight == 1080)
2025-04-15 13:16:32 +08:00
{
2025-08-08 10:31:59 +08:00
return 16;
2025-04-15 13:16:32 +08:00
}
return 16; // 預設值
}
}
private const float LeftColumnX = 0.03f;
private const float RightColumnX = 0.52f;
private const float SongWidth = 0.35f;
private const float ArtistWidth = 0.12f;
private int _currentPageIndex = 0;
private bool _isSimplified = false;
public bool IsSimplified
{
get { return _isSimplified; }
2025-08-08 10:31:59 +08:00
set
{
2025-04-15 13:16:32 +08:00
if (_isSimplified != value)
{
_isSimplified = value;
2025-08-08 10:31:59 +08:00
if (currentArtistList != null && currentArtistList.Count > 0)
2025-04-23 13:55:11 +08:00
RefreshDisplayBase_Singer();
else
RefreshDisplay();
2025-04-15 13:16:32 +08:00
}
}
}
2025-05-22 10:24:21 +08:00
private bool _isShowingSinger = true;
2025-04-15 13:16:32 +08:00
private List<SongData> currentSongList = new List<SongData>();
2025-08-08 10:31:59 +08:00
public List<SongData> get_currentSongList()
{
return currentSongList;
}
2025-04-15 13:16:32 +08:00
private List<Artist> currentArtistList = new List<Artist>();
private int _totalPages = 0;
private Point mouseDownLocation; // 新增字段
private bool isDragging = false; // 新增字段
public event Action PageIndexChanged; // 新增事件
public int currentPageIndex
{
get { return _currentPageIndex; }
2025-08-08 10:31:59 +08:00
set
{
2025-04-15 13:16:32 +08:00
if (_currentPageIndex != value)
{
_currentPageIndex = value;
// 觸發事件,通知頁面索引已改變
PageIndexChanged?.Invoke();
2025-08-08 10:31:59 +08:00
}
2025-04-15 13:16:32 +08:00
}
}
public int totalPages
{
get { return _totalPages; }
2025-08-08 10:31:59 +08:00
set
{
2025-04-15 13:16:32 +08:00
if (_totalPages != value)
{
_totalPages = value;
// 觸發事件,通知頁面索引已改變
PageIndexChanged?.Invoke();
2025-08-08 10:31:59 +08:00
}
2025-04-15 13:16:32 +08:00
}
}
2025-08-08 10:31:59 +08:00
2025-04-15 13:16:32 +08:00
public MultiPagePanel()
{
this.SetStyle(
ControlStyles.OptimizedDoubleBuffer |
ControlStyles.AllPaintingInWmPaint |
ControlStyles.UserPaint |
ControlStyles.ResizeRedraw,
true);
this.BackColor = Color.FromArgb(64, 0, 0, 0);
this.BorderStyle = BorderStyle.None;
2025-08-08 10:31:59 +08:00
2025-04-15 13:16:32 +08:00
// 添加滑動事件
this.MouseDown += MultiPagePanel_MouseDown;
this.MouseMove += MultiPagePanel_MouseMove;
this.MouseUp += MultiPagePanel_MouseUp;
}
private void MultiPagePanel_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
mouseDownLocation = e.Location;
isDragging = true;
}
}
private void MultiPagePanel_MouseMove(object sender, MouseEventArgs e)
{
if (isDragging)
{
int deltaX = e.X - mouseDownLocation.X;
2025-06-18 13:44:01 +08:00
if (Math.Abs(deltaX) > 20) // 滑動距離超過50像素才觸發
2025-04-15 13:16:32 +08:00
{
2025-08-08 10:31:59 +08:00
if (deltaX > 0 )
2025-04-15 13:16:32 +08:00
{
// 向右滑動,上一頁
LoadPreviousPage();
}
2025-08-08 10:31:59 +08:00
else if (deltaX < 0)
2025-04-15 13:16:32 +08:00
{
// 向左滑動,下一頁
LoadNextPage();
}
isDragging = false;
}
}
}
private void MultiPagePanel_MouseUp(object sender, MouseEventArgs e)
{
isDragging = false;
}
public void LoadNextPage()
{
if (currentPageIndex < totalPages - 1)
{
currentPageIndex++;
// 如果歌單為0(沒有歌單),則刷新歌手列表
2025-08-08 10:31:59 +08:00
if (_isShowingSinger)
2025-04-15 13:16:32 +08:00
{
RefreshDisplayBase_Singer();
}
else
{
RefreshDisplay();
}
}
2025-08-08 10:31:59 +08:00
else
{
if (totalPages > 1)
{
currentPageIndex = -1;
LoadNextPage();
}
}
2025-04-15 13:16:32 +08:00
}
public void LoadPreviousPage()
{
2025-06-18 15:39:08 +08:00
if (currentPageIndex - 1 >= 0)
2025-04-15 13:16:32 +08:00
{
currentPageIndex--;
2025-08-08 10:31:59 +08:00
if (_isShowingSinger)
2025-04-15 13:16:32 +08:00
{
RefreshDisplayBase_Singer();
}
2025-08-08 10:31:59 +08:00
2025-04-15 13:16:32 +08:00
else
{
RefreshDisplay();
}
}
2025-08-08 10:31:59 +08:00
else
{
if (totalPages > 1)
{
currentPageIndex = totalPages;
LoadPreviousPage();
}
}
2025-04-15 13:16:32 +08:00
}
public void LoadSongs(List<SongData> songs, bool clearHistory = false)
{
2025-05-22 10:24:21 +08:00
_isShowingSinger = false;
2025-04-15 13:16:32 +08:00
currentSongList = songs;
currentArtistList.Clear();
currentPageIndex = 0;
totalPages = (int)Math.Ceiling(songs.Count / (double)itemsPerPage);
2025-08-08 10:31:59 +08:00
2025-04-15 13:16:32 +08:00
// 直接調用基礎刷新邏輯
RefreshDisplayBase();
}
public void LoadSingers(List<Artist> artists)
{
2025-05-22 10:24:21 +08:00
_isShowingSinger = true;
2025-04-15 13:16:32 +08:00
currentArtistList = artists;
2025-05-22 10:24:21 +08:00
// currentSongList.Clear();
2025-04-15 13:16:32 +08:00
currentPageIndex = 0;
totalPages = (int)Math.Ceiling(artists.Count / (double)itemsPerPage);
RefreshDisplayBase_Singer();
}
public void LoadPlayedSongs(List<SongData> songs)
2025-04-15 13:16:32 +08:00
{
2025-05-22 10:24:21 +08:00
_isShowingSinger = false;
2025-04-15 13:16:32 +08:00
currentSongList = songs;
currentArtistList.Clear();
currentPageIndex = 0;
totalPages = (int)Math.Ceiling(songs.Count / (double)itemsPerPage);
2025-08-08 10:31:59 +08:00
2025-04-15 13:16:32 +08:00
// 直接調用基礎刷新邏輯
RefreshDisplayBase();
}
public void RefreshDisplay()
{
this.Controls.Clear(); // 清除所有 UI 元件
RefreshDisplayBase(); // 重新建立 UI
this.Invalidate(); // 通知系統需要重新繪製
}
private void RefreshDisplayBase()
{
if (this.InvokeRequired) // 確保 UI 操作在主執行緒執行
{
this.Invoke(new Action(() => RefreshDisplayBase()));
return;
}
this.SuspendLayout(); // 暫停 UI 更新,提高效能
this.Controls.Clear(); // 清空 UI (這裡會再清除一次)
2025-08-08 10:31:59 +08:00
2025-04-15 13:16:32 +08:00
int startIndex = currentPageIndex * itemsPerPage;
int endIndex = Math.Min(startIndex + itemsPerPage, currentSongList.Count);
2025-08-08 10:31:59 +08:00
2025-04-15 13:16:32 +08:00
for (int i = startIndex; i < endIndex; i++)
{
CreateSongLabel(currentSongList[i], i - startIndex, startIndex); // 這行負責新增 UI
}
this.ResumeLayout(); // 恢復 UI 更新
}
private void RefreshDisplayBase_Singer()
{
2025-08-08 10:31:59 +08:00
this.Controls.Clear();
2025-04-15 13:16:32 +08:00
if (this.InvokeRequired) // 確保 UI 操作在主執行緒執行
{
this.Invoke(new Action(() => RefreshDisplayBase_Singer()));
return;
}
this.SuspendLayout(); // 暫停 UI 更新,提高效能
this.Controls.Clear(); // 清空 UI (這裡會再清除一次)
2025-08-08 10:31:59 +08:00
2025-04-15 13:16:32 +08:00
int startIndex = currentPageIndex * itemsPerPage;
int endIndex = Math.Min(startIndex + itemsPerPage, currentArtistList.Count);
2025-08-08 10:31:59 +08:00
2025-04-15 13:16:32 +08:00
for (int i = startIndex; i < endIndex; i++)
{
CreateSingerLabel(currentArtistList[i], i - startIndex, startIndex); // 這行負責新增 UI
}
this.ResumeLayout(); // 恢復 UI 更新
2025-08-08 10:31:59 +08:00
this.Invalidate();
2025-04-15 13:16:32 +08:00
}
2025-08-08 10:31:59 +08:00
2025-04-15 13:16:32 +08:00
private void CreateSingerLabel(Artist artist, int index, int pageOffset)
{
2025-08-08 10:31:59 +08:00
2025-04-15 13:16:32 +08:00
// 創建歌手標籤
Label artistLabel = new Label();
2025-08-08 10:31:59 +08:00
string artistText = IsSimplified ?
(!string.IsNullOrEmpty(artist.NameSimplified) ? artist.NameSimplified : artist.Name) :
2025-04-23 13:55:11 +08:00
artist.Name;
artistLabel.Text = artistText;
2025-04-15 13:16:32 +08:00
artistLabel.Tag = artist;
artistLabel.AutoSize = true;
2025-08-08 10:31:59 +08:00
2025-04-15 13:16:32 +08:00
// 計算文字寬度
2025-08-01 16:50:33 +08:00
artistLabel.Font = new Font("微軟正黑體", 22, FontStyle.Bold);
2025-04-15 13:16:32 +08:00
Screen screen = Screen.PrimaryScreen;
int screenWidth = screen.Bounds.Width;
int screenHeight = screen.Bounds.Height;
int NumberOfItem = (screenWidth, screenHeight) switch
{
(1440, 900) => 7,
(1024, 768) => 6,
(1920, 1080) => 8,
_ => 8 // 預設值
};
// 計算位置 - 依照NumberOfItem來計算
2025-08-08 10:31:59 +08:00
bool isLeftColumn = index < NumberOfItem;
2025-04-15 13:16:32 +08:00
int row = isLeftColumn ? index : index - NumberOfItem; // 如果是右边,需要减去8来计算正确的行号
float startX = isLeftColumn ? LeftColumnX : RightColumnX;
int y = row * (ItemHeight + RowGap);
// 計算歌手標籤的位置和大小
int singerX = (int)(this.Width * startX);
2025-08-08 10:31:59 +08:00
int singerWidth = (int)(this.Width * (SongWidth + ArtistWidth));
2025-04-15 13:16:32 +08:00
// 字體顏色
artistLabel.ForeColor = Color.White;
// 標籤座標設定
artistLabel.Location = new Point(singerX, y);
artistLabel.Size = new Size(singerWidth + 20, ItemHeight);
2025-08-08 10:31:59 +08:00
2025-04-15 13:16:32 +08:00
Panel separatorPanel = new Panel
{
2025-08-08 10:31:59 +08:00
Location = new Point(singerX, y + ItemHeight),
//Size = new Size(singerWidth + 20, 2),
Size = new Size(730, 2),
2025-04-15 13:16:32 +08:00
BackColor = Color.FromArgb(80, 255, 255, 255),
Name = "SeparatorPanel_" + index.ToString()
};
// 字體調整和字體背景顏色
artistLabel.TextAlign = ContentAlignment.TopLeft;
artistLabel.BackColor = Color.Transparent;
2025-08-08 10:31:59 +08:00
2025-04-15 13:16:32 +08:00
// 設置滑鼠事件
2025-08-08 10:31:59 +08:00
EventHandler mouseEnter = (sender, e) =>
{
// 變更歌手名稱為黃色
artistLabel.ForeColor = Color.Yellow;
// 增強分隔線的亮度,使其更明顯
separatorPanel.BackColor = Color.FromArgb(120, 255, 255, 255);
2025-04-15 13:16:32 +08:00
};
2025-08-08 10:31:59 +08:00
EventHandler mouseLeave = (sender, e) =>
{
// 還原歌手名稱為白色
artistLabel.ForeColor = Color.White;
// 還原分隔線的亮度
separatorPanel.BackColor = Color.FromArgb(80, 255, 255, 255);
2025-04-15 13:16:32 +08:00
};
2025-08-08 10:31:59 +08:00
artistLabel.Click += (sender, e) =>
2025-04-15 13:16:32 +08:00
{
string searchText = artistLabel.Text; // 取得輸入內容
2025-04-18 15:48:41 +08:00
// 歌星 轉 歌曲
2025-04-23 13:55:11 +08:00
string query = IsSimplified ?
(
2025-08-08 10:31:59 +08:00
!string.IsNullOrEmpty(artist.NameSimplified) ?
2025-04-23 13:55:11 +08:00
$"SELECT * FROM song_library_cache WHERE artistA_simplified = '{searchText}' OR artistB_simplified = '{searchText}'"
: $"SELECT * FROM song_library_cache WHERE artistA = '{searchText}' OR artistB = '{searchText}'"
)
: $"SELECT * FROM song_library_cache WHERE artistA = '{searchText}' OR artistB = '{searchText}'"
;
//string query = $"SELECT * FROM song_library_cache WHERE artistA ='{searchText}' OR artistB='{searchText}' ";
2025-04-15 13:16:32 +08:00
var searchResults = PrimaryForm.Instance.SearchSongs_Mysql(query);
// 重置分頁
PrimaryForm.Instance.currentPage = 0;
currentSongList = searchResults;
totalPages = (int)Math.Ceiling((double)searchResults.Count / itemsPerPage);
// 更新多頁面面板的內容
PrimaryForm.Instance.multiPagePanel.currentPageIndex = 0;
PrimaryForm.Instance.multiPagePanel.LoadSongs(currentSongList);
};
// 添加滑鼠事件
artistLabel.MouseEnter += mouseEnter;
artistLabel.MouseLeave += mouseLeave;
2025-06-18 15:39:08 +08:00
// 滑動
artistLabel.MouseDown += MultiPagePanel_MouseDown;
artistLabel.MouseMove += MultiPagePanel_MouseMove;
artistLabel.MouseUp += MultiPagePanel_MouseUp;
2025-04-15 13:16:32 +08:00
separatorPanel.MouseEnter += mouseEnter;
separatorPanel.MouseLeave += mouseLeave;
// 添加到畫面上
this.Controls.Add(separatorPanel);
this.Controls.Add(artistLabel);
// 將歌手標籤置於最上層
artistLabel.BringToFront();
2025-08-08 10:31:59 +08:00
2025-04-15 13:16:32 +08:00
}
private void CreateSongLabel(SongData song, int index, int pageOffset)
{
// 創建歌曲標籤
Label songLabel = new Label();
string statusText;
Color color;
2025-04-15 13:16:32 +08:00
if (PrimaryForm.Instance.isOnOrderedSongsPage)
{
statusText = song.GetStateTxt(IsSimplified); // 狀態文字
color = song.GetStateColor();
2025-04-15 13:16:32 +08:00
}
else
{
color = Color.White;
2025-04-15 13:16:32 +08:00
statusText = string.Empty;
}
2025-07-08 18:13:36 +08:00
songLabel.ForeColor = color;
2025-04-15 13:16:32 +08:00
// 根據簡繁體設置選擇要顯示的文字
2025-07-08 18:13:36 +08:00
string songText = song.getName(IsSimplified);
2025-04-22 15:25:58 +08:00
// 歌手名稱設置點
2025-07-08 18:13:36 +08:00
string artistText = song.getArtist_A(IsSimplified);
2025-08-07 18:32:08 +08:00
2025-04-15 13:16:32 +08:00
string fullText = songText + statusText;
int textLength = fullText.Length;
2025-08-08 10:31:59 +08:00
2025-04-15 13:16:32 +08:00
// 計算文字寬度
2025-08-01 16:50:33 +08:00
songLabel.Font = new Font("微軟正黑體", 22, FontStyle.Bold);
2025-04-15 13:16:32 +08:00
songLabel.Text = fullText;
songLabel.Tag = song;
songLabel.AutoSize = false;
2025-04-15 13:16:32 +08:00
// 創建歌手標籤
Label artistLabel = new Label();
2025-08-07 18:32:08 +08:00
2025-04-15 13:16:32 +08:00
artistLabel.Tag = song;
artistLabel.AutoSize = false;
2025-08-07 18:32:08 +08:00
2025-04-15 13:16:32 +08:00
Screen screen = Screen.PrimaryScreen;
int screenWidth = screen.Bounds.Width;
int screenHeight = screen.Bounds.Height;
int NumberOfItem = 0;
2025-08-08 10:31:59 +08:00
if (screenWidth == 1440 && screenHeight == 900)
2025-04-15 13:16:32 +08:00
{
2025-08-08 10:31:59 +08:00
NumberOfItem = 7;
2025-04-15 13:16:32 +08:00
}
2025-08-08 10:31:59 +08:00
else if (screenWidth == 1024 && screenHeight == 768)
2025-04-15 13:16:32 +08:00
{
2025-08-08 10:31:59 +08:00
NumberOfItem = 6;
2025-04-15 13:16:32 +08:00
}
2025-08-08 10:31:59 +08:00
else if (screenWidth == 1920 && screenHeight == 1080)
2025-04-15 13:16:32 +08:00
{
2025-08-08 10:31:59 +08:00
NumberOfItem = 8;
2025-04-15 13:16:32 +08:00
}
// 計算位置 - 依照NumberOfItem來計算
2025-08-08 10:31:59 +08:00
bool isLeftColumn = index < NumberOfItem;
int row = isLeftColumn ? index : index - NumberOfItem;
2025-04-15 13:16:32 +08:00
float startX = isLeftColumn ? LeftColumnX : RightColumnX;
int y = row * (ItemHeight + RowGap);
// 設置位置和大小
int songX = (int)(this.Width * startX);
int songWidth = (int)(this.Width * SongWidth);
int artistWidth = (int)(this.Width * ArtistWidth);
int artistX = songX + songWidth + 10;
var data = LoadConfigData();
2025-04-15 13:16:32 +08:00
// 添加人聲標籤
if (song.getHumanVoice() == 1)
2025-04-15 13:16:32 +08:00
{
PictureBox icon = new PictureBox()
{
2025-08-07 13:09:10 +08:00
Image = Image.FromFile(Path.Combine(serverPath, @"themes\superstar\button\3.介面\其他符號_人聲.png")),
2025-04-15 13:16:32 +08:00
SizeMode = PictureBoxSizeMode.Zoom,
Size = new Size(30, 30),
2025-04-15 13:16:32 +08:00
Location = new Point(songX + 5, y + 8)
};
this.Controls.Add(icon);
icon.BringToFront();
2025-08-08 10:31:59 +08:00
2025-04-15 13:16:32 +08:00
// 有圖標時歌名右移
songLabel.Location = new Point(songX + 42, y);
//songLabel.Size = new Size(songWidth - 47, ItemHeight - 20);
songLabel.Size = new Size(700, 66);
2025-04-15 13:16:32 +08:00
}
else
{
// 沒有圖標時歌名置中
songLabel.Location = new Point(songX, y);
//songLabel.Size = new Size(songWidth - 10, ItemHeight - 20);
songLabel.Size = new Size(700, 66);
2025-04-15 13:16:32 +08:00
}
// 歌手標籤位置調整
artistLabel.Location = new Point(artistX, y + 33);
artistLabel.Size = new Size(artistWidth - 10, ItemHeight - 35);
2025-08-08 10:31:59 +08:00
2025-08-07 18:32:08 +08:00
if (song.getB() != null)
{
artistText += " + " + song.getArtist_B(IsSimplified);
2025-08-08 10:31:59 +08:00
//artistLabel.Location = new Point(artistX - 95, y + 33);
//artistLabel.Size = new Size(artistWidth + 90, ItemHeight - 35);
}
2025-08-07 18:32:08 +08:00
2025-08-08 10:31:59 +08:00
if (artistText.Length > 3)
{
artistLabel.Location = new Point(artistX - 581, y + 33);
artistLabel.Size = new Size(artistWidth + 573, ItemHeight - 35);
2025-08-07 18:32:08 +08:00
}
2025-08-08 10:31:59 +08:00
2025-08-07 18:32:08 +08:00
artistLabel.Text = artistText;
2025-04-15 13:16:32 +08:00
// 創建分隔線面板
Panel separatorPanel = new Panel
{
Location = new Point(songX - 5, y + ItemHeight - 2),
//Size = new Size(songWidth + artistWidth + 20, 2),
Size = new Size(730, 2),
2025-04-15 13:16:32 +08:00
BackColor = Color.FromArgb(80, 255, 255, 255),
Name = "SeparatorPanel_" + index.ToString()
};
2025-05-21 15:42:42 +08:00
// 根據文字長度設置字體大小
int fold = 14;
2025-08-07 15:00:42 +08:00
//if (artistText.Length > 6)
// fold = 10;
//else if (artistText.Length > 3)
// fold = 12;
artistLabel.Font = new Font("微軟正黑體", fold, FontStyle.Bold);
2025-05-21 15:42:42 +08:00
2025-08-07 15:00:42 +08:00
//artistLabel.ForeColor = Color.FromArgb(30,144,255);
2025-08-08 10:31:59 +08:00
artistLabel.ForeColor = Color.FromArgb(36, 209, 216);
2025-04-15 13:16:32 +08:00
songLabel.TextAlign = ContentAlignment.MiddleLeft;
artistLabel.TextAlign = ContentAlignment.MiddleRight;
// 確保背景透明
songLabel.BackColor = Color.Transparent;
artistLabel.BackColor = Color.Transparent;
// 定義滑鼠進入 (MouseEnter) 事件的處理程序
2025-08-08 10:31:59 +08:00
EventHandler mouseEnter = (sender, e) =>
{
songLabel.ForeColor = Color.Yellow;
artistLabel.ForeColor = Color.Yellow;
separatorPanel.BackColor = Color.FromArgb(120, 255, 255, 255);
2025-08-08 10:31:59 +08:00
2025-04-15 13:16:32 +08:00
};
// 定義滑鼠離開 (MouseLeave) 事件的處理程序
2025-08-08 10:31:59 +08:00
EventHandler mouseLeave = (sender, e) =>
{
songLabel.ForeColor = color;
2025-08-07 15:00:42 +08:00
//artistLabel.ForeColor = Color.FromArgb(30, 144, 255);
2025-08-08 10:31:59 +08:00
artistLabel.ForeColor = Color.FromArgb(36, 209, 216);
2025-04-15 13:16:32 +08:00
separatorPanel.BackColor = Color.FromArgb(80, 255, 255, 255);
};
// 添加事件处理
songLabel.Click += PrimaryForm.Instance.Label_Click;
artistLabel.Click += PrimaryForm.Instance.Label_Click;
2025-06-18 15:39:08 +08:00
// 滑動事件調整位置
songLabel.MouseDown += MultiPagePanel_MouseDown;
songLabel.MouseMove += MultiPagePanel_MouseMove;
songLabel.MouseUp += MultiPagePanel_MouseUp;
2025-04-15 13:16:32 +08:00
songLabel.MouseEnter += mouseEnter;
songLabel.MouseLeave += mouseLeave;
artistLabel.MouseEnter += mouseEnter;
artistLabel.MouseLeave += mouseLeave;
2025-06-18 15:39:08 +08:00
// 滑動事件調整位置
artistLabel.MouseDown += MultiPagePanel_MouseDown;
artistLabel.MouseMove += MultiPagePanel_MouseMove;
artistLabel.MouseUp += MultiPagePanel_MouseUp;
2025-04-15 13:16:32 +08:00
separatorPanel.MouseEnter += mouseEnter;
separatorPanel.MouseLeave += mouseLeave;
// 按正确顺序添加控件
this.Controls.Add(separatorPanel);
this.Controls.Add(songLabel);
this.Controls.Add(artistLabel);
// 确保控件层次正确
songLabel.BringToFront();
artistLabel.BringToFront();
2025-08-07 18:32:08 +08:00
//songLabel.Controls.Add(artistLabel);
//artistLabel.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
songLabel.TextAlign = ContentAlignment.TopLeft;
2025-04-15 13:16:32 +08:00
}
private IniData LoadConfigData()
{
var parser = new FileIniDataParser();
string iniFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "config.ini");
// 使用 UTF-8 讀取 INI 檔案並解析內容
using (var reader = new StreamReader(iniFilePath, Encoding.UTF8))
{
return parser.ReadData(reader);
}
}
2025-08-07 13:09:10 +08:00
string serverPath = Utils.Env.GetPath("", "");
2025-04-15 13:16:32 +08:00
}
}
}