Resim Çizimi VB.NET
Başlıkta da belirtildiği gibi kodları yerleştirdiğiniz zaman paint gibi programınızın üzerinde çizim yapabilirsiniz.
Public Class Form1 Dim x1, y1 As Integer Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown If e.Button = Windows.Forms.MouseButtons.Left Then x1 = e.X y1 = e.Y End If If e.Button = Windows.Forms.MouseButtons.Right Then x1 = e.X y1 = e.Y End If End Sub Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove If e.Button = Windows.Forms.MouseButtons.Left Then Dim renk As New System.Drawing.Pen(System.Drawing.Color.Red) Dim grafik As System.Drawing.Graphics grafik = Me.CreateGraphics() grafik.DrawLine(renk, e.X, e.Y, x1, y1) renk.Dispose() grafik.Dispose() x1 = e.X y1 = e.Y ElseIf e.Button = Windows.Forms.MouseButtons.Right Then Dim renk As New System.Drawing.Pen(Me.BackColor) Dim grafik As System.Drawing.Graphics grafik = Me.CreateGraphics() grafik.DrawLine(renk, e.X, e.Y, x1, y1) renk.Dispose() grafik.Dispose() x1 = e.X y1 = e.Y End If End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Process.Start("chrome.exe", "http://www.visualbasicdersleri.com/") Process.Start("iexplore.exe", "http://www.visualbasicdersleri.com/") Process.Start("browser.exe", "http://www.visualbasicdersleri.com/") End Sub End Class
0 yorum: