CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2002
    Posts
    87

    Changing button text font to bold

    Dear code gurus,

    I am trying to change the font of the button displayed in the dialog to bold and back (depending on certain events in the program). However, when I try something like
    Code:
    MyButton.Font.Bold = true;
    I receive the folloing error:
    "Property or indexer 'System.Drawing.Font.Bold' cannot be assigned to -- it is read only"

    Does anybody know how to do it properly?

    Thank you in advance!!!

  2. #2
    Join Date
    Jan 2002
    Posts
    87

    Re: Changing button text font to bold

    Found the answer myself, all you need to do is the following:

    Code:
    MyButton.Font = new Font(MyButton.Font, FontStyle.Bold);

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

Featured