如何使用C#Windows应用程序更改文本框文本字体样式 [英] how to change a textbox text font style using C# windows application

查看:760
本文介绍了如何使用C#Windows应用程序更改文本框文本字体样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个组合框,其中包含所有字体名称.如果我们从组合框中选择任何字体,我想将文本框值更改为特定的字体样式.

解决方案

在组合框SelectedIndex更改的事件

字体fnt =新字体(comboBox1.SelectedItem.ToString(),9);
textBox1.Font = fnt;


在Comboxbox的选定索引更改事件中
yuo可以做到这一点

 textBox.Font = " 
txtxbox.Font.Style = FontStyle.Bold; 


即:textBox1.Font = new Font("Comic Sans Cerif",16,FontStyle.Regular);

I have a combo box it contains all the font name. If we select any font from combobox i want to change the textbox value to particular font style.

解决方案

On Combobox SelectedIndex Changed Event

Font fnt = new Font(comboBox1.SelectedItem.ToString(), 9);
textBox1.Font = fnt;


On Comboxbox''s selected index change event
yuo can do this

textBox.Font="font"
txtxbox.Font.Style=FontStyle.Bold;


ie: textBox1.Font = new Font("Comic Sans Cerif", 16, FontStyle.Regular);


这篇关于如何使用C#Windows应用程序更改文本框文本字体样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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