字體顯示調整

This commit is contained in:
jasonchenwork 2025-05-21 15:50:41 +08:00
parent da3b238d30
commit 27f71af8c8

View File

@ -452,15 +452,15 @@ namespace DualScreenDemo
int textLength = fullText.Length; int textLength = fullText.Length;
// 計算文字寬度 // 計算文字寬度
Font normalFont = new Font("微軟正黑體", 22, FontStyle.Bold); Font normalFont = new Font("微軟正黑體", 20, FontStyle.Bold);
Font mediumFont = new Font("微軟正黑體", 16, FontStyle.Bold); Font mediumFont = new Font("微軟正黑體", 14, FontStyle.Bold);
Font smallFont = new Font("微軟正黑體", 12, FontStyle.Bold); Font smallFont = new Font("微軟正黑體", 12, FontStyle.Bold);
// 根據文字長度設置字體大小 // 根據文字長度設置字體大小
if (textLength > 18) if (textLength > 18)
{ {
songLabel.Font = smallFont; songLabel.Font = smallFont;
} }
else if (textLength > 13) else if (textLength > 8)
{ {
songLabel.Font = mediumFont; songLabel.Font = mediumFont;
} }
@ -540,15 +540,15 @@ namespace DualScreenDemo
// 根據文字長度設置字體大小 // 根據文字長度設置字體大小
if (artistText.Length > 6) if (artistText.Length > 6)
{ {
artistLabel.Font = new Font("微軟正黑體", 12, FontStyle.Bold); artistLabel.Font = new Font("微軟正黑體", 10, FontStyle.Bold);
} }
else if (artistText.Length > 4) else if (artistText.Length > 3)
{ {
artistLabel.Font = new Font("微軟正黑體", 14, FontStyle.Bold); artistLabel.Font = new Font("微軟正黑體", 12, FontStyle.Bold);
} }
else else
{ {
artistLabel.Font = new Font("微軟正黑體", 16, FontStyle.Bold); artistLabel.Font = new Font("微軟正黑體", 14, FontStyle.Bold);
} }
//artistLabel.Font = new Font("微軟正黑體", 16, FontStyle.Bold); //artistLabel.Font = new Font("微軟正黑體", 16, FontStyle.Bold);