zoukankan      html  css  js  c++  java
  • 36.winform之字体对话框和颜色对话框

    效果

    实现


    代码

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    
    namespace WindowsFormsApp6 {
        public partial class Form1 : Form {
            public Form1() {
                InitializeComponent();
            }
    
            /// <summary>
            /// 当点击时弹出字体对话框
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            private void button1_Click(object sender, EventArgs e) {
                FontDialog fontDialog = new FontDialog();
                fontDialog.ShowDialog();
    
                //把在对话框中选中的字体赋值给文本框的字体
                textBox1.Font = fontDialog.Font;
            }
    
            /// <summary>
            /// 弹出颜色对话框
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            private void button2_Click(object sender, EventArgs e) {
                ColorDialog colorDialog = new ColorDialog();
                colorDialog.ShowDialog();
    
                //把在对话框中选择的颜色赋值给文本框中文本的颜色
                textBox1.ForeColor = colorDialog.Color;
            }
        }
    }
    
    
  • 相关阅读:
    mktemp -t -d用法
    使用getopts处理输入参数
    linux中$1的意思
    linux中的set -e 与set -o pipefail
    在windows 7 和linux上安装xlwt和xlrd
    nginx map使用方法
    Linux crontab下关于使用date命令和sudo命令的坑
    东哥讲义
    ldapsearch使用
    date 命令之日期和秒数转换
  • 原文地址:https://www.cnblogs.com/lz32158/p/12976747.html
Copyright © 2011-2022 走看看