| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2573 人关注过本帖
标题:隶书是什么特别字体?
只看楼主 加入收藏
一线两电脑
Rank: 1
等 级:新手上路
帖 子:43
专家分:0
注 册:2007-7-22
收藏
 问题点数:0 回复次数:8 
隶书是什么特别字体?

图片附件: 游客没有浏览图片的权限,请 登录注册


选择隶书再勾选下划线,下划线没有反应,可是把隶书改成其它的字体,却能出现下划线,请问下边代码错在哪里?

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace radiocheck复选框
{
public partial class radiocheck复选框 : Form
{
public radiocheck复选框()
{
InitializeComponent();
}

private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
//创建录书字体对象
if (radioButton1.Checked==true) //此句和if (radioButton1.Checked==true)功能是一样的."==true"可以取消吧,此看法有待论证
textBox1.Font = new Font("隶书", textBox1.Font.Size, textBox1.Font.Style);
    }

private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
//创建宋体字体对象
if (radioButton2.Checked == true) //可以不写"==true"
textBox1.Font = new Font("宋体", textBox1.Font.Size, textBox1.Font.Style);
}

private void radioButton3_CheckedChanged(object sender, EventArgs e)
{
//创建楷书_GB2312字体对象
if (radioButton3.Checked)//可以把"radioButton3.Checked"写成"radioButton3.Checked==true"
textBox1.Font = new Font("楷体_GB2312", textBox1.Font.Size, textBox1.Font.Style);
}

private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
//创建粗体字型
if (checkBox1.Checked==true)//(checkBox1.Checked)也可以写成(checkBox1.Checked==true),意思一样,功能也一样
{
if (checkBox2.Checked && checkBox3.Checked)
textBox1.Font = new Font(textBox1.Font, FontStyle.Bold | FontStyle.Italic | FontStyle.Underline);
else if (checkBox2.Checked)
textBox1.Font = new Font(textBox1.Font, FontStyle.Bold | FontStyle.Italic);
else if (checkBox3.Checked)
textBox1.Font = new Font(textBox1.Font, FontStyle.Bold | FontStyle.Underline);
else
textBox1.Font = new Font(textBox1.Font, FontStyle.Bold);
}
else
{
if (checkBox2.Checked && checkBox3.Checked)
textBox1.Font = new Font(textBox1.Font, FontStyle.Italic | FontStyle.Underline);
else if (checkBox2.Checked)
textBox1.Font = new Font(textBox1.Font, FontStyle.Italic);
else if (checkBox3.Checked)
textBox1.Font = new Font(textBox1.Font, FontStyle.Underline);
else
textBox1.Font = new Font(textBox1.Font, FontStyle.Regular);
}
}

private void checkBox2_CheckedChanged(object sender, EventArgs e)
{
//创建斜体字型
if (checkBox2.Checked == true)
{
if (checkBox1.Checked && checkBox3.Checked)
textBox1.Font = new Font(textBox1.Font, FontStyle.Bold | FontStyle.Italic | FontStyle.Underline);
else if (checkBox1.Checked)
textBox1.Font = new Font(textBox1.Font, FontStyle.Bold | FontStyle.Italic);
else if (checkBox3.Checked)
textBox1.Font = new Font(textBox1.Font, FontStyle.Italic | FontStyle.Underline);
else
textBox1.Font = new Font(textBox1.Font, FontStyle.Italic);
}
else
{
if (checkBox1.Checked && checkBox3.Checked)
textBox1.Font = new Font(textBox1.Font, FontStyle.Bold | FontStyle.Underline);
else if (checkBox1.Checked)
textBox1.Font = new Font(textBox1.Font, FontStyle.Bold);
else if (checkBox3.Checked)
textBox1.Font = new Font(textBox1.Font, FontStyle.Underline);
else
textBox1.Font = new Font(textBox1.Font, FontStyle.Regular);
}
}

