我需要从标签控件中获取文本的默认字体名称。(IE)
<asp:Label Text="Test" ID="lblq" runat="server"></asp:Label>
如何找到标签 'lblq' 的字体名称(或)字体系列?字体系列是否取决于浏览器?
我在下拉列表中加载了默认字体。当我单击一个按钮时,我只需要将标签“lblq”字体名称设置为下拉列表的选定值。
尝试:-
string myVal = lblq.Font.Name;
this is not as relavent to your question but might give you a head start
// this will give you the list of all installed fonts
using System.Drawing.Text;
InstalledFontCollection fontList = new InstalledFontCollection();
foreach(FontFamily family in fontList.Families)
{
ListBox1.Items.Add(family.Name);
}
You can find original font name using following code:
string originalFontName=lblq.Font.OriginalFontName;