+ 增加LineAweSome字体图标,测试下看看效果

This commit is contained in:
Sunny 2022-08-09 22:10:07 +08:00
parent 8091603b29
commit a7e6a65bd3
5 changed files with 152 additions and 35 deletions

View File

@ -63,11 +63,29 @@ namespace Sunny.UI
/// </summary> /// </summary>
public static readonly FontImages FontAwesomeV5Solid; public static readonly FontImages FontAwesomeV5Solid;
public const int FontAwesomeV4Count = 786; /// <summary>
public const int ElegantIconsCount = 360; /// FontAwesomeV5Brands
public const int FontAwesomeV5RegularCount = 151; /// </summary>
public const int FontAwesomeV5SolidCount = 1001; public static readonly FontImages LineAwesomeBrands;
public const int FontAwesomeV5BrandsCount = 457;
/// <summary>
/// FontAwesomeV5Regular
/// </summary>
public static readonly FontImages LineAwesomeRegular;
/// <summary>
/// FontAwesomeV5Solid
/// </summary>
public static readonly FontImages LineAwesomeSolid;
//public const int FontAwesomeV4Count = 786;
//public const int ElegantIconsCount = 360;
//public const int FontAwesomeV5RegularCount = 151;
//public const int FontAwesomeV5SolidCount = 1001;
//public const int FontAwesomeV5BrandsCount = 457;
//public const int LineAwesomeRegularCount = 151;
//public const int LineAwesomeSolidCount = 960;
//public const int LineAwesomeBrandsCount = 433;
/// <summary> /// <summary>
/// ¹¹Ô캯Êý /// ¹¹Ô캯Êý
@ -79,6 +97,9 @@ namespace Sunny.UI
FontAwesomeV5Brands = new FontImages(ReadFontFileFromResource("Sunny.UI.Font.fa-brands-400.ttf")); FontAwesomeV5Brands = new FontImages(ReadFontFileFromResource("Sunny.UI.Font.fa-brands-400.ttf"));
FontAwesomeV5Regular = new FontImages(ReadFontFileFromResource("Sunny.UI.Font.fa-regular-400.ttf")); FontAwesomeV5Regular = new FontImages(ReadFontFileFromResource("Sunny.UI.Font.fa-regular-400.ttf"));
FontAwesomeV5Solid = new FontImages(ReadFontFileFromResource("Sunny.UI.Font.fa-solid-900.ttf")); FontAwesomeV5Solid = new FontImages(ReadFontFileFromResource("Sunny.UI.Font.fa-solid-900.ttf"));
LineAwesomeBrands = new FontImages(ReadFontFileFromResource("Sunny.UI.Font.la-brands-400.ttf"));
LineAwesomeRegular = new FontImages(ReadFontFileFromResource("Sunny.UI.Font.la-regular-400.ttf"));
LineAwesomeSolid = new FontImages(ReadFontFileFromResource("Sunny.UI.Font.la-solid-900.ttf"));
} }
private static byte[] ReadFontFileFromResource(string name) private static byte[] ReadFontFileFromResource(string name)
@ -214,6 +235,12 @@ namespace Sunny.UI
return FontAwesomeV5Regular.GetFont(symbolValue, imageSize); return FontAwesomeV5Regular.GetFont(symbolValue, imageSize);
case UISymbolType.FontAwesomeV5Solid: case UISymbolType.FontAwesomeV5Solid:
return FontAwesomeV5Solid.GetFont(symbolValue, imageSize); return FontAwesomeV5Solid.GetFont(symbolValue, imageSize);
case UISymbolType.LineAwesomeBrands:
return LineAwesomeBrands.GetFont(symbolValue, imageSize);
case UISymbolType.LineAwesomeRegular:
return LineAwesomeRegular.GetFont(symbolValue, imageSize);
case UISymbolType.LineAwesomeSolid:
return LineAwesomeSolid.GetFont(symbolValue, imageSize);
default: default:
if (symbol > 0xF000) if (symbol > 0xF000)
return FontAwesomeV4.GetFont(symbolValue, imageSize); return FontAwesomeV4.GetFont(symbolValue, imageSize);

View File

