0
点赞
收藏
分享

微信扫一扫

C#编程-134:字体颜色对话框_彭世瑜_新浪博客

心如止水_c736 2022-04-02 阅读 22

C#编程-134:字体颜色对话框_彭世瑜_新浪博客_winform​​




  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. namespace ColorFontDialogTest
  10. {
  11. public partial class Form1 : Form
  12. {
  13. public Form1()
  14. {
  15. InitializeComponent();
  16. }
  17. private void btnBackColor_Click(object sender, EventArgs e)
  18. {
  19. if (colorDialog1.ShowDialog() == DialogResult.OK)
  20. {
  21. this.BackColor = colorDialog1.Color;
  22. }
  23. }
  24. private void btnFont_Click(object sender, EventArgs e)
  25. {
  26. if (fontDialog1.ShowDialog() == DialogResult.OK)
  27. {
  28. textBox1.Font = fontDialog1.Font;
  29. }
  30. }
  31. private void Form1_Load(object sender, EventArgs e)
  32. {
  33. textBox1.Text = "测试字体属性的文字,试试这段话的字体属性会不会被修改";
  34. }
  35. }
  36. }


举报

相关推荐

0 条评论