ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • C# GDI32 GDI plus
    .NET/GDI + 2008. 11. 18. 11:21
    반응형
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Drawing;
    using System.Windows.Forms;

    namespace EllipseExam
    {
    class GDI03 : Form
    {
    Button btnDraw = null;
    [System.Runtime.InteropServices.DllImportAttribute("gdi32.dll")]
    //[System.Runtime.InteropServices.DllImport("gdi32.dll")]
    private static extern bool Ellipse(IntPtr hdc,int nLeftRect, int nTopRect, int nRightRect, int nBottmRect);
    // 헨들오프디바이스 컨텍스트 // 그래픽32를 쓸려면 있어야한다
    public GDI03()
    {
    btnDraw = new Button();
    btnDraw.Location = new Point(10, 10);
    btnDraw.Size = new Size(50, 50);
    btnDraw.Text = "타원그리기";
    btnDraw.Click += new EventHandler(btnDraw_Click);

    this.Text = "타원그리기 예제";
    this.Controls.Add(btnDraw);

    }

    static void Main(string[] args)
    {
    Application.Run(new GDI03());
    }
    int x = 30;
    private void btnDraw_Click(object sender, EventArgs e)
    {
    Graphics g = this.CreateGraphics();
    //Pen p = new Pen(Color.BlueViolet);
    //for (int i = 0; i < 10000; i++)
    //{
    //    g.DrawEllipse(p, x, 100, 200, 500);
    //    x++;
    //}
    //g.Clear(Color.BlueViolet);
    IntPtr hdc = new IntPtr();
    hdc = g.GetHdc();
    for (int i = 0, x = 1500 ; i < 10000 ; i++)
    {
    Ellipse(hdc, i+10, 0, 0, 1024);
    }
    g.Dispose();
    }
    }
    }
    반응형

    댓글

Designed by Tistory.