遙控器字體大小統一

This commit is contained in:
allen.yan 2025-07-29 13:37:11 +08:00
parent b263798557
commit a94d07be03
2 changed files with 134 additions and 18 deletions

View File

@ -1,3 +1,4 @@
using System.Drawing.Text;
using System.IO; using System.IO;
using System.Timers; using System.Timers;
using DBObj; using DBObj;
@ -38,6 +39,7 @@ namespace OverlayFormObj
private int currentSegmentIndex = 0; private int currentSegmentIndex = 0;
private List<string> textSegments = new List<string>(); private List<string> textSegments = new List<string>();
public enum MarqueeStartPosition public enum MarqueeStartPosition
{ {
Middle, Middle,
@ -76,6 +78,7 @@ namespace OverlayFormObj
} }
}; };
} }
private void SplitSecondLineText(string text) private void SplitSecondLineText(string text)
{ {
textSegments.Clear(); textSegments.Clear();
@ -1141,7 +1144,7 @@ namespace OverlayFormObj
private string strokeRange; private string strokeRange;
private int totalArtists = 0; private int totalArtists = 0;
private const int artistsPerPage = 8; private const int artistsPerPage = 5; //歌手單頁數量
private List<Artist> currentArtistList = new List<Artist>(); private List<Artist> currentArtistList = new List<Artist>();
private void ProcessStrokeCountSelection(int number) private void ProcessStrokeCountSelection(int number)
@ -1198,8 +1201,8 @@ private void DisplayArtists(List<Artist> artists, int page)//歌星點進去後
} }
this.Controls.OfType<PictureBox>().ToList().ForEach(p => this.Controls.Remove(p)); this.Controls.OfType<PictureBox>().ToList().ForEach(p => this.Controls.Remove(p));
//歌手單列數量
int artistsPerColumn = 4; int artistsPerColumn = 5;
int startIndex = (page - 1) * artistsPerPage; int startIndex = (page - 1) * artistsPerPage;
int endIndex = Math.Min(startIndex + artistsPerPage, artists.Count); int endIndex = Math.Min(startIndex + artistsPerPage, artists.Count);
@ -1388,13 +1391,9 @@ private void DisplayArtists(List<Artist> artists, int page)//歌星點進去後
maxArtistLength = Math.Max(maxArtistLength, artistText.Length); maxArtistLength = Math.Max(maxArtistLength, artistText.Length);
} }
// 根據最大字數決定適當的字體大小 // 字體大小
int songFontSize = maxSongLength > 20 ? 35 : 45; int songFontSize = 35;
int artistFontSize = maxArtistLength > 20 ? 30 : 35; int artistFontSize = 25;
// 設定歌曲行間距
int verticalSpacing = songFontSize == 30 ? 25 : 10;
// 設定統一的行高 // 設定統一的行高
int rowHeight = 0; int rowHeight = 0;
@ -1429,10 +1428,8 @@ private void DisplayArtists(List<Artist> artists, int page)//歌星點進去後
// 根據索引決定左側或右側顯示 // 根據索引決定左側或右側顯示
int x = (i - startIndex) < songsPerColumn ? leftColumnX : rightColumnX; int x = (i - startIndex) < songsPerColumn ? leftColumnX : rightColumnX;
// 計算 Y 位置 // 計算 Y 位置
int y = startY + ((i - startIndex) % songsPerColumn) * (rowHeight + verticalSpacing); int y = startY += 75;
// 顯示歌曲名稱圖片 // 顯示歌曲名稱圖片
AddPicture(songBitmap, x, y); AddPicture(songBitmap, x, y);
@ -1498,11 +1495,10 @@ private void DisplayArtists(List<Artist> artists, int page)//歌星點進去後
maxArtistLength = Math.Max(maxArtistLength, artistText.Length); maxArtistLength = Math.Max(maxArtistLength, artistText.Length);
} }
// 動態調整字體大小 // 字體大小
int songFontSize = maxSongLength > 20 ? 35 : 45; int songFontSize = 35;
int artistFontSize = maxArtistLength > 20 ? 30 : 35; int artistFontSize = 25;
int verticalSpacing = songFontSize == 30 ? 25 : 10; int verticalSpacing = 50;
// 統一行高計算 // 統一行高計算
int rowHeight = 0; int rowHeight = 0;
for (int i = startIndex; i < endIndex; i++) for (int i = startIndex; i < endIndex; i++)

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>