解析度歌手名稱換行修正

This commit is contained in:
allen.yan 2025-08-07 18:32:08 +08:00
parent 1c8cee23c9
commit 5ff2e096fc
11 changed files with 96 additions and 67 deletions

View File

@ -4,7 +4,7 @@ namespace DualScreenDemo
{
private void ChinaSongsButton_Click(object sender, EventArgs e)
{
ResetBtnStatus();
ResetCatBtnStatus();
/*chinaSongs = allSongs.Where(song => song.SongGenre.Contains("F1"))
.OrderByDescending(song => song.Plays)

View File

@ -5,7 +5,7 @@ namespace DualScreenDemo
private void LoveDuetButton_Click(object sender, EventArgs e)
{
ResetBtnStatus();
ResetCatBtnStatus();
/*loveDuetSongs = allSongs.Where(song => song.SongGenre.Contains("A1"))
.OrderByDescending(song => song.Plays)

View File

@ -4,7 +4,7 @@ namespace DualScreenDemo
{
private void MedleyDanceButton_Click(object sender, EventArgs e)
{
ResetBtnStatus();
ResetCatBtnStatus();
/*medleyDanceSongs = allSongs.Where(song => song.SongGenre.Contains("C1"))
.OrderByDescending(song => song.Plays)

View File

@ -4,7 +4,7 @@ namespace DualScreenDemo
{
private void NinetiesButton_Click(object sender, EventArgs e)
{
ResetBtnStatus();
ResetCatBtnStatus();
/*ninetiesSongs = allSongs.Where(song => song.SongGenre.Contains("D1"))
.OrderByDescending(song => song.Plays)

View File

@ -4,7 +4,7 @@ namespace DualScreenDemo
{
private void NostalgicSongsButton_Click(object sender, EventArgs e)
{
ResetBtnStatus();
ResetCatBtnStatus();
/*nostalgicSongs = allSongs.Where(song => song.SongGenre.Contains("E1"))
.OrderByDescending(song => song.Plays)

View File

@ -4,7 +4,7 @@ namespace DualScreenDemo
{
private void TalentShowButton_Click(object sender, EventArgs e)
{
ResetBtnStatus();
ResetCatBtnStatus();
/*talentShowSongs = allSongs.Where(song => song.SongGenre.Contains("B1"))
.OrderByDescending(song => song.Plays)

View File

@ -4,7 +4,7 @@ namespace DualScreenDemo
{
private void VietnameseSongsButton_Click(object sender, EventArgs e)
{
ResetBtnStatus();
ResetCatBtnStatus();
/*vietnameseSongs = allSongs.Where(song => song.SongGenre.Contains("G1"))
.OrderByDescending(song => song.Plays)

View File

@ -30,7 +30,7 @@ namespace DualScreenDemo
private Bitmap vietnameseNormalBackground;
private Bitmap vietnameseActiveBackground;
private void ResetBtnStatus()
private void ResetCatBtnStatus()
{
loveDuetButton.BackgroundImage = loveDuetNormalBackground;
@ -43,22 +43,22 @@ namespace DualScreenDemo
}
private void InitializeButtonsForCategorySearch()
{
var data=LoadConfigData();
//private void InitializeButtonsForCategorySearch()
//{
// var data=LoadConfigData();
categorySearchNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_類別查詢(未按).png"));
categorySearchActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_類別查詢(已按).png"));
// categorySearchNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_類別查詢(未按).png"));
// categorySearchActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_類別查詢(已按).png"));
categorySearchButton = new Button { Text = "" };
categorySearchButton.Name = "categorySearchButton";
ConfigureButton(categorySearchButton, 731, 97, 99, 99,
categorySearchNormalBackground,
categorySearchActiveBackground,
categorySearchActiveBackground,
CategorySearchButton_Click);
// categorySearchButton = new Button { Text = "" };
// categorySearchButton.Name = "categorySearchButton";
// ConfigureButton(categorySearchButton, 731, 97, 99, 99,
// categorySearchNormalBackground,
// categorySearchActiveBackground,
// categorySearchActiveBackground,
// CategorySearchButton_Click);
}
//}
private void InitializeCategorySearchButtons()
{
@ -152,21 +152,13 @@ namespace DualScreenDemo
private void CategorySearchButton_Click(object sender, EventArgs e)
{
ResetPrimaryBtnStatus();
newSongAlertButton.BackgroundImage = newSongAlertNormalBackground;
hotPlayButton.BackgroundImage = hotPlayNormalBackground;
singerSearchButton.BackgroundImage = singerSearchNormalBackground;
songSearchButton.BackgroundImage = songSearchNormalBackground;
languageSearchButton.BackgroundImage = languageSearchNormalBackground;
groupSearchButton.BackgroundImage = groupSearchNormalBackground;
categorySearchButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_類別查詢(已按).png"));
orderedSongsButton.BackgroundImage = orderedSongsNormalBackground;
myFavoritesButton.BackgroundImage = myFavoritesNormalBackground;
promotionsButton.BackgroundImage = promotionsNormalBackground;
deliciousFoodButton.BackgroundImage = deliciousFoodNormalBackground;
//categorySearchButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_類別查詢(已按).png"));
categorySearchButton.BackgroundImage = categorySearchActiveBackground;
isOnOrderedSongsPage = false;
ResetBtnStatus();
ResetCatBtnStatus();
loveDuetButton.BackgroundImage = loveDuetActiveBackground;

View File

@ -383,7 +383,7 @@ namespace DualScreenDemo
// 歌手名稱設置點
string artistText = song.getArtist_A(IsSimplified);
if (song.getB() != null) { artistText+="+"+ song.getArtist_B(IsSimplified); }
string fullText = songText + statusText;
int textLength = fullText.Length;
@ -394,9 +394,10 @@ namespace DualScreenDemo
songLabel.AutoSize = false;
// 創建歌手標籤
Label artistLabel = new Label();
artistLabel.Text = artistText;
artistLabel.Tag = song;
artistLabel.AutoSize = false;
Screen screen = Screen.PrimaryScreen;
int screenWidth = screen.Bounds.Width;
int screenHeight = screen.Bounds.Height;
@ -454,6 +455,19 @@ namespace DualScreenDemo
// 歌手標籤位置調整
artistLabel.Location = new Point(artistX, y + 33);
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)
{
artistText += " + " + song.getArtist_B(IsSimplified);
artistLabel.Location = new Point(artistX - 95, y + 33);
artistLabel.Size = new Size(artistWidth + 90, ItemHeight - 35);
}
artistLabel.Text = artistText;
// 創建分隔線面板
Panel separatorPanel = new Panel
{
@ -517,6 +531,9 @@ namespace DualScreenDemo
// 确保控件层次正确
songLabel.BringToFront();
artistLabel.BringToFront();
//songLabel.Controls.Add(artistLabel);
//artistLabel.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
songLabel.TextAlign = ContentAlignment.TopLeft;
}

View File

@ -10,6 +10,7 @@ using IniParser.Model;
using IniParser;
using System.Text;
namespace DualScreenDemo
{
public partial class PrimaryForm : Form
@ -940,7 +941,7 @@ namespace DualScreenDemo
candidateListBox.Visible = true;
}
//按鈕設定,游標移開後恢復預設圖案
private void ConfigureButton(Button button, int posX, int posY, int width, int height,
Bitmap normalStateImage, Bitmap mouseOverImage, Bitmap mouseDownImage,
EventHandler clickEventHandler)
@ -980,6 +981,7 @@ namespace DualScreenDemo
this.Controls.Add(button);
}
//設定透明按鈕
private void ConfigureTransButton(Button button, int posX, int posY, int width, int height,
EventHandler clickEventHandler)
{
@ -1003,38 +1005,38 @@ namespace DualScreenDemo
#region
private void InitializeOtherControls()
{
var data = LoadConfigData();
var data = LoadBtnConfigData();
InitializeButton(ref newSongAlertButton, ref newSongAlertNormalBackground, ref newSongAlertActiveBackground, "newSongAlertButton", 20, 98, 105, 120, "themes\\superstar\\button\\1.主類別\\主類別上方_新歌快報(未按).png", NewSongAlertButton_Click);
InitializeButton(ref newSongAlertButton, ref newSongAlertNormalBackground, ref newSongAlertActiveBackground, "newSongAlertButton", 20, 98, 105, 120, data["PrimaryFormBtn"]["AlertNormal"],data["PrimaryFormBtn"]["AlertActive"], NewSongAlertButton_Click);
InitializeButton(ref hotPlayButton, ref hotPlayNormalBackground, ref hotPlayActiveBackground, "hotPlayButton", 137, 98, 106, 120, "themes\\superstar\\button\\1.主類別\\主類別上方_熱門排行(未按).png", HotPlayButton_Click);
InitializeButton(ref hotPlayButton, ref hotPlayNormalBackground, ref hotPlayActiveBackground, "hotPlayButton", 137, 98, 106, 120, data["PrimaryFormBtn"]["HotNormal"], data["PrimaryFormBtn"]["HotActive"], HotPlayButton_Click);
InitializeButton(ref singerSearchButton, ref singerSearchNormalBackground, ref singerSearchActiveBackground, "singerSearchButton", 255, 98, 106, 120, "themes\\superstar\\button\\1.主類別\\主類別上方_歌星查詢(未按).png", SingerSearchButton_Click);
InitializeButton(ref singerSearchButton, ref singerSearchNormalBackground, ref singerSearchActiveBackground, "singerSearchButton", 255, 98, 106, 120, data["PrimaryFormBtn"]["SingerNormal"], data["PrimaryFormBtn"]["SingerActive"], SingerSearchButton_Click);
InitializeButton(ref songSearchButton, ref songSearchNormalBackground, ref songSearchActiveBackground, "songSearchButton", 373, 98, 106, 120, "themes\\superstar\\button\\1.主類別\\主類別上方_歌名查詢(未按).png", SongSearchButton_Click);
InitializeButton(ref songSearchButton, ref songSearchNormalBackground, ref songSearchActiveBackground, "songSearchButton", 373, 98, 106, 120, data["PrimaryFormBtn"]["SongNormal"], data["PrimaryFormBtn"]["SongActive"], SongSearchButton_Click);
InitializeButton(ref languageSearchButton, ref languageSearchNormalBackground, ref languageSearchActiveBackground, "languageSearchButton", 491, 98, 106, 120, "themes\\superstar\\button\\1.主類別\\主類別上方_語別查詢(未按).png", LanguageSongSelectionButton_Click);
InitializeButton(ref languageSearchButton, ref languageSearchNormalBackground, ref languageSearchActiveBackground, "languageSearchButton", 491, 98, 106, 120, data["PrimaryFormBtn"]["LangNormal"], data["PrimaryFormBtn"]["LangActive"], LanguageSongSelectionButton_Click);
InitializeButton(ref groupSearchButton, ref groupSearchNormalBackground, ref groupSearchActiveBackground, "groupSearchButton", 608, 98, 106, 120, "themes\\superstar\\button\\1.主類別\\主類別上方_合唱查詢(未按).png", GroupSongSelectionButton_Click);
InitializeButton(ref groupSearchButton, ref groupSearchNormalBackground, ref groupSearchActiveBackground, "groupSearchButton", 608, 98, 106, 120, data["PrimaryFormBtn"]["GroupNormal"], data["PrimaryFormBtn"]["GroupActive"], GroupSongSelectionButton_Click);
InitializeButton(ref categorySearchButton, ref categorySearchNormalBackground, ref categorySearchActiveBackground, "categorySearchButton", 726, 98, 106, 120, "themes\\superstar\\button\\1.主類別\\主類別上方_類別查詢(未按).png", CategorySearchButton_Click);
InitializeButton(ref categorySearchButton, ref categorySearchNormalBackground, ref categorySearchActiveBackground, "categorySearchButton", 726, 98, 106, 120, data["PrimaryFormBtn"]["CategNormal"], data["PrimaryFormBtn"]["CategActive"], CategorySearchButton_Click);
serviceBellButton = new Button { Text = "" };
ConfigureButton(serviceBellButton, 843, 98, 107, 120,
new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_服務鈴(未按).png")),
new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_服務鈴(按).png")),
new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_服務鈴(按).png")),
new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_服務鈴(已按).png")),
(sender, e) => OnServiceBellButtonClick(sender, e));
InitializeButton(ref orderedSongsButton, ref orderedSongsNormalBackground, ref orderedSongsActiveBackground, "orderedSongsButton", 961, 98, 107, 120, "themes\\superstar\\button\\1.主類別\\主類別上方_已點歌曲(未按).png", OrderedSongsButton_Click);
InitializeButton(ref orderedSongsButton, ref orderedSongsNormalBackground, ref orderedSongsActiveBackground, "orderedSongsButton", 961, 98, 107, 120, data["PrimaryFormBtn"]["OrderSongNormal"], data["PrimaryFormBtn"]["OrderSongActive"], OrderedSongsButton_Click);
InitializeButton(ref myFavoritesButton, ref myFavoritesNormalBackground, ref myFavoritesActiveBackground, "myFavoritesButton", 1079, 98, 107, 120, "themes\\superstar\\button\\1.主類別\\主類別上方_我的最愛(未按).png", MyFavoritesButton_Click);
InitializeButton(ref myFavoritesButton, ref myFavoritesNormalBackground, ref myFavoritesActiveBackground, "myFavoritesButton", 1079, 98, 107, 120, data["PrimaryFormBtn"]["FavoriteNormal"], data["PrimaryFormBtn"]["FavoriteActive"], MyFavoritesButton_Click);
InitializeButton(ref promotionsButton, ref promotionsNormalBackground, ref promotionsActiveBackground, "promotionsButton", 1197, 98, 107, 120, "themes\\superstar\\button\\1.主類別\\主類別上方_優惠活動(未按).png", promotionsButton_Click);
InitializeButton(ref promotionsButton, ref promotionsNormalBackground, ref promotionsActiveBackground, "promotionsButton", 1197, 98, 107, 120, data["PrimaryFormBtn"]["PromotNormal"], data["PrimaryFormBtn"]["PromotActive"], promotionsButton_Click);
InitializeButton(ref deliciousFoodButton, ref deliciousFoodNormalBackground, ref deliciousFoodActiveBackground, "deliciousFoodButton", 1315, 98, 107, 120, "themes\\superstar\\button\\1.主類別\\主類別上方_美味菜單(未按).png", DeliciousFoodButton_Click);
InitializeButton(ref deliciousFoodButton, ref deliciousFoodNormalBackground, ref deliciousFoodActiveBackground, "deliciousFoodButton", 1315, 98, 107, 120, data["PrimaryFormBtn"]["FoodNormal"], data["PrimaryFormBtn"]["FoodActive"], DeliciousFoodButton_Click);
mobileSongRequestButton = new Button { Text = "" };
@ -1276,15 +1278,14 @@ namespace DualScreenDemo
#endregion
private void InitializeButton(ref Button button, ref Bitmap normalBackground, ref Bitmap activeBackground, string buttonName, int x, int y, int width, int height, string imagePath, EventHandler clickEventHandler)
private void InitializeButton(ref Button button, ref Bitmap normalBackground, ref Bitmap activeBackground, string buttonName, int x, int y, int width, int height, string imagePath, string imagePathb, EventHandler clickEventHandler)
{
var data = LoadConfigData();
button = new Button { Text = "", Name = buttonName };
ResizeAndPositionButton(button, x, y, width, height);
Rectangle buttonCropArea = new Rectangle(x, y, width, height);
normalBackground = new Bitmap(Path.Combine(serverPath, imagePath));
activeBackground = mouseDownImage.Clone(buttonCropArea, mouseDownImage.PixelFormat);
activeBackground = new Bitmap(Path.Combine(serverPath, imagePathb));
button.BackgroundImage = normalBackground;
button.BackgroundImageLayout = ImageLayout.Stretch;
button.FlatStyle = FlatStyle.Flat;
@ -1859,7 +1860,7 @@ namespace DualScreenDemo
handwritingInputBoxForSingers?.Clear();
}
#region
private void MuteUnmuteButton_Click(object sender, EventArgs e)
{
@ -1983,7 +1984,7 @@ namespace DualScreenDemo
isWaiting = false;
}
#endregion
private void InitializeSendOffPanel()
{
sendOffPanel = new Panel
@ -2313,5 +2314,35 @@ namespace DualScreenDemo
}
}
private IniData LoadBtnConfigData()
{
var parser = new FileIniDataParser();
string iniFilePath = Path.Combine(serverPath, "img.ini");
// 使用 UTF-8 讀取 INI 檔案並解析內容
using (var reader = new StreamReader(iniFilePath, Encoding.UTF8))
{
return parser.ReadData(reader);
}
}
//主畫面按鍵圖形重置
private void ResetPrimaryBtnStatus()
{
newSongAlertButton.BackgroundImage = newSongAlertNormalBackground;
hotPlayButton.BackgroundImage = hotPlayNormalBackground;
singerSearchButton.BackgroundImage = singerSearchNormalBackground;
songSearchButton.BackgroundImage = songSearchNormalBackground;
languageSearchButton.BackgroundImage = languageSearchNormalBackground;
groupSearchButton.BackgroundImage = groupSearchNormalBackground;
categorySearchButton.BackgroundImage = categorySearchNormalBackground;
orderedSongsButton.BackgroundImage = orderedSongsNormalBackground;
myFavoritesButton.BackgroundImage = myFavoritesNormalBackground;
promotionsButton.BackgroundImage = promotionsNormalBackground;
deliciousFoodButton.BackgroundImage = deliciousFoodNormalBackground;
}
}
}

View File

@ -26,21 +26,10 @@ namespace DualScreenDemo
private void SingerSearchButton_Click(object sender, EventArgs e)
{
ResetPrimaryBtnStatus();
singerSearchButton.BackgroundImage = singerSearchActiveBackground;
newSongAlertButton.BackgroundImage = newSongAlertNormalBackground;
hotPlayButton.BackgroundImage = hotPlayNormalBackground;
//singerSearchButton.BackgroundImage = singerSearchActiveBackground;
singerSearchButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_歌星查詢(已按).png")); ;
songSearchButton.BackgroundImage = songSearchNormalBackground;
languageSearchButton.BackgroundImage = languageSearchNormalBackground;
groupSearchButton.BackgroundImage = groupSearchNormalBackground;
categorySearchButton.BackgroundImage = categorySearchNormalBackground;
orderedSongsButton.BackgroundImage = orderedSongsNormalBackground;
myFavoritesButton.BackgroundImage = myFavoritesNormalBackground;
promotionsButton.BackgroundImage = promotionsNormalBackground;
deliciousFoodButton.BackgroundImage = deliciousFoodNormalBackground;
isOnOrderedSongsPage = false;
/* 清空搜尋欄 */
ResetinputBox();