1. 在C#的代码中想直接加粗label控件的字体,

 label1.Font.Bold = true;//发现系统会提示Font.Bold是只读属性

 如果必须要加粗字体呢,方法如下:

2. 使用Font的不同构造方法: 

//加粗,并添加下划线
label1.Font = new Font(label1.Font.Name, 12, FontStyle.Bold | FontStyle.Underline);

 使用VS可以查看到Font的构造方法有很多重载,而我们现在使用的是这个方法:

/**
*第一个参数是:字体的名字
*第二个参数是:字体的大小
*第三个参数是:字体的样式,而且多个样式间使用“|”隔开
*/ public Font(string familyName, float emSize, FontStyle style);

  

C#中加粗label的字体的更多相关文章

  1. 自定义orgmode中加粗字体的颜色

    自定义orgmode中加粗字体的颜色 Table of Contents 1. orgmode中加粗字体的默认处理 2. 设置设置加粗字体的颜色 1 orgmode中加粗字体的默认处理 在orgmod ...

  2. swift - label字体 倾斜,加粗

    /* label.font = [UIFont fontWithName:@"Helvetica-Bold" size:20];//加粗 label.font = [UIFont ...

  3. 设置字体格式,加粗,regular,light

    设置文字大小和字体的途径有两个: 第一种,直接使用xib设置   ,   ,  第二种,使用代码 Label.font = [UIFont fontWithName:.f];//加粗 Label.fo ...

  4. 小程序 canvas 文字加粗

    在fillText前设置font属性 ctx.font = 'normal bold 18px sans-serif'; 但是有继承问题: 解决方法 - 1: 先绘制字体不加粗部分, 再绘制需要加粗部 ...

  5. dephi(pascal)中修改Label字体的样式(加粗,斜体,下划线)

    不废话,直接代码: Label1.Font.style:=[fsBold,fsItalic,fsUnderline]; //加粗.斜体,下划线

  6. Android TextView中 字体加粗方法

    textView.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));//加粗 textView.getPaint().setFakeBoldT ...

  7. UILabel字体加粗等属性和特效

    /* Accessing the Text Attributes text  property font  property textColor  property textAlignment  pr ...

  8. android TabLayout设置选中标签字体加粗功能

    实现 TabLayout 选中tab标签字体加粗功能如下: xml文件中定义: <android.support.design.widget.TabLayout android:id=" ...

  9. html字体加粗标签与写法

    在html中字体加粗的标签为<b>标签,当我们使用了该标签,字体就会加粗,一般用于注明重要信息,强调文字上面写法如下 字体加粗:<b>这里的字体就会加粗</b> 效 ...

随机推荐

  1. [示例] 使用 TStopwatch 计时

    使用 TStopwatch 计时 uses System.Diagnostics; var t1: TStopwatch; begin t1 := TStopwatch.StartNew; // do ...

  2. C# 字符,字符串和文本处理。

    1. 字符: 在.net中 字符是表示成16为Unicode代码值.每个字符都是System.Char结构(一个值类型)的实例. public class StringTempte { public ...

  3. 布斯乘法 Mips实现 - Booth Algorithm

    看了很久网上没有现成的代码和好一点的图,因此当一回搬运工.转自stackoverflow 布斯乘法器的Mips实现方法: .data promptStart: .asciiz "This p ...

  4. [raspberry p3] [suse] 安装maven

    [raspberry p3] [suse] 安装maven 配置package repositroy, 添加devel:tools:building vim /etc/zypp/repos.d/ope ...

  5. django drf安装和doc生成

    1.打开drf官网https://www.django-rest-framework.org/,把相关的包pip install 2.INSTALLED_APPS添加drf 3.url配置 4.tes ...

  6. 在IIS上部署Asp.Net Core 2.2.0

    1. .NET Core与Windows环境 Asp.Net Core 2.2.0 Windows 10 2. 先决条件   下载并安装.Net Core Hosting Bundle. 3. 部署过 ...

  7. JAVA程序对MYSQL数据库加锁实验

    什么是脏读,不可重复读,幻读 1. 脏读 :脏读就是指当一个事务正在访问数据,并且对数据进行了修改,而这种修改还没有提交到数据库中,这时,另外一个事务也访问这个数据,然后使用了这个数据. 2. 不可重 ...

  8. Django-02路由层

    U RL配置(URLconf)就像Django 所支撑网站的目录.它的本质是URL与要为该URL调用的视图函数之间的映射表:你就是以这种方式告诉Django,对于客户端发来的某个URL调用哪一段逻辑代 ...

  9. [Flex] 组件Tree系列 —— 支持CheckBox组件

    主程序mxml: <?xml version="1.0" encoding="utf-8"?> <!--功能描述:支持CheckBox--&g ...

  10. [ActionSprit 3.0] FMS远程共享

    package { import flash.display.Sprite; import flash.events.NetStatusEvent; import flash.events.SyncE ...