Results 1 to 25 of 25

Thread: How to change Font ?

  1. #1

    Thread Starter
    Hyperactive Member spoiledkid's Avatar
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    437

    How to change Font ?

    How do you change the font of any object say RadioButton at run time. It always says property Font.Bold is readonly at run time ???

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    object.Font = New Font(object.Font.FontFamily, obhect.Font.Size, FontStyle.Bold)
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3

    Thread Starter
    Hyperactive Member spoiledkid's Avatar
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    437
    Originally posted by Cander
    object.Font = New Font(object.Font.FontFamily, obhect.Font.Size, FontStyle.Bold)
    Yes, Thanks, I had just figured this out. This is weird though, why can't you just change the bold property ? Why do you have to initialize a whole new goddamn font object ?

  4. #4
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Because some fool at Microsoft apprently likes overly verbose programming.



    I guess in some ways it may offer more flexibility though. Dont know how but, possibly in some way.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  5. #5
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    cause the font object is inherited by a lot of different objects.. in the grand scheme of things, it makes it a lot easier for each object that has text displayed on it, inherits from the font object instead of having to have its own font properties

    also just a suggestion... but I ran into the same problem but I hit F1 and got my answer a lot faster than posting on here

    the help in .net is WAY WAY better than the help for VB6

  6. #6

    Thread Starter
    Hyperactive Member spoiledkid's Avatar
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    437
    Originally posted by kleinma
    the help in .net is WAY WAY better than the help for VB6
    Well, actually I happen to think otherwise ...

  7. #7
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    Originally posted by spoiledkid
    Well, actually I happen to think otherwise ...
    then you must not be using it correctly

  8. #8
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    for example if I did

    VB Code:
    1. Dim NewRadio as New RadioButton
    2. Radio.Font

    and I put the cursor on Font in the Radio.Font line of the code and hit F1, I get the help for Control.Font (which is the font object all controls inherit from)

    and you get the help screen including THIS code

    The following is an example of how to adjust the existing font to make it bold:

    MyControl.Font = New Font(MyControl.Font, _
    MyControl.Font.Style Or FontStyle.Bold)

  9. #9
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489
    if this was an easy task, some of us wouldn't have jobs

  10. #10
    Fanatic Member LITHIA's Avatar
    Join Date
    Dec 2002
    Location
    UK, England
    Posts
    575
    Originally posted by kleinma
    for example if I did

    VB Code:
    1. Dim NewRadio as New RadioButton
    2. Radio.Font

    and I put the cursor on Font in the Radio.Font line of the code and hit F1, I get the help for Control.Font (which is the font object all controls inherit from)

    and you get the help screen including THIS code
    *sighs*... wish i had MSDN installed

  11. #11

    Thread Starter
    Hyperactive Member spoiledkid's Avatar
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    437
    Originally posted by kleinma
    for example if I did

    VB Code:
    1. Dim NewRadio as New RadioButton
    2. Radio.Font

    and I put the cursor on Font in the Radio.Font line of the code and hit F1, I get the help for Control.Font (which is the font object all controls inherit from)

    and you get the help screen including THIS code
    you guys never get tired of complaning ...

  12. #12
    New Member
    Join Date
    Jul 2004
    Posts
    9
    Hey Litha,


    Did it ever struck u ... if u know the Thing to search for in MSDN
    may be u can take that phrase and put it in Search

  13. #13
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

  14. #14
    Fanatic Member LITHIA's Avatar
    Join Date
    Dec 2002
    Location
    UK, England
    Posts
    575
    Originally posted by tanmoymoitra
    Hey Litha,


    Did it ever struck u ... if u know the Thing to search for in MSDN
    may be u can take that phrase and put it in Search
    uh sorry?

  15. #15
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Oh yes, nice way to welcome yourself to a forum. Start flamming the folks who have been here awhile!

    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  16. #16
    Fanatic Member LITHIA's Avatar
    Join Date
    Dec 2002
    Location
    UK, England
    Posts
    575
    lol i didn't even realise he was flaming me... i just thought he was talking crap

  17. #17
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    It was rude considering all you said was you wish you had MSDN.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  18. #18
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    Originally posted by spoiledkid
    you guys never get tired of complaning ...
    sorry for trying to help you out [Edited by Moderator].... last time i answer one of your questions
    Last edited by MartinLiss; Jul 29th, 2004 at 10:55 AM.

  19. #19

    Thread Starter
    Hyperactive Member spoiledkid's Avatar
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    437
    Originally posted by kleinma
    sorry for trying to help you out [Edited by Moderator]... last time i answer one of your questions
    You did not try n help out, you started bitchin straightaway. And I know MSDN is there, there must be some reason I posted the question here. I do not find MSDN as helpful as may be you do. And this forum and people are there to help. And this isn't the first time this has happened. People do post questions here (And I am sure you would have done that too at some point of time) that I think could have been found in MSDN. If everybody could go and look in the MSDN and find what they need, JupiterMedia will have to shutdown this site.

    So Who's the [Edited by Moderator] now ?
    Last edited by MartinLiss; Jul 29th, 2004 at 10:56 AM.

  20. #20

  21. #21
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    but dad he started it

  22. #22

    Thread Starter
    Hyperactive Member spoiledkid's Avatar
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    437
    Originally posted by kleinma
    but dad he started it
    unbelievable !!

  23. #23

  24. #24
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    No Hard Feelings


  25. #25
    Fanatic Member LITHIA's Avatar
    Join Date
    Dec 2002
    Location
    UK, England
    Posts
    575
    Originally posted by MartinLiss
    kleinma's post was obviously an attempt to end the argument wth some humor. Can you both now please forget it.
    OMG HOW PRETTY!

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