[ VB 2008 ] DrawLine 예제 본문

[PL]/VB & VB.NET

[ VB 2008 ] DrawLine 예제

객과 함께. 2010. 1. 8. 19:19

Imports System.Windows.Forms
Imports System.Drawing.Graphics

Public Class Form3

   ' 프로그램명 : 사각형 그리기
    ' 제작일 : 2010. 01. 08
    ' 제작자 : 객과 함께.

    Dim RcDraw As Rectangle
    Dim Rc As New Rectangle

    Private Sub Form3_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
        RcDraw.X = e.X
        RcDraw.Y = e.Y
    End Sub

    Private Sub Form3_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp

        Rc.X = e.X
        Rc.Y = e.Y
        If Rc.X = 0 And Rc.Y = 0 Then Exit Sub
        Form3Paint()
    End Sub

    Private Sub Form3Paint()
        Dim LinePen As New Pen(Color.Red, 1)
        Dim G As Graphics = Me.CreateGraphics()

        G.DrawLine(LinePen, RcDraw.X, RcDraw.Y, Rc.X, Rc.Y)
    End Sub

    Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.WindowState = FormWindowState.Maximized
        Me.Text = " DrawLine 예제 "
    End Sub
End Class

 

[ 실행 화면 ]

 

 

짜고 보니 허접 하네...쩝 ..... 

'[PL] > VB & VB.NET' 카테고리의 다른 글

[ vb 2008] DrawArc 예제.  (0) 2010.01.08
[ VB 2008 ] DrawRectangle 예제  (0) 2010.01.08
[ VB 2008 ]외부 프로그램 실행 하기........  (0) 2010.01.07
[ vb 2008 ] 투명창 예제  (0) 2010.01.06
[ vb 2008 ] Calendar 예제  (0) 2010.01.05