private void checkBox3_CheckedChanged(object sender, EventArgs e)
{
//创建下划线字型
if(checkBox3.Checked==true)
{
if(checkBox1.Checked&&checkBox2.Checked)
textBox1.Font=new Font(textBox1.Font,FontStyle.Bold|FontStyle.Italic|FontStyle.Underline);
else if(checkBox2.Checked)
textBox1.Font=new Font(textBox1.Font,FontStyle.Underline|FontStyle.Italic);
else if (checkBox1.Checked)
textBox1.Font=new Font(textBox1.Font,FontStyle.Bold|FontStyle.Underline);
else
textBox1.Font = new Font(textBox1.Font, FontStyle.Underline);
}
else
{
if(checkBox2.Checked&&checkBox1.Checked)
textBox1.Font=new Font(textBox1.Font,FontStyle.Bold|FontStyle.Italic);
else if(checkBox2.Checked)
textBox1.Font=new Font(textBox1.Font,FontStyle.Italic);
else if(checkBox1.Checked)
textBox1.Font=new Font(textBox1.Font,FontStyle.Bold);
else
textBox1.Font=new Font(textBox1.Font,FontStyle.Regular);
}
}
}
}

[此贴子已经被作者于2007-9-5 21:04:39编辑过]

搜索更多相关主题的帖子: 隶书 using 字体 System 下划线 
2007-09-05 21:04
zhulaolao
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2007-5-30
收藏
得分:0 
不懂呀!!!
2007-09-06 18:51
pacocai
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:1583
专家分:0
注 册:2007-3-12
收藏
得分:0 
你先在记事本或是在Word里试试隶书能不能出下划线,如果不行的话就是字体的问题,如果可以出的话再检查你的代码。

浮生若梦天边月,醉死如酒水中星。红楼一梦千人叹,岂让万夫空做贱。博客:http://hi.baidu.com/rxvip
2007-09-06 18:56
pacocai
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:1583
专家分:0
注 册:2007-3-12
收藏
得分:0 

代码给人感觉发混乱……看了头晕。

你的代码怎么写得这么乱了…………


浮生若梦天边月,醉死如酒水中星。红楼一梦千人叹,岂让万夫空做贱。博客:http://hi.baidu.com/rxvip
2007-09-06 20:01
pacocai
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:1583
专家分:0
注 册:2007-3-12
收藏
得分:0 

你的代码可以写成这样:

private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
textBox1.Font =new Font("宋体", textBox1.Font.Size, textBox1.Font.Style);
}

private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
textBox1.Font = new Font("楷体_GB2312", textBox1.Font.Size, textBox1.Font.Style);
}

private void radioButton3_CheckedChanged(object sender, EventArgs e)
{
textBox1.Font = new Font("黑体", textBox1.Font.Size, textBox1.Font.Style);
}

private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (checkBox1.Checked)
{
textBox1.Font = new Font(textBox1.Font, textBox1.Font.Style | FontStyle.Bold);
}
else
{
textBox1.Font = new Font(textBox1.Font, FontStyle.Regular);
if (checkBox2.Checked) //判断斜体
{
textBox1.Font = new Font(textBox1.Font, textBox1.Font.Style | FontStyle.Italic);
}

if (checkBox3.Checked) //判断下划线
{
textBox1.Font = new Font(textBox1.Font, textBox1.Font.Style | FontStyle.Underline);
}
}
}

private void checkBox2_CheckedChanged(object sender, EventArgs e)
{
if (checkBox2.Checked)
{
textBox1.Font = new Font(textBox1.Font, textBox1.Font.Style | FontStyle.Italic);
}
else
{
textBox1.Font = new Font(textBox1.Font, FontStyle.Regular);
if (checkBox1.Checked) //判断粗体
{
textBox1.Font = new Font(textBox1.Font, textBox1.Font.Style | FontStyle.Bold);
}

if (checkBox3.Checked) //判断下划线
{
textBox1.Font = new Font(textBox1.Font, textBox1.Font.Style | FontStyle.Underline);
}
}
}

