如何动态更改字体系列? [英] How to changing the font family dynamically?

查看:81
本文介绍了如何动态更改字体系列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,





i有一个下拉列表控件。

在该控件中我有一个列表像ARIAL,VARDANA,TIMES NEW ROMAN ......这样的项目。

当我选择一种类型并单击更改按钮时,我的文本将变为所选的所需字体类型。 />


请帮忙解决这个问题。

hi friends,


i have a dropdownlist control.
in that control i have a list items like ARIAL,VARDANA,TIMES NEW ROMAN....like so on.
when i select one type and click the change button then my text will be chage into that selected desired font type.

please help to solve this.

推荐答案

如何使用C#windows应用程序更改文本框文本字体样式 [ ^ ]


On dropdownlist SelectedIndex Changed Event

On dropdownlist SelectedIndex Changed Event
Font fnt = new Font(dropdownlist.SelectedItem.ToString(), 9);
textBox1.Font = fnt;


您好您可以在下拉列表控件中添加以下代码selectedindexchanged事件

如果你在您的页面上有标签并且您想要动态更改其字体样式使用以下代码



Hi you can add following code on your dropdownlist control selectedindexchanged event
If you have lable on your page and you want to change its font style dynamically use following code

<asp:Label ID="Label1" runat="server" Text="Label">Hi this is text</asp:Label>







if (Label1.Style[HtmlTextWriterStyle.FontFamily] == null)

               Label1.Style.Add(HtmlTextWriterStyle.FontFamily, "TIMES NEW ROMAN");

           else
               Label1.Style[HtmlTextWriterStyle.FontFamily] = "Calibri";


这篇关于如何动态更改字体系列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