Glyph.GetHitTest メソッドとは? わかりやすく解説

Glyph.GetHitTest メソッド

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

ヒット テストロジック提供します

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

Public MustOverride Function
 GetHitTest ( _
    p As Point _
) As Cursor
public abstract Cursor GetHitTest (
    Point p
)
public:
virtual Cursor^ GetHitTest (
    Point p
) abstract
public abstract Cursor GetHitTest (
    Point p
)

パラメータ

p

ヒット テストを行うポイント

戻り値
Glyphp関連付けられている場合Cursorそれ以外場合null 参照 (Visual Basic では Nothing)。

解説解説

GetHitTest メソッドは、ヒット テスト ロジック提供するための Glyph実装された abstract メソッドです。任意のポイント指定したときに、Glyph がその位置置かれるように設定されている場合は、有効な Cursor返す必要がありますそれ以外場合null 参照 (Visual Basic では Nothing) が返され、BehaviorService はその位置無視します。

使用例使用例

GetHitTestオーバーライドしてポイントがこのグリフ内にあるかどうか調べ方法次の例に示します。このコード例は、BehaviorService クラストピック取り上げているコード例一部分です。

Public Overrides Function
 GetHitTest(ByVal p As Point) As
 Cursor
    ' GetHitTest is called to see if the point is
    ' within this glyph.  This gives us a chance to decide
    ' what cursor to show.  Returning null from here means
    ' the mouse pointer is not currently inside of the glyph.
    ' Returning a valid cursor here indicates the pointer is
    ' inside the glyph,and also enables our Behavior property
    ' as the active behavior.
    If Bounds.Contains(p) Then
        Return Cursors.Hand
    End If

    Return Nothing

End Function
public override Cursor GetHitTest(Point p)
{
    // GetHitTest is called to see if the point is
    // within this glyph.  This gives us a chance to decide
    // what cursor to show.  Returning null from here means
    // the mouse pointer is not currently inside of the glyph.
    // Returning a valid cursor here indicates the pointer is
    // inside the glyph, and also enables our Behavior property
    // as the active behavior.
    if (Bounds.Contains(p))
    {
        return Cursors.Hand;
    }

    return null;
}
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


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

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

辞書ショートカット

すべての辞書の索引

Glyph.GetHitTest メソッドのお隣キーワード
検索ランキング

   

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



Glyph.GetHitTest メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS