asp.net GDI+ 绘制椭圆 ,弧线,扇形

 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Web;
 5 using System.Web.UI;
 6 using System.Web.UI.WebControls;
 7 using System.Drawing;
 8 using System.Drawing.Drawing2D;
 9
10 public partial class _Default : System.Web.UI.Page
11 {
12     protected void Page_Load(object sender, EventArgs e)
13     {
14         Bitmap bitmap = new Bitmap(360, 260);
15         Graphics g = Graphics.FromImage(bitmap);
16         g.Clear(Color.White);
17         Pen pen = new Pen(Color.Blue, 2);
18         Rectangle[] rects = { new Rectangle(10, 10, 100, 200), new Rectangle(100, 200, 250, 50), new Rectangle(100, 50, 150, 150) };
19         g.DrawEllipse(pen, rects[0]);//绘制椭圆
20         pen.Color = Color.Red;
21         g.DrawArc(pen, rects[1], -60, 180);//绘制弧线
22         pen.Color = Color.Turquoise;
23         g.DrawPie(pen, rects[2], 60, -120);//绘制扇形
24         System.IO.MemoryStream ms = new System.IO.MemoryStream();
25         bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
26         Response.ClearContent();
27         Response.ContentType = "image/Jpeg";
28         Response.BinaryWrite(ms.ToArray());
29     }
30 }

时间: 2024-10-12 08:33:54

asp.net GDI+ 绘制椭圆 ,弧线,扇形的相关文章

asp.net GDI+绘制五边形

1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Web; 5 using System.Web.UI; 6 using System.Web.UI.WebControls; 7 using System.Drawing; 8 using System.Drawing.Drawing2D; 9 10 public partial class _Default : Syst

asp.net GDI+绘制多个矩形

1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Web; 5 using System.Web.UI; 6 using System.Web.UI.WebControls; 7 using System.Drawing; 8 using System.Drawing.Drawing2D; 9 10 public partial class _Default : Syst

asp.net GDI+绘制折线

1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Web; 5 using System.Web.UI; 6 using System.Web.UI.WebControls; 7 using System.Drawing; 8 using System.Drawing.Drawing2D; 9 10 public partial class _Default : Syst

asp.net GDI+绘制矩形渐变

1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Web; 5 using System.Web.UI; 6 using System.Web.UI.WebControls; 7 using System.Drawing; 8 using System.Drawing.Drawing2D; 9 10 public partial class _Default : Syst

C#GDI 绘制线段(实线或虚线)、矩形、字符串、圆、椭圆

C#GDI 绘制线段(实线或虚线).矩形.字符串.圆.椭圆 绘制基本线条和图形 比较简单,直接看代码. 1 Graphics graphics = e.Graphics; 2 3 //绘制实线 4 using (Pen pen = new Pen(Color.Black, 2)) 5 { 6 pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid; //实现 7 graphics.DrawLine(pen,0,10,100,10); 8

GDI+绘制图形和画刷填充图形

GDI+可以再Windows窗体应用程序中以编程方式绘制图形等. 可以在VS里新建项目-Windows窗体应用程序-建一个窗体.首先引入命名空间using System.Drawing.Imaging;using System.Drawing.Drawing2D; 1.绘制矩形 可以再Form窗体的Paint事件中添加以下代码 private void Form1_Paint(object sender, PaintEventArgs e)        {            // 创建钢笔

MFC 用gdi绘制填充多边形区域

MFC 用gdi绘制填充多边形区域 这里的代码是实现一个三角形的绘制,并用刷子填充颜色 在OnPaint()函数里面 运用的是给定的三角形的三个点,很多个点可以绘制多边形 [cpp] view plaincopy CBrush br(RGB(40,130,170)); CRgn rgn; CPoint arrpt[3]; arrpt[0].x = m_rcAT.right-8; arrpt[0].y = m_rcAT.top+m_rcAT.Height()*2/5; arrpt[1].x = a

使用GDI绘制验证码

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 使用GDI绘制验证码B { public parti

新手们的GDI+绘制方格

//绘制panel控件触发的事件 //不可在窗体加载时绘制方格        private void panel1_Paint(object sender, PaintEventArgs e)        {            int rowNum = 12;//行数            int colNum = 15;//列数:            Pen pen = new Pen(Color.Black);//实例化一个"画笔"            Brush br