From a94d07be035308f4d138d8a31da58945855731b3 Mon Sep 17 00:00:00 2001 From: "allen.yan" Date: Tue, 29 Jul 2025 13:37:11 +0800 Subject: [PATCH] =?UTF-8?q?=E9=81=99=E6=8E=A7=E5=99=A8=E5=AD=97=E9=AB=94?= =?UTF-8?q?=E5=A4=A7=E5=B0=8F=E7=B5=B1=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OverlayFormObj/OverlayForm.cs | 32 ++++----- OverlayFormObj/OverlayForm.resx | 120 ++++++++++++++++++++++++++++++++ 2 files changed, 134 insertions(+), 18 deletions(-) create mode 100644 OverlayFormObj/OverlayForm.resx diff --git a/OverlayFormObj/OverlayForm.cs b/OverlayFormObj/OverlayForm.cs index d0e3b52..1d36980 100644 --- a/OverlayFormObj/OverlayForm.cs +++ b/OverlayFormObj/OverlayForm.cs @@ -1,3 +1,4 @@ +using System.Drawing.Text; using System.IO; using System.Timers; using DBObj; @@ -38,6 +39,7 @@ namespace OverlayFormObj private int currentSegmentIndex = 0; private List textSegments = new List(); + public enum MarqueeStartPosition { Middle, @@ -76,6 +78,7 @@ namespace OverlayFormObj } }; } + private void SplitSecondLineText(string text) { textSegments.Clear(); @@ -1141,7 +1144,7 @@ namespace OverlayFormObj private string strokeRange; private int totalArtists = 0; - private const int artistsPerPage = 8; + private const int artistsPerPage = 5; //歌手單頁數量 private List currentArtistList = new List(); private void ProcessStrokeCountSelection(int number) @@ -1198,8 +1201,8 @@ private void DisplayArtists(List artists, int page)//歌星點進去後 } this.Controls.OfType().ToList().ForEach(p => this.Controls.Remove(p)); - - int artistsPerColumn = 4; + //歌手單列數量 + int artistsPerColumn = 5; int startIndex = (page - 1) * artistsPerPage; int endIndex = Math.Min(startIndex + artistsPerPage, artists.Count); @@ -1388,13 +1391,9 @@ private void DisplayArtists(List artists, int page)//歌星點進去後 maxArtistLength = Math.Max(maxArtistLength, artistText.Length); } - // 根據最大字數決定適當的字體大小 - int songFontSize = maxSongLength > 20 ? 35 : 45; - int artistFontSize = maxArtistLength > 20 ? 30 : 35; - - // 設定歌曲行間距 - int verticalSpacing = songFontSize == 30 ? 25 : 10; - + // 字體大小 + int songFontSize = 35; + int artistFontSize = 25; // 設定統一的行高 int rowHeight = 0; @@ -1429,10 +1428,8 @@ private void DisplayArtists(List artists, int page)//歌星點進去後 // 根據索引決定左側或右側顯示 int x = (i - startIndex) < songsPerColumn ? leftColumnX : rightColumnX; - // 計算 Y 位置 - int y = startY + ((i - startIndex) % songsPerColumn) * (rowHeight + verticalSpacing); - + int y = startY += 75; // 顯示歌曲名稱圖片 AddPicture(songBitmap, x, y); @@ -1498,11 +1495,10 @@ private void DisplayArtists(List artists, int page)//歌星點進去後 maxArtistLength = Math.Max(maxArtistLength, artistText.Length); } - // 動態調整字體大小 - int songFontSize = maxSongLength > 20 ? 35 : 45; - int artistFontSize = maxArtistLength > 20 ? 30 : 35; - int verticalSpacing = songFontSize == 30 ? 25 : 10; - + // 字體大小 + int songFontSize = 35; + int artistFontSize = 25; + int verticalSpacing = 50; // 統一行高計算 int rowHeight = 0; for (int i = startIndex; i < endIndex; i++) diff --git a/OverlayFormObj/OverlayForm.resx b/OverlayFormObj/OverlayForm.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/OverlayFormObj/OverlayForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file