Form1.cs 707 B

123456789101112131415161718192021222324252627282930
  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.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace WindowsFormsGDIDrawPie
  11. {
  12. public partial class Form1 : Form
  13. {
  14. public Form1()
  15. {
  16. InitializeComponent();
  17. }
  18. private void button1_Click(object sender, EventArgs e)
  19. {
  20. //创建画布
  21. Graphics ghs = this.CreateGraphics();
  22. //创建画笔
  23. Pen mypen = new Pen(Color.Black, 3);
  24. //绘制扇形
  25. ghs.DrawPie(mypen, 50, 50, 120, 100, 210, 120);
  26. }
  27. }
  28. }