你的字体在什么上面显示呢?
如果你用RichTextBox里面可以用如下的代码来做:
System.Drawing.Font currentFont = richTextBox1.SelectionFont;
System.Drawing.FontStyle newFontStyle;
newFontStyle = FontStyle.Bold; //| FontStyle.Underline;
richTextBox1.SelectionFont = new Font( currentFont.FontFamily, currentFont.Size, newFontStyle);
如果要显示到其它的控件,如TextBox,所有的字都将是相同的字体设置.你看一下设计时的对字体设计的代码就可以知道了.
如果你用RichTextBox里面可以用如下的代码来做:
System.Drawing.Font currentFont = richTextBox1.SelectionFont;
System.Drawing.FontStyle newFontStyle;
newFontStyle = FontStyle.Bold; //| FontStyle.Underline;
richTextBox1.SelectionFont = new Font( currentFont.FontFamily, currentFont.Size, newFontStyle);
如果要显示到其它的控件,如TextBox,所有的字都将是相同的字体设置.你看一下设计时的对字体设计的代码就可以知道了.
解决方案 »
- 一个特殊的tabcontorl问题
- windows server 2008的组件服务里没有word的选项,怎么办
- 怎么将Hashtable的使用同XML结合起来
- DateTime 的问题,求教各位高手,大家进,谢谢
- 水晶报表的一个简单的问题,解决就给分
- excel小问题~~~~路过的帮忙看看
- 如何在C#中调用SQLDMO对数据库进行update,insert等操作呢
- 存修改的数据,通不过 请各位大哥帮忙
- datagridview 里DROUPDOWNLIST里下拉事件怎么写
- 未将对象引用设置到对象的实例-----的问题..........
- 我的程序运行时出现CPU 100%,怎样调试才能知道是哪段代码占用了CPU?
- 生成数据集时循环引用错误导致项目所有数据集全部无法生成,也无法再生成新的数据集,请高手指点!!!!
this.textBox1.Font = new System.Drawing.Font("隶书", 14.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
{
string selectText = str;
int index = this.richTextBox1.Find(selectText, 0 , RichTextBoxFinds.NoHighlight & RichTextBoxFinds.None);; while (index>=0)
{
this.richTextBox1.SelectionColor = Color.Red; System.Drawing.Font currentFont = richTextBox1.SelectionFont;
System.Drawing.FontStyle newFontStyle;
newFontStyle = FontStyle.Bold | FontStyle.Underline;
richTextBox1.SelectionFont = new Font( currentFont.FontFamily, currentFont.Size, newFontStyle); this.richTextBox1.SelectionStart = this.richTextBox1.SelectionStart + this.richTextBox1.SelectionLength;
this.richTextBox1.SelectionLength = 0;
index = this.richTextBox1.Find(selectText, index +1 , RichTextBoxFinds.NoHighlight & RichTextBoxFinds.None);
} this.richTextBox1.Select();
}
to hbxtlhx(下着春雨的天)
this.textBox1.Font = new System.Drawing.Font(当前的字体, 当前字体大小, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))));怎样实现上面的!
我希望的是实现当前的字体和当前字体大小
System.Drawing.FontStyle newFontStyle;
newFontStyle = FontStyle.Bold | FontStyle.Underline;
textBox1.Font = new Font( currentFont.FontFamily, currentFont.Size, newFontStyle);
谢谢你
我实现了实现粗字体 斜字体 下划线字体
-----------------------------
这个没有实现吗?