I'm trying to create a Psychedelic game on Visual Basic.NET 2002. So far, I have a button that randomly changes in color, size and location. How do I randomly change the font style in the button's text?
Printable View
I'm trying to create a Psychedelic game on Visual Basic.NET 2002. So far, I have a button that randomly changes in color, size and location. How do I randomly change the font style in the button's text?
Try asking it here.
FontStyle is an enumeration of binary numbers - you could literally roll a random number if you get the incrementing correct or probablly (more simply) do a set of 50/50 random number rolls and stack them together with logical ORs. Something like
Code:Dim iRoll As Integer
Dim fs As FontStyle
iRoll = Int(Rnd()) ' Produces a random number, either 0 or 1
If iRoll = 1 Then
fs = fs Or FontStyle.Bold 'adds the Bold fontstyle
End If
<repeat as necessary>