VB.NET Yazdığınız Yazıya Göre Değişen Form Rengi

R

ravex

Ultra Member
Joined
Jul 30, 2019
Messages
661
Reaction score
356
Location
Turkey
Textbox'a yazdıklarımıza göre formun rengini değiştireceğiz.

Biz rengi yazıyoruz o rengi çıkarıyor. İki değişik sürüm vereceğim: Biri direk renk ismi, diğeri ise renk kodu olacak. Başarılar..

Formda 1 buton bir textbox olacak.

Şimdi ilk kodu vereyim. Bu kod rengin ismine bağlı olacak:

Code:
If Text1.Text = "kırmızı" Then


Form1.BackColor = &HFF&


End If


If Text1.Text = "yeşil" Then


Form1.BackColor = &HFF00&


End If


If Text1.Text = "sarı" Then


Form1.BackColor = &HFFFF&


End If


If Text1.Text = "turuncu" Then


Form1.BackColor = &H80FF&


End If


If Text1.Text = "kahverengi" Then


Form1.BackColor = &H40&


End If


If Text1.Text = "siyah" Then


Form1.BackColor = &H0&


End If


If Text1.Text = "turkuaz" Then


Form1.BackColor = &HFFFF00


End If


If Text1.Text = "gri" Then


Form1.BackColor = &H808080


End If


If Text1.Text = "mor" Then


Form1.BackColor = &HFF00FF


End If


If Text1.Text = "pembe" Then


Form1.BackColor = &HFFC0FF


End If


End Sub

Yukarıdaki ilk koddu. Şu da ikinci kod, yani renk koduna bağlı olacak:

Code:
Private Sub Command1_Click()


Form1.BackColor = (Text1.Text)


End Sub


'burada texbox a yazacağınız kodlar yukarıdaki "then" bölümünden sonraki kısımdaki kodlar gibi olacak.
 
SPAM IS FORBIDDEN!
  • SPAMMERS ARE BANNED FROM THE FORUM AND CANNOT USE ANY OF THE CHEATS
  • For example: thanks, thx, very good, asdqwe, working, ty and so on!
  • For example: Writing the same message over and over. thanks, thx and so on!
  • Copying and copying someone else's message is prohibited.
  • It is forbidden to send messages to increase the number of comments on threads that you have no knowledge of.
  • Write your own opinion when commenting!
  • If you see spam message, please let us know with the REPORT button!

Tema düzenleyici

Top Bottom