zoukankan      html  css  js  c++  java
  • (C#) GDI+简单绘图画直线

    GDI+:Graphics Device InterfacePlus也就是图形设备接口,提供了各种丰富的图形图像处理功能;在C#.NET中,使用GDI+处理二维(2D)的图形和图像,使用DirectX处理三维(3D)的图形图像,图形图像处理用到的主要命名空间是System.Drawing:提供了对GDI+基本图形功能的访问,主要有Graphics类、Bitmap类、从Brush类继承的类、Font类、Icon类、Image类、Pen类、Color类等.

    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 _10._2._1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
    
            private void Form1_Paint(object sender, PaintEventArgs e)
            {
                //DrawOne(e.Graphics);
            }
            private void DrawOne(Graphics g)
            {
                //Graphics g = e.Graphics;
                g = this.CreateGraphics();
                Pen pen1 = new Pen(Color.Green, 5);
                Point[] points =
                {
                    new Point(100,20),
                    new Point(100,80),
                    new Point(140,20),
                    new Point(200,200)
                };
                g.DrawLines(pen1, points);
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                Graphics g = this.CreateGraphics();
                DrawOne(g);
            }
        }
    }


  • 相关阅读:
    winform 计算器
    ajax无刷新上传图片
    Dapper的基本使用
    补充1
    Ajax2
    Ajax1
    jQuery2
    Select查询语句2
    jQuery1
    分页与组合查询
  • 原文地址:https://www.cnblogs.com/finlay/p/3234763.html
Copyright © 2011-2022 走看看