@ -38,12 +38,9 @@ namespace Sunny.UI
FontAwesomeV4 = 0, FontAwesomeV4 = 0,
FontAwesomeV5Brands = 1, FontAwesomeV5Brands = 1,
FontAwesomeV5Regular = 2, FontAwesomeV5Regular = 2,
FontAwesomeV5Solid = 3 FontAwesomeV5Solid = 3,
} LineAwesomeBrands = 4,
LineAwesomeRegular = 5,
public enum ImageFont LineAwesomeSolid = 6
{
FontAwesome,
Elegant
} }
} }

View File

@ -39,6 +39,9 @@ namespace Sunny.UI
private readonly ConcurrentQueue<Label> FontAwesomeV5SolidLabels = new ConcurrentQueue<Label>(); private readonly ConcurrentQueue<Label> FontAwesomeV5SolidLabels = new ConcurrentQueue<Label>();
private readonly ConcurrentQueue<Label> FontAwesomeV5BrandsLabels = new ConcurrentQueue<Label>(); private readonly ConcurrentQueue<Label> FontAwesomeV5BrandsLabels = new ConcurrentQueue<Label>();
private readonly ConcurrentQueue<Label> FontAwesomeV5RegularLabels = new ConcurrentQueue<Label>(); private readonly ConcurrentQueue<Label> FontAwesomeV5RegularLabels = new ConcurrentQueue<Label>();
private readonly ConcurrentQueue<Label> LineAwesomeSolidLabels = new ConcurrentQueue<Label>();
private readonly ConcurrentQueue<Label> LineAwesomeBrandsLabels = new ConcurrentQueue<Label>();
private readonly ConcurrentQueue<Label> LineAwesomeRegularLabels = new ConcurrentQueue<Label>();
/// <summary> /// <summary>
/// 构造函数 /// 构造函数
@ -113,6 +116,36 @@ namespace Sunny.UI
} }
} }
while (!LineAwesomeSolidLabels.IsEmpty)
{
if (LineAwesomeSolidLabels.TryDequeue(out Label lbl))
{
lpV5Solid.Controls.Add(lbl);
SymbolValue symbol = (SymbolValue)lbl.Tag;
toolTip.SetToolTip(lbl, symbol.ToString());
}
}
while (!LineAwesomeRegularLabels.IsEmpty)
{
if (LineAwesomeRegularLabels.TryDequeue(out Label lbl))
{
lpV5Regular.Controls.Add(lbl);
SymbolValue symbol = (SymbolValue)lbl.Tag;
toolTip.SetToolTip(lbl, symbol.ToString());
}
}
while (!LineAwesomeBrandsLabels.IsEmpty)
{
if (LineAwesomeBrandsLabels.TryDequeue(out Label lbl))
{
lpV5Brands.Controls.Add(lbl);
SymbolValue symbol = (SymbolValue)lbl.Tag;
toolTip.SetToolTip(lbl, symbol.ToString());
}
}
timer.Start(); timer.Start();
} }

View File

