Udostępnij za pośrednictwem


How to: Set the Text Displayed by a Windows Forms Control Using the Designer

Windows Forms controls typically display some text that is related to the primary function of the control. For example, a Button control typically displays a caption that indicates what action will be performed when the button is clicked. For all controls, you can set or return the text by using the Text property. You can change the font by using the Font property.

To set the text and font with the designer

  1. In the Properties window, set the Text property of the control to an appropriate string.

    To create an underlined shortcut key, includes an ampersand (&) before the letter that will be the shortcut key.

  2. In the Properties window, click the ellipsis button (VisualStudioEllipsesButton screenshot) next to the Font property.

    In the standard font dialog box, select the font, font style, size, effects (such as strikeout or underline), and script that you want.

See Also

Tasks

How to: Set the Text Displayed by a Windows Forms Control

Other Resources

Using Fonts and Text

Labeling Individual Windows Forms Controls and Providing Shortcuts to Them