Merge branch 'main' of http://47.251.18.130:3000/Leecheng/superstar_v2
This commit is contained in:
commit
9e48f712db
@ -6,7 +6,8 @@ using System.Text;
|
|||||||
|
|
||||||
namespace DualScreenDemo
|
namespace DualScreenDemo
|
||||||
{
|
{
|
||||||
public partial class PrimaryForm : Form{
|
public partial class PrimaryForm : Form
|
||||||
|
{
|
||||||
public class MultiPagePanel : Panel
|
public class MultiPagePanel : Panel
|
||||||
{
|
{
|
||||||
private const int ItemHeight = 70;
|
private const int ItemHeight = 70;
|
||||||
@ -18,15 +19,15 @@ namespace DualScreenDemo
|
|||||||
Screen screen = Screen.PrimaryScreen;
|
Screen screen = Screen.PrimaryScreen;
|
||||||
int screenWidth = screen.Bounds.Width;
|
int screenWidth = screen.Bounds.Width;
|
||||||
int screenHeight = screen.Bounds.Height;
|
int screenHeight = screen.Bounds.Height;
|
||||||
if(screenWidth==1440 && screenHeight==900)
|
if (screenWidth == 1440 && screenHeight == 900)
|
||||||
{
|
{
|
||||||
return 14;
|
return 14;
|
||||||
}
|
}
|
||||||
else if(screenWidth==1024 && screenHeight==768)
|
else if (screenWidth == 1024 && screenHeight == 768)
|
||||||
{
|
{
|
||||||
return 12;
|
return 12;
|
||||||
}
|
}
|
||||||
else if(screenWidth == 1920 && screenHeight == 1080)
|
else if (screenWidth == 1920 && screenHeight == 1080)
|
||||||
{
|
{
|
||||||
return 16;
|
return 16;
|
||||||
}
|
}
|
||||||
@ -48,7 +49,7 @@ namespace DualScreenDemo
|
|||||||
if (_isSimplified != value)
|
if (_isSimplified != value)
|
||||||
{
|
{
|
||||||
_isSimplified = value;
|
_isSimplified = value;
|
||||||
if(currentArtistList != null && currentArtistList.Count > 0)
|
if (currentArtistList != null && currentArtistList.Count > 0)
|
||||||
RefreshDisplayBase_Singer();
|
RefreshDisplayBase_Singer();
|
||||||
else
|
else
|
||||||
RefreshDisplay();
|
RefreshDisplay();
|
||||||
@ -57,7 +58,8 @@ namespace DualScreenDemo
|
|||||||
}
|
}
|
||||||
private bool _isShowingSinger = true;
|
private bool _isShowingSinger = true;
|
||||||
private List<SongData> currentSongList = new List<SongData>();
|
private List<SongData> currentSongList = new List<SongData>();
|
||||||
public List<SongData> get_currentSongList(){
|
public List<SongData> get_currentSongList()
|
||||||
|
{
|
||||||
return currentSongList;
|
return currentSongList;
|
||||||
}
|
}
|
||||||
private List<Artist> currentArtistList = new List<Artist>();
|
private List<Artist> currentArtistList = new List<Artist>();
|
||||||
@ -125,12 +127,12 @@ namespace DualScreenDemo
|
|||||||
int deltaX = e.X - mouseDownLocation.X;
|
int deltaX = e.X - mouseDownLocation.X;
|
||||||
if (Math.Abs(deltaX) > 20) // 滑動距離超過50像素才觸發
|
if (Math.Abs(deltaX) > 20) // 滑動距離超過50像素才觸發
|
||||||
{
|
{
|
||||||
if (deltaX > 0 && currentPageIndex > 0)
|
if (deltaX > 0 )
|
||||||
{
|
{
|
||||||
// 向右滑動,上一頁
|
// 向右滑動,上一頁
|
||||||
LoadPreviousPage();
|
LoadPreviousPage();
|
||||||
}
|
}
|
||||||
else if (deltaX < 0 && currentPageIndex < totalPages - 1)
|
else if (deltaX < 0)
|
||||||
{
|
{
|
||||||
// 向左滑動,下一頁
|
// 向左滑動,下一頁
|
||||||
LoadNextPage();
|
LoadNextPage();
|
||||||
@ -149,7 +151,7 @@ namespace DualScreenDemo
|
|||||||
{
|
{
|
||||||
currentPageIndex++;
|
currentPageIndex++;
|
||||||
// 如果歌單為0(沒有歌單),則刷新歌手列表
|
// 如果歌單為0(沒有歌單),則刷新歌手列表
|
||||||
if(_isShowingSinger)
|
if (_isShowingSinger)
|
||||||
{
|
{
|
||||||
RefreshDisplayBase_Singer();
|
RefreshDisplayBase_Singer();
|
||||||
}
|
}
|
||||||
@ -158,21 +160,41 @@ namespace DualScreenDemo
|
|||||||
RefreshDisplay();
|
RefreshDisplay();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (totalPages > 1)
|
||||||
|
{
|
||||||
|
currentPageIndex = -1;
|
||||||
|
LoadNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public void LoadPreviousPage()
|
public void LoadPreviousPage()
|
||||||
{
|
{
|
||||||
if (currentPageIndex - 1 >= 0)
|
if (currentPageIndex - 1 >= 0)
|
||||||
{
|
{
|
||||||
currentPageIndex--;
|
currentPageIndex--;
|
||||||
if(_isShowingSinger)
|
if (_isShowingSinger)
|
||||||
{
|
{
|
||||||
RefreshDisplayBase_Singer();
|
RefreshDisplayBase_Singer();
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RefreshDisplay();
|
RefreshDisplay();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (totalPages > 1)
|
||||||
|
{
|
||||||
|
currentPageIndex = totalPages;
|
||||||
|
LoadPreviousPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadSongs(List<SongData> songs, bool clearHistory = false)
|
public void LoadSongs(List<SongData> songs, bool clearHistory = false)
|
||||||
@ -288,7 +310,7 @@ namespace DualScreenDemo
|
|||||||
int y = row * (ItemHeight + RowGap);
|
int y = row * (ItemHeight + RowGap);
|
||||||
// 計算歌手標籤的位置和大小
|
// 計算歌手標籤的位置和大小
|
||||||
int singerX = (int)(this.Width * startX);
|
int singerX = (int)(this.Width * startX);
|
||||||
int singerWidth = (int)(this.Width * (SongWidth+ArtistWidth));
|
int singerWidth = (int)(this.Width * (SongWidth + ArtistWidth));
|
||||||
// 字體顏色
|
// 字體顏色
|
||||||
artistLabel.ForeColor = Color.White;
|
artistLabel.ForeColor = Color.White;
|
||||||
// 標籤座標設定
|
// 標籤座標設定
|
||||||
@ -297,7 +319,7 @@ namespace DualScreenDemo
|
|||||||
|
|
||||||
Panel separatorPanel = new Panel
|
Panel separatorPanel = new Panel
|
||||||
{
|
{
|
||||||
Location = new Point(singerX , y + ItemHeight),
|
Location = new Point(singerX, y + ItemHeight),
|
||||||
//Size = new Size(singerWidth + 20, 2),
|
//Size = new Size(singerWidth + 20, 2),
|
||||||
Size = new Size(730, 2),
|
Size = new Size(730, 2),
|
||||||
BackColor = Color.FromArgb(80, 255, 255, 255),
|
BackColor = Color.FromArgb(80, 255, 255, 255),
|
||||||
@ -308,18 +330,20 @@ namespace DualScreenDemo
|
|||||||
artistLabel.BackColor = Color.Transparent;
|
artistLabel.BackColor = Color.Transparent;
|
||||||
|
|
||||||
// 設置滑鼠事件
|
// 設置滑鼠事件
|
||||||
EventHandler mouseEnter = (sender, e) => {
|
EventHandler mouseEnter = (sender, e) =>
|
||||||
// 變更歌手名稱為黃色
|
{
|
||||||
artistLabel.ForeColor = Color.Yellow;
|
// 變更歌手名稱為黃色
|
||||||
// 增強分隔線的亮度,使其更明顯
|
artistLabel.ForeColor = Color.Yellow;
|
||||||
separatorPanel.BackColor = Color.FromArgb(120, 255, 255, 255);
|
// 增強分隔線的亮度,使其更明顯
|
||||||
|
separatorPanel.BackColor = Color.FromArgb(120, 255, 255, 255);
|
||||||
|
|
||||||
};
|
};
|
||||||
EventHandler mouseLeave = (sender, e) => {
|
EventHandler mouseLeave = (sender, e) =>
|
||||||
// 還原歌手名稱為白色
|
{
|
||||||
artistLabel.ForeColor = Color.White;
|
// 還原歌手名稱為白色
|
||||||
// 還原分隔線的亮度
|
artistLabel.ForeColor = Color.White;
|
||||||
separatorPanel.BackColor = Color.FromArgb(80, 255, 255, 255);
|
// 還原分隔線的亮度
|
||||||
|
separatorPanel.BackColor = Color.FromArgb(80, 255, 255, 255);
|
||||||
};
|
};
|
||||||
artistLabel.Click += (sender, e) =>
|
artistLabel.Click += (sender, e) =>
|
||||||
{
|
{
|
||||||
@ -327,7 +351,7 @@ namespace DualScreenDemo
|
|||||||
// 歌星 轉 歌曲
|
// 歌星 轉 歌曲
|
||||||
string query = IsSimplified ?
|
string query = IsSimplified ?
|
||||||
(
|
(
|
||||||
!string.IsNullOrEmpty(artist.NameSimplified)?
|
!string.IsNullOrEmpty(artist.NameSimplified) ?
|
||||||
$"SELECT * FROM song_library_cache WHERE artistA_simplified = '{searchText}' OR artistB_simplified = '{searchText}'"
|
$"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}'"
|
||||||
)
|
)
|
||||||
@ -402,15 +426,15 @@ namespace DualScreenDemo
|
|||||||
int screenWidth = screen.Bounds.Width;
|
int screenWidth = screen.Bounds.Width;
|
||||||
int screenHeight = screen.Bounds.Height;
|
int screenHeight = screen.Bounds.Height;
|
||||||
int NumberOfItem = 0;
|
int NumberOfItem = 0;
|
||||||
if(screenWidth==1440 && screenHeight==900)
|
if (screenWidth == 1440 && screenHeight == 900)
|
||||||
{
|
{
|
||||||
NumberOfItem = 7;
|
NumberOfItem = 7;
|
||||||
}
|
}
|
||||||
else if(screenWidth==1024 && screenHeight==768)
|
else if (screenWidth == 1024 && screenHeight == 768)
|
||||||
{
|
{
|
||||||
NumberOfItem = 6;
|
NumberOfItem = 6;
|
||||||
}
|
}
|
||||||
else if(screenWidth == 1920 && screenHeight == 1080)
|
else if (screenWidth == 1920 && screenHeight == 1080)
|
||||||
{
|
{
|
||||||
NumberOfItem = 8;
|
NumberOfItem = 8;
|
||||||
}
|
}
|
||||||
@ -455,18 +479,20 @@ namespace DualScreenDemo
|
|||||||
// 歌手標籤位置調整
|
// 歌手標籤位置調整
|
||||||
artistLabel.Location = new Point(artistX, y + 33);
|
artistLabel.Location = new Point(artistX, y + 33);
|
||||||
artistLabel.Size = new Size(artistWidth - 10, ItemHeight - 35);
|
artistLabel.Size = new Size(artistWidth - 10, ItemHeight - 35);
|
||||||
if (artistText.Length > 3)
|
|
||||||
{
|
|
||||||
artistLabel.Location = new Point(artistX - 95, y + 33);
|
|
||||||
artistLabel.Size = new Size(artistWidth + 90, ItemHeight - 35);
|
|
||||||
}
|
|
||||||
if (song.getB() != null)
|
if (song.getB() != null)
|
||||||
{
|
{
|
||||||
artistText += " + " + song.getArtist_B(IsSimplified);
|
artistText += " + " + song.getArtist_B(IsSimplified);
|
||||||
artistLabel.Location = new Point(artistX - 95, y + 33);
|
//artistLabel.Location = new Point(artistX - 95, y + 33);
|
||||||
artistLabel.Size = new Size(artistWidth + 90, ItemHeight - 35);
|
//artistLabel.Size = new Size(artistWidth + 90, ItemHeight - 35);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (artistText.Length > 3)
|
||||||
|
{
|
||||||
|
artistLabel.Location = new Point(artistX - 581, y + 33);
|
||||||
|
artistLabel.Size = new Size(artistWidth + 573, ItemHeight - 35);
|
||||||
|
}
|
||||||
|
|
||||||
artistLabel.Text = artistText;
|
artistLabel.Text = artistText;
|
||||||
// 創建分隔線面板
|
// 創建分隔線面板
|
||||||
Panel separatorPanel = new Panel
|
Panel separatorPanel = new Panel
|
||||||
@ -487,24 +513,26 @@ namespace DualScreenDemo
|
|||||||
artistLabel.Font = new Font("微軟正黑體", fold, FontStyle.Bold);
|
artistLabel.Font = new Font("微軟正黑體", fold, FontStyle.Bold);
|
||||||
|
|
||||||
//artistLabel.ForeColor = Color.FromArgb(30,144,255);
|
//artistLabel.ForeColor = Color.FromArgb(30,144,255);
|
||||||
artistLabel.ForeColor = Color.FromArgb(36,209,216);
|
artistLabel.ForeColor = Color.FromArgb(36, 209, 216);
|
||||||
songLabel.TextAlign = ContentAlignment.MiddleLeft;
|
songLabel.TextAlign = ContentAlignment.MiddleLeft;
|
||||||
artistLabel.TextAlign = ContentAlignment.MiddleRight;
|
artistLabel.TextAlign = ContentAlignment.MiddleRight;
|
||||||
// 確保背景透明
|
// 確保背景透明
|
||||||
songLabel.BackColor = Color.Transparent;
|
songLabel.BackColor = Color.Transparent;
|
||||||
artistLabel.BackColor = Color.Transparent;
|
artistLabel.BackColor = Color.Transparent;
|
||||||
// 定義滑鼠進入 (MouseEnter) 事件的處理程序
|
// 定義滑鼠進入 (MouseEnter) 事件的處理程序
|
||||||
EventHandler mouseEnter = (sender, e) => {
|
EventHandler mouseEnter = (sender, e) =>
|
||||||
|
{
|
||||||
songLabel.ForeColor = Color.Yellow;
|
songLabel.ForeColor = Color.Yellow;
|
||||||
artistLabel.ForeColor = Color.Yellow;
|
artistLabel.ForeColor = Color.Yellow;
|
||||||
separatorPanel.BackColor = Color.FromArgb(120, 255, 255, 255);
|
separatorPanel.BackColor = Color.FromArgb(120, 255, 255, 255);
|
||||||
|
|
||||||
};
|
};
|
||||||
// 定義滑鼠離開 (MouseLeave) 事件的處理程序
|
// 定義滑鼠離開 (MouseLeave) 事件的處理程序
|
||||||
EventHandler mouseLeave = (sender, e) => {
|
EventHandler mouseLeave = (sender, e) =>
|
||||||
|
{
|
||||||
songLabel.ForeColor = color;
|
songLabel.ForeColor = color;
|
||||||
//artistLabel.ForeColor = Color.FromArgb(30, 144, 255);
|
//artistLabel.ForeColor = Color.FromArgb(30, 144, 255);
|
||||||
artistLabel.ForeColor = Color.FromArgb(36,209,216);
|
artistLabel.ForeColor = Color.FromArgb(36, 209, 216);
|
||||||
separatorPanel.BackColor = Color.FromArgb(80, 255, 255, 255);
|
separatorPanel.BackColor = Color.FromArgb(80, 255, 255, 255);
|
||||||
};
|
};
|
||||||
// 添加事件处理
|
// 添加事件处理
|
||||||
|
@ -659,6 +659,13 @@ namespace DualScreenDemo
|
|||||||
// 從配置中加載字體屬性
|
// 從配置中加載字體屬性
|
||||||
inputBoxFontName = data["InputBoxZhuYinSingers"]["FontName"]; // 字體名稱
|
inputBoxFontName = data["InputBoxZhuYinSingers"]["FontName"]; // 字體名稱
|
||||||
inputBoxFontSize = float.Parse(data["InputBoxZhuYinSingers"]["FontSize"]); // 字體大小
|
inputBoxFontSize = float.Parse(data["InputBoxZhuYinSingers"]["FontSize"]); // 字體大小
|
||||||
|
Screen screen = Screen.PrimaryScreen;
|
||||||
|
int screenWidth = screen.Bounds.Width;
|
||||||
|
int screenHeight = screen.Bounds.Height;
|
||||||
|
if (screenWidth < 1920 && screenHeight < 1080)
|
||||||
|
{
|
||||||
|
inputBoxFontSize = 22;
|
||||||
|
}
|
||||||
inputBoxFontStyle = (FontStyle)Enum.Parse(typeof(FontStyle), data["InputBoxZhuYinSingers"]["FontStyle"]); // 字體樣式
|
inputBoxFontStyle = (FontStyle)Enum.Parse(typeof(FontStyle), data["InputBoxZhuYinSingers"]["FontStyle"]); // 字體樣式
|
||||||
inputBoxForeColor = Color.FromName(data["InputBoxZhuYinSingers"]["ForeColor"]); // 字體顏色
|
inputBoxForeColor = Color.FromName(data["InputBoxZhuYinSingers"]["ForeColor"]); // 字體顏色
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user