* Copyright (c) 2012, 煙臺大學計算機學院學生
* All rights reserved.
* 作 者: 劉鎮
* 完成日期: 2012 年 11 月 18 日
* 版 本 號: 3.026
* 對任務及求解方法的描述部分
* 問題描述:
1)程序運行時,單擊打開字體對話框按鈕,可選擇字體,並以所選字體作爲標籤字體。
*代碼部分:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Win10_5
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
fontDialog1.ShowColor = true;
fontDialog1.ShowApply = true;
fontDialog1.ShowDialog();
label1.Font = fontDialog1.Font;
label1.ForeColor = fontDialog1.Color;
}
}
}
測試結果: