다음을 통해 공유


Control.IsMnemonic 메서드

지정된 문자가 특정 문자열의 컨트롤에 할당된 니모닉 문자인지 여부를 확인합니다.

네임스페이스: System.Windows.Forms
어셈블리: System.Windows.Forms(system.windows.forms.dll)

구문

‘선언
Public Shared Function IsMnemonic ( _
    charCode As Char, _
    text As String _
) As Boolean
‘사용 방법
Dim charCode As Char
Dim text As String
Dim returnValue As Boolean

returnValue = Control.IsMnemonic(charCode, text)
public static bool IsMnemonic (
    char charCode,
    string text
)
public:
static bool IsMnemonic (
    wchar_t charCode, 
    String^ text
)
public static boolean IsMnemonic (
    char charCode, 
    String text
)
public static function IsMnemonic (
    charCode : char, 
    text : String
) : boolean

매개 변수

  • charCode
    테스트할 문자입니다.
  • text
    검색할 문자열입니다.

반환 값

charCode 문자가 컨트롤에 할당된 니모닉 문자이면 true이고, 그렇지 않으면 false입니다.

설명

니모닉 문자는 String에서 "&"의 첫째 인스턴스 바로 다음에 오는 문자입니다.

예제

다음 코드 예제에서는 ProcessMnemonic 메서드를 재정의하여 사용자 지정 동작을 발생시키는 Button 클래스의 확장에 대해 보여 줍니다. CanSelectIsMnemonic 속성을 사용하는 방법도 보여 줍니다. 이 예제를 실행하려면 동일한 파일의 Form 클래스 뒤에 다음 코드를 붙여넣습니다. 그런 다음 MnemonicButton 유형의 단추를 폼에 추가합니다.

// This button is a simple extension of the button class that overrides
// the ProcessMnemonic method.  If the mnemonic is correctly entered,  
// the message box will appear and the click event will be raised.  
// This method makes sure the control is selectable and the 
// mnemonic is correct before displaying the message box
// and triggering the click event.
public ref class MyMnemonicButton: public Button
{
protected:
   bool ProcessMnemonic( char inputChar )
   {
      if ( CanSelect && IsMnemonic( inputChar, this->Text ) )
      {
         MessageBox::Show( "You've raised the click event "
         "using the mnemonic." );
         this->PerformClick();
         return true;
      }

      return false;
   }

};

.NET Framework 보안

  • UIPermission  상속하는 클래스의 모든 창에서 이 메서드를 호출하는 데 필요한 권한입니다. 연관된 열거형: UIPermissionWindowAllWindows

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

참고 항목

참조

Control 클래스
Control 멤버
System.Windows.Forms 네임스페이스
ProcessMnemonic