共用方式為


Shape.Focused 屬性

取得指出行或圖形控制項目前是否擁有輸入焦點的值。

命名空間:  Microsoft.VisualBasic.PowerPacks
組件:  Microsoft.VisualBasic.PowerPacks.Vs (在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)

語法

'宣告
<BrowsableAttribute(False)> _
Public Overridable ReadOnly Property Focused As Boolean
[BrowsableAttribute(false)]
public virtual bool Focused { get; }
[BrowsableAttribute(false)]
public:
virtual property bool Focused {
    bool get ();
}
[<BrowsableAttribute(false)>]
abstract Focused : bool with get
[<BrowsableAttribute(false)>]
override Focused : bool with get
function get Focused () : boolean

屬性值

類型:Boolean
true如果控制項目前具有輸入的焦點。否則, false。

備註

針對LineShapeOvalShape,和RectangleShape控制項的值Focused屬性等同於ContainsFocus屬性。

若要給予控制輸入的焦點,請使用FocusSelect方法。

範例

下列範例報告是否指定Shape目前具有輸入的焦點。

Public Sub ReportFocus(ByVal shape As Microsoft.VisualBasic.PowerPacks.Shape)
    ' Determine whether the Shape has focus. 
    If shape.ContainsFocus Then
        MsgBox(shape.Name & " has focus.")
    End If 
End Sub
public void ReportFocus(Microsoft.VisualBasic.PowerPacks.Shape shape)
{
    // Determine whether the Shape has focus. 
    if (shape.ContainsFocus)
    {
        MessageBox.Show(shape.Name + " has focus.");
    }
}

.NET Framework 安全性

請參閱

參考

Shape 類別

Microsoft.VisualBasic.PowerPacks 命名空間

其他資源

如何:使用 LineShape 控制項繪製線條 (Visual Studio)

如何:使用 OvalShape 和 RectangleShape 控制項繪製圖案 (Visual Studio)

Line 和 Shape 控制項簡介 (Visual Studio)