⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 class.txt

📁 NET Framework 类库,用于C井开发的文档.
💻 TXT
📖 第 1 页 / 共 2 页
字号:
.NET Framework 类库   



-----------------------------------------------------------------------------------
Control.IsInputKey 方法
确定指定的键是常规输入键还是需要预处理的特殊键。

[Visual Basic]
Protected Overridable Function IsInputKey( _
   ByVal keyData As Keys _
) As Boolean
[C#]
protected virtual bool IsInputKey(
   Keys keyData
);
[C++]
protected: virtual bool IsInputKey(
   Keys keyData
);
[JScript]
protected function IsInputKey(
   keyData : Keys
) : Boolean;
参数
keyData 
Keys 值之一。 
返回值
如果指定的键是常规输入键,则为 true;否则为 false。

备注
在窗口消息预处理过程中调用 IsInputChar 方法,可确定指定的键是应直接发送到该控件的常规输入键,还是应经预处理的特殊键(如 PAGE UP、PAGE DOWN、ENTER、ESC、TAB 或箭头键)。在后一种情形中,仅当预处理阶段不使用该键时才将它发送到控件。

要求
平台: Windows 98, Windows NT 4.0, Windows ME, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 系列

.NET Framework 安全性:  

UIPermission,它允许继承类的所有窗口调用此方法。关联的枚举:UIPermissionWindow.AllWindows 

-----------------------------------------------------------------------------------
.NET Framework 类库   

Control.IsInputChar 方法
确定一个字符是否是控件可识别的输入字符。

[Visual Basic]
Protected Overridable Function IsInputChar( _
   ByVal charCode As Char _
) As Boolean
[C#]
protected virtual bool IsInputChar(
   char charCode
);
[C++]
protected: virtual bool IsInputChar(
   __wchar_t charCode
);
[JScript]
protected function IsInputChar(
   charCode : Char
) : Boolean;
参数
charCode 
要测试的字符。 
返回值
如果字符应直接发送到控件且不必经过预处理,则为 true;否则为 false。

备注
此方法在窗口消息预处理过程中调用,以确定给定输入字符是应经过预处理还是直接发送到控件。如果 IsInputChar 方法返回 true,则将指定字符直接发送到控件。但是,如果方法返回 false,则要预处理字符,且仅当预处理阶段不使用时,才能发送到控件。字符的预处理包括检查字符是否是另一个控件的助记键。

要求
平台: Windows 98, Windows NT 4.0, Windows ME, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 系列

.NET Framework 安全性:  

UIPermission,它允许继承类的所有窗口调用此方法。关联的枚举:UIPermissionWindow.AllWindows 

---------------------------------------------------------------------------------------------------------
.NET Framework 类库   

Control.IsMnemonic 方法
搜索指定的字符串,以确定指定字符是否是分配给此控件的助记键字符。

[Visual Basic]
Public Shared Function IsMnemonic( _
   ByVal charCode As Char, _
   ByVal text As String _
) As Boolean
[C#]
public static bool IsMnemonic(
   char charCode,
   string text
);
[C++]
public: static bool IsMnemonic(
   __wchar_t charCode,
   String* text
);
[JScript]
public static function IsMnemonic(
   charCode : Char,
   text : String
) : Boolean;
参数
charCode 
要测试的字符。 
text 
要搜索的字符串。 
返回值
如果 charCode 字符是分配给控件的助记键字符,则为 true;否则为 false。

备注
助记键字符是紧随在 String 中第一个“&”实例后面的字符。

示例
[Visual Basic, C#] 以下代码示例阐释了该按钮类的一个扩展,该扩展重写 ProcessMnemonic 方法以显示自定义行为。该示例还阐释了如何使用 CanSelect 和 IsMnemonic 属性。要运行该示例,请将以下代码粘贴到同一文件中的窗体类后面。将一个 MnemonicButton 类型的按钮添加到窗体中。

[Visual Basic] 
' 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.  
Public Class MyMnemonicButton
    Inherits Button

    ' This method makes sure the control is selectable and the 
    ' mneumonic is correct before displaying the message box
    ' and triggering the click event.
    Protected Overrides Function ProcessMnemonic( _
        ByVal inputChar As Char) As Boolean

        If (CanSelect And IsMnemonic(inputChar, Me.Text)) Then
            MessageBox.Show("You've raised the click event " _
                & "using the mnemonic.")
            Me.PerformClick()
            Return True
        End If
        Return False
    End Function

End Class

[C#] 
// 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.  
public class MyMnemonicButton:
    Button

    // This method makes sure the control is selectable and the 
    // mneumonic is correct before displaying the message box
    // and triggering the click event.
{
    protected override 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;
    }

}

[C++, JScript] 没有可用于 C++ 或 JScript 的示例。若要查看 Visual Basic 或 C# 示例,请单击页左上角的“语言筛选器”按钮 。

要求
平台: Windows 98, Windows NT 4.0, Windows ME, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 系列

.NET Framework 安全性:  

UIPermission,它允许继承类的所有窗口调用此方法。关联的枚举:UIPermissionWindow.AllWindows 
--------------------------------------------------------------------------------------------------
.NET Framework 类库   

Control.Hide 方法
对用户隐藏控件。

[Visual Basic]
Public Sub Hide()
[C#]
public void Hide();
[C++]
public: void Hide();
[JScript]
public function Hide();
备注
隐藏控件等效于将 Visible 属性设置为 false。调用 Hide 方法之后,Visible 属性返回 false 值,直到调用 Show 方法。

示例
[Visual Basic, C#, C++] 下面的示例在单击某按钮的同时按 CTRL 时隐藏该按钮。该示例假定在 Form 上有一个名为 button1 的 Button。

[Visual Basic] 
Private Sub button1_Click(sender As Object, _
  e As EventArgs) Handles button1.Click
   ' If the CTRL key is pressed when the 
   ' control is clicked, hide the control. 
   If Control.ModifierKeys = Keys.Control Then
      CType(sender, Control).Hide()
   End If
End Sub

[C#] 
private void button1_Click(object sender, System.EventArgs e)
{
   /* If the CTRL key is pressed when the 
      * control is clicked, hide the control. */
   if(Control.ModifierKeys == Keys.Control)
   {
      ((Control)sender).Hide();
   }
}

[C++] 
private:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -