Control.Cursor プロパティ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

マウス ポインタがコントロールの上にあるときに表示されるカーソルを表す Cursor。

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


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.Cursor プロパティを検索する場合は、下記のリンクをクリックしてください。

- Control.Cursor プロパティのページへのリンク