วันศุกร์ที่ 16 มกราคม พ.ศ. 2552

Draw Rectangle In Event Form Click





' VB.NET Form Source Code

Option Explicit On
Option Strict On

Public Class Form1

Dim g_Graphics As System.Drawing.Graphics
Dim g_Graphics_Pen As Pen
Dim g_rRect As Rectangle
Dim g_i As Integer

Const MAXLOOP As Integer = 250

Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click

g_Graphics = Me.CreateGraphics
g_Graphics_Pen = New Pen(Color.Blue, 20)
g_rRect = New Rectangle(100, 100, 300, 300)
g_Graphics.DrawRectangle(g_Graphics_Pen, g_rRect)

Dim r As Integer

For g_i = 1 To MAXLOOP
r = g_i
g_Graphics_Pen = New Pen(Color.FromArgb(r, 0, 0), 10)
g_rRect = New Rectangle(0, g_i, 300, g_i * 2)
g_Graphics.DrawRectangle(g_Graphics_Pen, g_rRect)
Next g_i

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Me.FormBorderStyle = Windows.Forms.FormBorderStyle.FixedToolWindow
Me.Text = " Draw Rectangle In Event Form Click With VB.NET "
Me.BackColor = Color.DarkGreen

End Sub

End Class

' Design VB.NET Source Code Games By Fernando Firaht

ไม่มีความคิดเห็น:

แสดงความคิดเห็น