dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: How to add a letter '&' in a button

  1. #1
    Join Date
    Aug 2003
    Posts
    79

    How to add a letter '&' in a button

    When typing a text like:

    Auto Place & Generate Route

    to a button's caption when creating a button on a dialog template, what you can see is

    Auto Place _ Generate Route

    on the created button.

    Question: how can I have button's visible text containing letter '&' rather than latter '_'?

    Thanks!

    Xiaoming

  2. #2
    Join Date
    May 2005
    Location
    United States
    Posts
    526

    Re: How to add a letter '&' in a button

    Set the button caption to:

    Auto Place && Generate Route

    The double-ampersand indicates that you want the actual character (just one copy of it, not both) to appear.

  3. #3
    Join Date
    Sep 2001
    Location
    Victoria, BC, Canada
    Posts
    363

    Re: How to add a letter '&' in a button

    Insteat of &File use &&File, that would make the button display &File.

  4. #4
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,539

    Re: How to add a letter '&' in a button

    Quote Originally Posted by xzhang84211
    When typing a text like:

    Auto Place & Generate Route

    to a button's caption when creating a button on a dialog template, what you can see is

    Auto Place _ Generate Route

    on the created button.

    Question: how can I have button's visible text containing letter '&' rather than latter '_'?

    Thanks!

    Xiaoming
    This is because if you set only one ambersand then this means to underline the next following char and if you write 'Auto Place & Generate Route' the char after
    the ambersand is the space ( 32 ) and so it underlines and shows an underline space you see ? Take two ambersands then the compiler gets your whishes.


    Jonny Poet
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)