Skip to content

Latest commit

 

History

History
134 lines (100 loc) · 5.78 KB

nf-gdiplusstringformat-stringformat-sethotkeyprefix.md

File metadata and controls

134 lines (100 loc) · 5.78 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist req.product ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:gdiplusstringformat.StringFormat.SetHotkeyPrefix
StringFormat::SetHotkeyPrefix (gdiplusstringformat.h)
The StringFormat::SetHotkeyPrefix method sets the type of processing that is performed on a string when the hot key prefix, an ampersand (&), is encountered.
SetHotkeyPrefix
SetHotkeyPrefix method [GDI+]
SetHotkeyPrefix method [GDI+]
StringFormat class
StringFormat class [GDI+]
SetHotkeyPrefix method
StringFormat.SetHotkeyPrefix
StringFormat::SetHotkeyPrefix
_gdiplus_CLASS_StringFormat_SetHotkeyPrefix_hotkeyPrefix_
gdiplus._gdiplus_CLASS_StringFormat_SetHotkeyPrefix_hotkeyPrefix_
gdiplus\_gdiplus_CLASS_StringFormat_SetHotkeyPrefix_hotkeyPrefix_.htm
gdiplus
VS|gdicpp|~\gdiplus\gdiplusreference\classes\stringformatclass\stringformatmethods\sethotkeyprefix.htm
12/05/2018
SetHotkeyPrefix, SetHotkeyPrefix method [GDI+], SetHotkeyPrefix method [GDI+],StringFormat class, StringFormat class [GDI+],SetHotkeyPrefix method, StringFormat.SetHotkeyPrefix, StringFormat::SetHotkeyPrefix, _gdiplus_CLASS_StringFormat_SetHotkeyPrefix_hotkeyPrefix_, gdiplus._gdiplus_CLASS_StringFormat_SetHotkeyPrefix_hotkeyPrefix_
gdiplusstringformat.h
Gdiplus.h
Windows
Windows XP, Windows 2000 Professional [desktop apps only]
Windows 2000 Server [desktop apps only]
Gdiplus.lib
Gdiplus.dll
Windows
GDI+ 1.0
19H1
StringFormat::SetHotkeyPrefix
gdiplusstringformat/StringFormat::SetHotkeyPrefix
c++
APIRef
kbSyntax
COM
Gdiplus.dll
StringFormat.SetHotkeyPrefix

StringFormat::SetHotkeyPrefix

-description

The StringFormat::SetHotkeyPrefix method sets the type of processing that is performed on a string when the hot key prefix, an ampersand (&), is encountered. The ampersand is called the hot key prefix and can be used to designate certain keys as hot keys.

-parameters

-param hotkeyPrefix [in]

Type: HotkeyPrefix

Element of the HotkeyPrefix enumeration that specifies how to process the hot key prefix.

-returns

Type: Status

If the method succeeds, it returns Ok, which is an element of the Status enumeration.

If the method fails, it returns one of the other elements of the Status enumeration.

-remarks

Hot keys, also called access keys, are keys that are programmed to provide an end user with keyboard shortcuts to functionality and are activated by pressing the ALT key. The keys are application dependent and are identified by an underscored letter, typically in a menu name or menu item; for example, when you press ALT, the letter F of the File menu is underscored. The F key is a shortcut to display the File menu.

A client programmer designates a hot key in an application by using the hot key prefix, an ampersand (&), in a string that typically is displayed as the name of a menu or an item in a menu and by using the StringFormat::SetHotkeyPrefix method to set the appropriate type of processing. When a character in a string is preceded with an ampersand, the key that corresponds to the character becomes a hot key during the processing that occurs when the string is drawn on the display device. The ampersand is called a hot key prefix because it precedes the character to be activated. If HotkeyPrefixNone is passed to StringFormat::SetHotkeyPrefix, no processing of the hot key prefix occurs.

Note  The term hot key is used synonymously here with the term access key. The term hot key may have a different meaning in other Windows APIs.
 

Examples

The following example creates a StringFormat object and sets the type of hot key prefix processing to be performed on the string. The code then uses the StringFormat object to draw a string that contains the hot key prefix character. The code also draws the string's layout rectangle.

VOID Example_SetHotkeyPrefix(HDC hdc)
{
   Graphics graphics(hdc);

   SolidBrush  solidBrush(Color(255, 255, 0, 0)); 
   FontFamily  fontFamily(L"Times New Roman");
   Font        font(&fontFamily, 24, FontStyleRegular, UnitPixel);
   
   StringFormat stringFormat;
   stringFormat.SetHotkeyPrefix(HotkeyPrefixShow);

   graphics.DrawString(
      L"This &text has some &underlined characters.", 
      43,  // string length
      &font, 
      RectF(30, 30, 160, 200), 
      &stringFormat, 
      &solidBrush);

   // Draw the rectangle that encloses the text.
   Pen pen(Color(255, 255, 0, 0));
   graphics.DrawRectangle(&pen, 30, 30, 160, 200);
}

-see-also

HotkeyPrefix

StringFormat

StringFormat::GetHotkeyPrefix