@ -75,7 +75,7 @@
this.tabControl1.Location = new System.Drawing.Point(0, 46); this.tabControl1.Location = new System.Drawing.Point(0, 46);
this.tabControl1.Name = "tabControl1"; this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0; this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(541, 456); this.tabControl1.Size = new System.Drawing.Size(705, 456);
this.tabControl1.TabIndex = 0; this.tabControl1.TabIndex = 0;
// //
// tabPage1 // tabPage1
@ -84,7 +84,7 @@
this.tabPage1.Location = new System.Drawing.Point(4, 22); this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1"; this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3); this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(533, 430); this.tabPage1.Size = new System.Drawing.Size(697, 430);
this.tabPage1.TabIndex = 0; this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Custom"; this.tabPage1.Text = "Custom";
this.tabPage1.UseVisualStyleBackColor = true; this.tabPage1.UseVisualStyleBackColor = true;
@ -95,16 +95,16 @@
this.lpCustom.Dock = System.Windows.Forms.DockStyle.Fill; this.lpCustom.Dock = System.Windows.Forms.DockStyle.Fill;
this.lpCustom.Location = new System.Drawing.Point(3, 3); this.lpCustom.Location = new System.Drawing.Point(3, 3);
this.lpCustom.Name = "lpCustom"; this.lpCustom.Name = "lpCustom";
this.lpCustom.Size = new System.Drawing.Size(527, 424); this.lpCustom.Size = new System.Drawing.Size(691, 424);
this.lpCustom.TabIndex = 1; this.lpCustom.TabIndex = 1;
// //
// tabPage2 // tabPage2
// //
this.tabPage2.Controls.Add(this.lpAwesome); this.tabPage2.Controls.Add(this.lpAwesome);
this.tabPage2.Location = new System.Drawing.Point(4, 26); this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2"; this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3); this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(533, 426); this.tabPage2.Size = new System.Drawing.Size(697, 430);
this.tabPage2.TabIndex = 1; this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "FontAwesomeV4"; this.tabPage2.Text = "FontAwesomeV4";
this.tabPage2.UseVisualStyleBackColor = true; this.tabPage2.UseVisualStyleBackColor = true;
@ -116,18 +116,18 @@
this.lpAwesome.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(158)))), ((int)(((byte)(255))))); this.lpAwesome.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(158)))), ((int)(((byte)(255)))));
this.lpAwesome.Location = new System.Drawing.Point(3, 3); this.lpAwesome.Location = new System.Drawing.Point(3, 3);
this.lpAwesome.Name = "lpAwesome"; this.lpAwesome.Name = "lpAwesome";
this.lpAwesome.Size = new System.Drawing.Size(527, 420); this.lpAwesome.Size = new System.Drawing.Size(691, 424);
this.lpAwesome.TabIndex = 1; this.lpAwesome.TabIndex = 1;
// //
// tabPage5 // tabPage5
// //
this.tabPage5.Controls.Add(this.lpV5Solid); this.tabPage5.Controls.Add(this.lpV5Solid);
this.tabPage5.Location = new System.Drawing.Point(4, 26); this.tabPage5.Location = new System.Drawing.Point(4, 22);
this.tabPage5.Name = "tabPage5"; this.tabPage5.Name = "tabPage5";
this.tabPage5.Padding = new System.Windows.Forms.Padding(3); this.tabPage5.Padding = new System.Windows.Forms.Padding(3);
this.tabPage5.Size = new System.Drawing.Size(533, 426); this.tabPage5.Size = new System.Drawing.Size(697, 430);
this.tabPage5.TabIndex = 4; this.tabPage5.TabIndex = 4;
this.tabPage5.Text = "FontAwesomeV5"; this.tabPage5.Text = "V5Solid";
this.tabPage5.UseVisualStyleBackColor = true; this.tabPage5.UseVisualStyleBackColor = true;
// //
// lpV5Solid // lpV5Solid
@ -137,16 +137,16 @@
this.lpV5Solid.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(158)))), ((int)(((byte)(255))))); this.lpV5Solid.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(158)))), ((int)(((byte)(255)))));
this.lpV5Solid.Location = new System.Drawing.Point(3, 3); this.lpV5Solid.Location = new System.Drawing.Point(3, 3);
this.lpV5Solid.Name = "lpV5Solid"; this.lpV5Solid.Name = "lpV5Solid";
this.lpV5Solid.Size = new System.Drawing.Size(527, 420); this.lpV5Solid.Size = new System.Drawing.Size(691, 424);
this.lpV5Solid.TabIndex = 3; this.lpV5Solid.TabIndex = 3;
// //
// tabPage3 // tabPage3
// //
this.tabPage3.Controls.Add(this.lpElegant); this.tabPage3.Controls.Add(this.lpElegant);
this.tabPage3.Location = new System.Drawing.Point(4, 26); this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Name = "tabPage3"; this.tabPage3.Name = "tabPage3";
this.tabPage3.Padding = new System.Windows.Forms.Padding(3); this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
this.tabPage3.Size = new System.Drawing.Size(533, 426); this.tabPage3.Size = new System.Drawing.Size(697, 430);
this.tabPage3.TabIndex = 2; this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "ElegantFont"; this.tabPage3.Text = "ElegantFont";
this.tabPage3.UseVisualStyleBackColor = true; this.tabPage3.UseVisualStyleBackColor = true;
@ -158,16 +158,16 @@
this.lpElegant.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(158)))), ((int)(((byte)(255))))); this.lpElegant.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(158)))), ((int)(((byte)(255)))));
this.lpElegant.Location = new System.Drawing.Point(3, 3); this.lpElegant.Location = new System.Drawing.Point(3, 3);
this.lpElegant.Name = "lpElegant"; this.lpElegant.Name = "lpElegant";
this.lpElegant.Size = new System.Drawing.Size(527, 420); this.lpElegant.Size = new System.Drawing.Size(691, 424);
this.lpElegant.TabIndex = 2; this.lpElegant.TabIndex = 2;
// //
// tabPage4 // tabPage4
// //
this.tabPage4.Controls.Add(this.lpV5Brands); this.tabPage4.Controls.Add(this.lpV5Brands);
this.tabPage4.Location = new System.Drawing.Point(4, 26); this.tabPage4.Location = new System.Drawing.Point(4, 22);
this.tabPage4.Name = "tabPage4"; this.tabPage4.Name = "tabPage4";
this.tabPage4.Padding = new System.Windows.Forms.Padding(3); this.tabPage4.Padding = new System.Windows.Forms.Padding(3);
this.tabPage4.Size = new System.Drawing.Size(533, 426); this.tabPage4.Size = new System.Drawing.Size(697, 430);
this.tabPage4.TabIndex = 3; this.tabPage4.TabIndex = 3;
this.tabPage4.Text = "V5Brands"; this.tabPage4.Text = "V5Brands";
this.tabPage4.UseVisualStyleBackColor = true; this.tabPage4.UseVisualStyleBackColor = true;
@ -179,16 +179,16 @@
this.lpV5Brands.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(158)))), ((int)(((byte)(255))))); this.lpV5Brands.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(158)))), ((int)(((byte)(255)))));
this.lpV5Brands.Location = new System.Drawing.Point(3, 3); this.lpV5Brands.Location = new System.Drawing.Point(3, 3);
this.lpV5Brands.Name = "lpV5Brands"; this.lpV5Brands.Name = "lpV5Brands";
this.lpV5Brands.Size = new System.Drawing.Size(527, 420); this.lpV5Brands.Size = new System.Drawing.Size(691, 424);
this.lpV5Brands.TabIndex = 3; this.lpV5Brands.TabIndex = 3;
// //
// tabPage6 // tabPage6
// //
this.tabPage6.Controls.Add(this.lpV5Regular); this.tabPage6.Controls.Add(this.lpV5Regular);
this.tabPage6.Location = new System.Drawing.Point(4, 26); this.tabPage6.Location = new System.Drawing.Point(4, 22);
this.tabPage6.Name = "tabPage6"; this.tabPage6.Name = "tabPage6";
this.tabPage6.Padding = new System.Windows.Forms.Padding(3); this.tabPage6.Padding = new System.Windows.Forms.Padding(3);
this.tabPage6.Size = new System.Drawing.Size(533, 426); this.tabPage6.Size = new System.Drawing.Size(697, 430);
this.tabPage6.TabIndex = 5; this.tabPage6.TabIndex = 5;
this.tabPage6.Text = "V5Regular"; this.tabPage6.Text = "V5Regular";
this.tabPage6.UseVisualStyleBackColor = true; this.tabPage6.UseVisualStyleBackColor = true;
@ -200,7 +200,7 @@
this.lpV5Regular.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(158)))), ((int)(((byte)(255))))); this.lpV5Regular.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(158)))), ((int)(((byte)(255)))));
this.lpV5Regular.Location = new System.Drawing.Point(3, 3); this.lpV5Regular.Location = new System.Drawing.Point(3, 3);
this.lpV5Regular.Name = "lpV5Regular"; this.lpV5Regular.Name = "lpV5Regular";
this.lpV5Regular.Size = new System.Drawing.Size(527, 420); this.lpV5Regular.Size = new System.Drawing.Size(691, 424);
this.lpV5Regular.TabIndex = 3; this.lpV5Regular.TabIndex = 3;
// //
// bg1 // bg1
@ -235,7 +235,7 @@
this.panel1.Dock = System.Windows.Forms.DockStyle.Top; this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1"; this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(541, 46); this.panel1.Size = new System.Drawing.Size(705, 46);
this.panel1.TabIndex = 0; this.panel1.TabIndex = 0;
// //
// label1 // label1
@ -268,10 +268,10 @@
// UIFontImages // UIFontImages
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(541, 502); this.ClientSize = new System.Drawing.Size(705, 502);
this.Controls.Add(this.tabControl1); this.Controls.Add(this.tabControl1);
this.Controls.Add(this.panel1); this.Controls.Add(this.panel1);
this.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.Font = new System.Drawing.Font("宋体", 9F);
this.Name = "UIFontImages"; this.Name = "UIFontImages";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Symbols"; this.Text = "Symbols";

View File

@ -1,4 +1,64 @@
<root> <?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: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:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true"> <xsd:element name="root" msdata:IsDataSet="true">