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);
            }
        }
    }


  • 相关阅读:
    单链表
    顺序表
    关于传输协议的简单了解
    URL/URI/URN
    点击图片弹出轮播图 -- 插件
    nodeJs中系统模块的常用方法和自定义模块暴露
    Buffer
    Sublime Text 3 安装Package Control
    npm的简单使用
    scrollTop()和document.body.scrollTop的区别
  • 原文地址:https://www.cnblogs.com/finlay/p/3234763.html
Copyright © 2011-2022 走看看