GDI+绘制-boost电路计算模版——mathcad

时间:2021-06-09 23:59:47
【文件属性】:
文件名称:GDI+绘制-boost电路计算模版——mathcad
文件大小:5.1MB
文件格式:PDF
更新时间:2021-06-09 23:59:47
控件,.NET 3.2 GDI+绘制 既然 GDI+在界面绘制上占有重要的地位,那么问题来了,如何才能调用 GDI+绘制对象 呢?常用的方式为重载控件的 OnPaint事件,然后在事件内进行 GDI+绘制,请看下面的代 码: 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 GDIDemo { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { //绘图无效 Pen drawingPen = new Pen(Color.Black, 3); this.CreateGraphics().DrawArc( drawingPen, 36, 19, 100, 100, 40, 180); drawingPen.Dispose(); } protected override void OnPaint(PaintEventArgs e) { Pen drawingPen = new Pen(Color.Black, 3); Rectangle rec=new Rectangle(10,10,120,80); e.Graphics.DrawRectangle(drawingPen, rec); drawingPen.Dispose(); base.OnPaint(e); } private void button1_Click(object sender, EventArgs e) { Pen drawingPen = new Pen(Color.Red, 15); Graphics g = this.CreateGraphics();

网友评论