Control.Cursor プロパティとは? わかりやすく解説

Control.Cursor プロパティ

マウス ポインタコントロールの上にあるときに表示されるカーソル取得または設定します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

解説解説

CursorコントロールCursor プロパティ割り当ててマウス ポインタコントロールの上にあるときに表示されるカーソル変更しますアプリケーション上のすべてのコントロールマウス カーソル一時的に変更するには、Cursor.Current プロパティ設定します。この Cursor.Current プロパティは、ComboBoxデータ格納しているとき、ファイル保存しているとき、または読み込んでいるときは通常待機カーソル設定します

Cursor プロパティアンビエント プロパティです。アンビエント プロパティは、コントロール プロパティです。設定しない場合は、親コントロールか取得されます。たとえば、Button は、既定では親の Form と同じ BackColor持ちますアンビエント プロパティ詳細については、AmbientProperties クラスまたは Control クラス概要参照してください

継承時の注意 派生クラスCursor プロパティオーバーライドする場合は、基本クラスCursor プロパティ使用して基本実装拡張します。それ以外場合は、すべての実装提供する必要がありますCursor プロパティget メソッドset メソッド両方オーバーライドする必要はありません。必要に応じて 1 つだけオーバーライドできます

使用例使用例

ユーザー使用可能な論理ドライブComboBox格納するコード例次に示しますまた、この例では、マウス ポインタがドロップダウン ボタン上にあるときに Cursors.Hand カーソル表示されるように、コンボ ボックスCursor プロパティ設定してます。このコードでは、ComboBox を持つ Form存在している必要があります

Private Sub Form1_Load(sender As
 Object, _
  e As EventArgs) Handles MyBase.Load
   ' Display the hand cursor when the mouse pointer
   ' is over the combo box drop-down button. 
   comboBox1.Cursor = Cursors.Hand
   
   ' Fill the combo box with all the logical 
   ' drives available to the user. 
   Try
      Dim logicalDrive As String
      For Each logicalDrive In
  Environment.GetLogicalDrives()
         comboBox1.Items.Add(logicalDrive)
      Next logicalDrive
   Catch ex As Exception
      MessageBox.Show(ex.Message)
   End Try
End Sub
private void Form1_Load(object sender, EventArgs
 e)
{
   // Display the hand cursor when the mouse pointer
   // is over the combo box drop-down button. 
   comboBox1.Cursor = Cursors.Hand;

   // Fill the combo box with all the logical 
   // drives available to the user.
   try
   {
      foreach(string logicalDrive in
 Environment.GetLogicalDrives() )
      {
         comboBox1.Items.Add(logicalDrive);
      }
   }
   catch(Exception ex)
   {
      MessageBox.Show(ex.Message);
   }
}
private:
   void Form1_Load( Object^ /*sender*/, EventArgs^ /*e*/ )
   {
      // Display the hand cursor when the mouse pointer
      // is over the combo box drop-down button.
      comboBox1->Cursor = Cursors::Hand;
      
      // Fill the combo box with all the logical
      // drives available to the user.
      try
      {
         IEnumerator^ myEnum = Environment::GetLogicalDrives()->GetEnumerator();
         while ( myEnum->MoveNext() )
         {
            String^ logicalDrive = safe_cast<String^>(myEnum->Current);
            comboBox1->Items->Add( logicalDrive );
         }
      }
      catch ( Exception^ ex ) 
      {
         MessageBox::Show( ex->Message );
      }
   }
private void Form1_Load(Object sender, EventArgs
 e)
{
    // Display the hand cursor when the mouse pointer
    // is over the combo box drop-down button. 
    comboBox1.set_Cursor(Cursors.get_Hand());
    // Fill the combo box with all the logical 
    // drives available to the user.
    try {
        for (int iCtr = 0; iCtr < Environment.GetLogicalDrives().
            get_Length(); iCtr++) {
            String logicalDrive = Environment.GetLogicalDrives()[iCtr];
            comboBox1.get_Items().Add(logicalDrive);
        }
    }
    catch (System.Exception ex) {
        MessageBox.Show(ex.get_Message());
    }
} //Form1_Load
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からControl.Cursor プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からControl.Cursor プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からControl.Cursor プロパティ を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「Control.Cursor プロパティ」の関連用語

Control.Cursor プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Control.Cursor プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS