Results 1 to 3 of 3

Thread: Random Font Style?

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2003
    Location
    San Jose, CA
    Posts
    3

    Question Random Font Style?

    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?

  2. #2
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171
    Try asking it here.


    Has someone helped you? Then you can Rate their helpful post.

  3. #3
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    518
    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>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width