본문 바로가기
삽질기초/SW

C# 선그리기.

by @가을바람 2009. 4. 8.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Graphic_Study2
{
    public partial class Form1 : Form
    {

        private Graphics gr;


        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            gr = pictureBox1.CreateGraphics();
            Pen pen1 = new Pen(Color.Blue, 10);
            Point First = new Point(0, 0);
            Point Second = new Point(100, 100);
            gr.DrawLine(pen1, First, Second);
// pictureBox1 내부에 그리기

            gr = this.CreateGraphics();

            gr.DrawLine(pen1, First, Second);
// Form1에 그리기
        }

        private void button1_Click(object sender, EventArgs e)
        {
                               
        }

    }
}

'삽질기초 > SW' 카테고리의 다른 글

Win 32 API 기본.  (0) 2009.04.17
c# 마우스 클릭시 포인트 받아오기.  (0) 2009.04.08
C# 스트링을 숫자로, 숫자를 스트링으로.  (0) 2009.04.03
C# 데이터 타입과 배열  (0) 2009.04.03
Win CE 5.0 시작하기~  (0) 2009.04.02