当前位置:网站首页>c#ColorDialog更改文本颜色和FontDialog更改文本字体的使用示例
c#ColorDialog更改文本颜色和FontDialog更改文本字体的使用示例
2022-06-25 06:43:00 【ykxxcs】
c#ColorDialog更改文本颜色和FontDialog更改文本字体的使用示例

public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//显示颜色对话框ColorDialog
private void button1_Click(object sender, EventArgs e)
{
DialogResult dr = colorDialog1.ShowDialog();
//如果选中颜色,单击“确定”按钮则改变文本框的文本颜色
if (dr == DialogResult.OK)
{
textBox1.ForeColor = colorDialog1.Color;
}
}
//更改文字字体等对话框FontDialog
private void button2_Click(object sender, EventArgs e)
{
DialogResult dr = fontDialog1.ShowDialog();
//如果选中字体,单击“确定”按钮则改变文本框的文本字体
if (dr == DialogResult.OK)
{
textBox1.Font = fontDialog1.Font;
}
}
}
边栏推荐
- Importer des données dans MATLAB
- How to resize an image in C #
- Technology blog | how to communicate using SSE
- 將數據導入到MATLAB
- ts环境搭建
- Atlas conflict Remote Code Execution Vulnerability (cve-2022-26134 vulnerability analysis and protection
- 417-二叉树的层序遍历1(102. 二叉树的层序遍历、107.二叉树的层次遍历 II、199.二叉树的右视图、637.二叉树的层平均值)
- Invalid Navicat scheduled task
- 力扣76题,最小覆盖字串
- Apache CouchDB 代码执行漏洞(CVE-2022-24706 )批量POC
猜你喜欢

What are the problems with traditional IO? Why is zero copy introduced?

PCB board design - automatic layout 2021-10-15

Ubuntu18下登录mysql 5.7设置root密码

Technology blog | how to communicate using SSE

Ph中和过程建模

基于RBAC 的SAAS系统权限设计

Machine learning notes linear regression of time series

The fourth floor is originally the fourth floor. Let's have a look

Six causes of PCB disconnection 2021-10-20

环网冗余式CAN/光纤转换器的CAN光端机在消防火灾联网报警系统中的应用
随机推荐
剑指offer刷题(简单等级)
bat启动.NET Core
How to select lead-free and lead-free tin spraying for PCB? 2021-11-16
Find out what informatization is, and let enterprises embark on the right path of transformation and upgrading
420-二叉树的层序遍历2(429. N 叉树的层序遍历、515.在每个树行中找最大值、116.填充每个节点的下一个右侧节点指针、104.二叉树的最大深度、111.二叉树的最小深度)
php入门基础记录
[Video] ffplay uses MJPEG format to play USB camera
WebSocket的理解以及应用场景
MySQL interview - the response of executing SQL is relatively slow, and the troubleshooting ideas.
NPM install reports an error: gyp err! configure error
Use the frame statistics function of the message and waveform recording analyzer royalscope to troubleshoot the accidental faults of the CAN bus
洛谷P2048 [NOI2010] 超级钢琴(RMQ+优先队列)
Analysis of kinsing dual platform mining family virus
VOCALOID笔记
WinForm implementation window is always at the top level
剑指offer刷题(中等等级)
"Spatial transformation" significantly improves the quality of ground point extraction of cliff point cloud
Atlas conference vulnerability analysis collection
2265. number of nodes with statistical value equal to the average value of subtree
Knowledge sharing 𞓜 conventional laminated structure of six layer PCB