.NET中使用API绘图 
.NET中使用API绘图_职场using System;
.NET中使用API绘图_职场
using System.Drawing;
.NET中使用API绘图_职场
using System.Collections;
.NET中使用API绘图_职场
using System.ComponentModel;
.NET中使用API绘图_职场
using System.Windows.Forms;
.NET中使用API绘图_职场
using System.Data;
.NET中使用API绘图_职场
using System.Runtime.InteropServices;
.NET中使用API绘图_职场
.NET中使用API绘图_职场
namespace API
.NET中使用API绘图_职场_10
{
.NET中使用API绘图_休闲_12    
/// <summary>
.NET中使用API绘图_职场_14    
/// Form1 的摘要说明。
.NET中使用API绘图_职场_15    
/// </summary>

.NET中使用API绘图_职场_14    public class Form1 : System.Windows.Forms.Form
.NET中使用API绘图_职场_17    
{
.NET中使用API绘图_API绘图_19        
/// <summary>
.NET中使用API绘图_职场_14        
/// 必需的设计器变量。
.NET中使用API绘图_职场_15        
/// </summary>

.NET中使用API绘图_职场_14        private System.ComponentModel.Container components = null;
.NET中使用API绘图_职场_14
.NET中使用API绘图_职场_14        
public Form1()
.NET中使用API绘图_API绘图_26        
{
.NET中使用API绘图_职场_14            
//
.NET中使用API绘图_职场_14            
// Windows 窗体设计器支持所必需的
.NET中使用API绘图_职场_14            
//
.NET中使用API绘图_职场_14
            InitializeComponent();
.NET中使用API绘图_职场_14
.NET中使用API绘图_职场_14            
//
.NET中使用API绘图_职场_14            
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
.NET中使用API绘图_职场_14            
//
.NET中使用API绘图_职场_15
        }

.NET中使用API绘图_职场_14
.NET中使用API绘图_API绘图_38        
/// <summary>
.NET中使用API绘图_职场_14        
/// 清理所有正在使用的资源。
.NET中使用API绘图_职场_15        
/// </summary>

.NET中使用API绘图_职场_14        protected override void Dispose( bool disposing )
.NET中使用API绘图_API绘图_43        
{
.NET中使用API绘图_职场_14            
if( disposing )
.NET中使用API绘图_休闲_46            
{
.NET中使用API绘图_职场_14                
if (components != null
.NET中使用API绘图_职场_49                
{
.NET中使用API绘图_职场_14                    components.Dispose();
.NET中使用API绘图_职场_15                }

.NET中使用API绘图_职场_15            }

.NET中使用API绘图_职场_14            
base.Dispose( disposing );
.NET中使用API绘图_职场_15        }

.NET中使用API绘图_职场_14
.NET中使用API绘图_API绘图_57        
Windows Form Designer generated code
.NET中使用API绘图_职场_14
.NET中使用API绘图_休闲_73        
/// <summary>
.NET中使用API绘图_职场_14        
/// 应用程序的主入口点。
.NET中使用API绘图_职场_15        
/// </summary>

.NET中使用API绘图_职场_14        [STAThread]
.NET中使用API绘图_职场_14        
static void Main() 
.NET中使用API绘图_API绘图_79        
{
.NET中使用API绘图_职场_14            Application.Run(
new Form1());
.NET中使用API绘图_职场_15        }

.NET中使用API绘图_职场_14
.NET中使用API绘图_职场_14        [StructLayout(LayoutKind.Sequential)]
.NET中使用API绘图_职场_14        
public struct LPPOINT
.NET中使用API绘图_职场_86        
{
.NET中使用API绘图_职场_14            
public long x;
.NET中使用API绘图_职场_14            
public long y;
.NET中使用API绘图_职场_15        }

.NET中使用API绘图_职场_14
.NET中使用API绘图_职场_14        [DllImport(
"gdi32.dll")] 
.NET中使用API绘图_职场_14        
private static extern bool SetROP2(IntPtr hdc,int nDrawMode);
.NET中使用API绘图_职场_14
.NET中使用API绘图_职场_14        [DllImport(
"gdi32.dll")]
.NET中使用API绘图_职场_14        
private static extern bool Rectangle
.NET中使用API绘图_职场_14            (IntPtr hdc,
int X1,  int Y1,int X2, int Y2);
.NET中使用API绘图_职场_14
.NET中使用API绘图_职场_14        [DllImport(
"gdi32.dll")]
.NET中使用API绘图_职场_14        
private static extern long CreatePen(int nPenStyle,
.NET中使用API绘图_职场_14            
int nWidth, long crColor);
.NET中使用API绘图_职场_14
.NET中使用API绘图_职场_14        [DllImport(
"gdi32.dll")]
.NET中使用API绘图_职场_14        
private static extern long SelectObject(IntPtr hdc,
.NET中使用API绘图_职场_14            
long hObject);
.NET中使用API绘图_职场_14
.NET中使用API绘图_职场_14        [DllImport(
"gdi32.dll")]
.NET中使用API绘图_职场_14        
private static extern long DeleteObject(long hObject);
.NET中使用API绘图_职场_14
.NET中使用API绘图_职场_14        
//绘矩形
.NET中使用API绘图_职场_14
        public void Draw(Graphics g, long aColor)
.NET中使用API绘图_休闲_112        
{
.NET中使用API绘图_职场_14            IntPtr hdc;
.NET中使用API绘图_职场_14            hdc 
=g.GetHdc();
.NET中使用API绘图_职场_14            SetROP2(hdc, 
10);
.NET中使用API绘图_职场_14            
long p,oldP;
.NET中使用API绘图_职场_14            p 
= CreatePen(01, aColor);
.NET中使用API绘图_职场_14            oldP 
= SelectObject(hdc, p);
.NET中使用API绘图_职场_14            Rectangle(hdc, 
20150170250);
.NET中使用API绘图_职场_14            SelectObject(hdc, oldP);
.NET中使用API绘图_职场_14            DeleteObject(p);
.NET中使用API绘图_职场_14            g.ReleaseHdc(hdc);
.NET中使用API绘图_职场_15        }

.NET中使用API绘图_职场_14
.NET中使用API绘图_职场_14        
protected override void OnPaint(PaintEventArgs e)
.NET中使用API绘图_职场_127        
{
.NET中使用API绘图_职场_14            Graphics g 
= e.Graphics;
.NET中使用API绘图_职场_14            g.FillRectangle(Brushes.White, 
this.ClientRectangle);
.NET中使用API绘图_职场_14            
//用GDI+函数绘一个兰色矩形
.NET中使用API绘图_职场_14
            g.DrawRectangle(Pens.Blue, 2020150100);
.NET中使用API绘图_职场_14            
//用API函数绘一个红色矩形
.NET中使用API绘图_职场_14
            Draw(g,255);
.NET中使用API绘图_职场_15        }

.NET中使用API绘图_职场_15    }

.NET中使用API绘图_职场_137}

.NET中使用API绘图_职场