Control.IsKeyLocked メソッド
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

Dim keyVal As Keys Dim returnValue As Boolean returnValue = Control.IsKeyLocked(keyVal)
戻り値
指定されたキーが有効な場合は true。それ以外の場合は false。



指定されたキー (この場合は CapsLock キー) が有効かどうかを示すメッセージ ボックスを表示するコード例を次に示します。
' To compile and run this sample from the command line, proceed as follows: ' vbc controliskeylocked.vb /r:System.Windows.Forms.dll /r:System.dll ' /r:System.Data.dll /r:System.Drawing.dll Imports System Imports System.Windows.Forms Imports Microsoft.VisualBasic Public Class CapsLockIndicator Public Shared Sub Main() Try ' You can test for the Caps Lock, Num Lock, or Scroll Lock key ' by changing the value of Keys. Control.IsKeyLocked(Keys.CapsLock) MessageBox.Show("The Caps Lock key is ON.") Catch MessageBox.Show("The Caps Lock key is OFF.") End Try End Sub 'Main End Class 'CapsLockIndicator
using System; using System.Windows.Forms; public class CapsLockIndicator { public static void Main() { try { // You can test for the Caps Lock, Num Lock, or Scroll Lock key // by changing the value of Keys. Control.IsKeyLocked(Keys.CapsLock); MessageBox.Show("The Caps Lock key is ON."); } catch { MessageBox.Show("The Caps Lock key is OFF."); } } }
#using <System.dll> #using <System.Drawing.dll> #using <System.Windows.Forms.dll> using namespace System; using namespace System::Windows::Forms; int main() { try { // You can test for the Caps Lock, Num Lock, or Scroll Lock key // by changing the value of Keys. Control::IsKeyLocked( Keys::CapsLock ); MessageBox::Show( "The Caps Lock key is ON." ); } catch ( Exception^ ) { MessageBox::Show( "The Caps Lock key is OFF." ); } }
import System.*; import System.Windows.Forms.*; public class CapsLockIndicator { public static void main(String[] args) { try { // You can test for the Caps Lock, Num Lock, or Scroll Lock key // by changing the value of Keys. Control.IsKeyLocked(Keys.CapsLock); MessageBox.Show("The Caps Lock key is ON."); } catch (System.Exception exp) { MessageBox.Show("The Caps Lock key is OFF."); } } //main } //CapsLockIndicator

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からControl.IsKeyLocked メソッドを検索する場合は、下記のリンクをクリックしてください。

- Control.IsKeyLocked メソッドのページへのリンク