private void checkBox3_CheckedChanged(object sender, EventArgs e)
{
if (checkBox3.Checked)
{
textBox1.Font = new Font(textBox1.Font, textBox1.Font.Style | FontStyle.Underline);
}
else
{
textBox1.Font = new Font(textBox1.Font, FontStyle.Regular);
if (checkBox1.Checked) //判断粗体
{
textBox1.Font = new Font(textBox1.Font, textBox1.Font.Style | FontStyle.Bold);
}

if (checkBox2.Checked) //判断斜体
{
textBox1.Font = new Font(textBox1.Font, textBox1.Font.Style | FontStyle.Italic);
}
}
}


浮生若梦天边月,醉死如酒水中星。红楼一梦千人叹,岂让万夫空做贱。博客:http://hi.baidu.com/rxvip
2007-09-06 20:03
pacocai
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:1583
专家分:0
注 册:2007-3-12
收藏
得分:0 
代码清晰才好看,你自己写的代码过几天你自己回头你自己都不愿看。更别说修改了……而且你写的代码很多的地方没有必要。你要注意观查看一下代码应该怎样写,能少写的尽量少写。你的代码我只看了一半就看不下去了……我觉得帮你改代码不如我自己写还快。

我上面的代码已经测试通过的,应该没有问题,不过我这里没有隶书,只有黑体,所以我换成黑体了。

浮生若梦天边月,醉死如酒水中星。红楼一梦千人叹,岂让万夫空做贱。博客:http://hi.baidu.com/rxvip
2007-09-06 20:06
pacocai
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:1583
专家分:0
注 册:2007-3-12
收藏
得分:0 
就拿你的一段代码来说吧:

if(checkBox3.Checked==true)
{
if(checkBox1.Checked&&checkBox2.Checked)
textBox1.Font=new Font(textBox1.Font,FontStyle.Bold|FontStyle.Italic|FontStyle.Underline);
else if(checkBox2.Checked)
textBox1.Font=new Font(textBox1.Font,FontStyle.Underline|FontStyle.Italic);
else if (checkBox1.Checked)
textBox1.Font=new Font(textBox1.Font,FontStyle.Bold|FontStyle.Underline);
else
textBox1.Font = new Font(textBox1.Font, FontStyle.Underline);
}

你干嘛不写成这样呢:

if (checkBox3.Checked == true)
{
if (checkBox1.Checked && checkBox2.Checked)
{
textBox1.Font = new Font(textBox1.Font, FontStyle.Bold | FontStyle.Italic | FontStyle.Underline);
}
else
{
if (checkBox2.Checked)
{
textBox1.Font = new Font(textBox1.Font, FontStyle.Underline | FontStyle.Italic);
}
else
{
if (checkBox1.Checked)
{
textBox1.Font = new Font(textBox1.Font, FontStyle.Bold | FontStyle.Underline);
}
else
{
textBox1.Font = new Font(textBox1.Font, FontStyle.Underline);
}
}
}
}

这样相对来说结构就比较清晰了,而且结构清晰的代码也不容易出错。

[此贴子已经被作者于2007-9-6 20:12:28编辑过]


浮生若梦天边月,醉死如酒水中星。红楼一梦千人叹,岂让万夫空做贱。博客:http://hi.baidu.com/rxvip
2007-09-06 20:10
一线两电脑
Rank: 1
等 级:新手上路
帖 子:43
专家分:0
注 册:2007-7-22
收藏
得分:0 
谢谢大家
谢谢pacocai,感谢你的指导,我也觉得你比我写的东西看起来舒服
隶书问题我查到了,不是代码问题,有些字体就是做不出下划线,其中包括隶书

2007-09-06 22:57
pacocai
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:1583
专家分:0
注 册:2007-3-12
收藏
得分:0 
不客气,相互学习!我也还在学习当中……

浮生若梦天边月,醉死如酒水中星。红楼一梦千人叹,岂让万夫空做贱。博客:http://hi.baidu.com/rxvip
2007-09-07 09:19
快速回复:隶书是什么特别字体?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.019021 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved