Paintteki Kalem Aracı Yapımı VB 6.0

Paintteki kalem aracının benzerini vb 6.0 yapalm.. rseim

istediğimiz rengi yukarıdan seçiyoz ve daha sonra fare ile formun üzerine istediğimiz gibi çizebiliyoruz.. programda tek combobox kullanılmıştır.

ComboBox’a yazılacak renkler sırasıyla;

KIRMIZI
MAVİ
YEŞİL
SARI
TURKUAZ YEŞİL
MOR
GÜMÜŞ

Renkleri yazdıktan sonra  programa yazılacak kodlar;

[code=’VB’]Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
x1 = X
y1 = Y
End Sub[/code]

[code=’VB’]Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Combo1.ListIndex = 0 Then
If Button = 1 Then
Line (x1, y1)-(X, Y), RGB(256, 0, 0)
x1 = X
y1 = Y
End If
End If
If Combo1.ListIndex = 1 Then
If Button = 1 Then
Line (x1, y1)-(X, Y), RGB(0, 0, 256)
x1 = X
y1 = Y
End If
End If
If Combo1.ListIndex = 2 Then
If Button = 1 Then
Line (x1, y1)-(X, Y), RGB(0, 256, 0)
x1 = X
y1 = Y
End If
End If
If Combo1.ListIndex = 3 Then
If Button = 1 Then
Line (x1, y1)-(X, Y), RGB(256, 256, 0)
x1 = X
y1 = Y
End If
End If
If Combo1.ListIndex = 4 Then
If Button = 1 Then
Line (x1, y1)-(X, Y), RGB(0, 256, 256)
x1 = X
y1 = Y
End If
End If
If Combo1.ListIndex = 5 Then
If Button = 1 Then
Line (x1, y1)-(X, Y), RGB(256, 0, 256)
x1 = X
y1 = Y
End If
End If
If Combo1.ListIndex = 6 Then
If Button = 1 Then
Line (x1, y1)-(X, Y), RGB(200, 200, 200)
x1 = X
y1 = Y
End If
End If
End Sub[/code]

Projeyi İndir

Yorumlar 3

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir