다음을 통해 공유


Shape.Enabled 속성

선 또는 셰이프 컨트롤이 사용자 상호 작용에 응답할 수 있는지 여부를 나타내는 값을 가져오거나 설정 합니다.

네임스페이스:  Microsoft.VisualBasic.PowerPacks
어셈블리:  Microsoft.VisualBasic.PowerPacks.Vs(Microsoft.VisualBasic.PowerPacks.Vs.dll)

구문

‘선언
<BrowsableAttribute(True)> _
Public Property Enabled As Boolean
[BrowsableAttribute(true)]
public bool Enabled { get; set; }
[BrowsableAttribute(true)]
public:
property bool Enabled {
    bool get ();
    void set (bool value);
}
[<BrowsableAttribute(true)>]
member Enabled : bool with get, set
function get Enabled () : boolean
function set Enabled (value : boolean)

속성 값

형식: System.Boolean
컨트롤이 사용자 상호 작용에 응답할 수 있으면 true이고, 그렇지 않으면 false입니다.기본값은 true입니다.

설명

로 Enabled 속성을 막을 수 있습니다 선 및 모양 실행된 시간에를 선택 합니다.응용 프로그램의 현재 상태에 적용 되지 않는 컨트롤을 비활성화할 수도 있습니다.예를 들어, 사용자가 button의 비헤이비어를 에뮬레이션 특정 조건이 충족 될 때까지 해당 클릭 하지 못하게 하려면 셰이프를 비활성화할 수 있습니다.

예제

활성화 및 비활성화 하는 방법 다음 예제는 RectangleShape 런타임에 컨트롤입니다.이 코드에서는 있어야는 FormRectangleShape 제어 하는 TextBox 컨트롤에.

Private Sub TextBox1_TextChanged() Handles TextBox1.TextChanged
    ' If the TextBox contains text, enable the RectangleShape.
    If TextBox1.Text <> "" Then
        ' Enable the RectangleShape.
        RectangleShape1.Enabled = True
        ' Change the BorderColor to the default.
        RectangleShape1.BorderColor = 
            Microsoft.VisualBasic.PowerPacks.Shape.DefaultBorderColor
    Else
        ' Disable the RectangleShape control.
        RectangleShape1.Enabled = False
        ' Change the BorderColor to show that the control is disabled
        RectangleShape1.BorderColor = 
            Color.FromKnownColor(KnownColor.InactiveBorder)
    End If
End Sub
private void textBox1_TextChanged(object sender, System.EventArgs e)
{
    // If the TextBox contains text, enable the RectangleShape.
    if (textBox1.Text != "")
    // Enable the RectangleShape.
    {
        rectangleShape1.Enabled = true;
        // Change the BorderColor to the default.
        rectangleShape1.BorderColor = Microsoft.VisualBasic.PowerPacks.Shape.DefaultBorderColor;
    }
    else
    {
        // Disable the RectangleShape control.
        rectangleShape1.Enabled = false;
        // Change the BorderColor to show that the control is disabled
        rectangleShape1.BorderColor = Color.FromKnownColor(KnownColor.InactiveBorder);
    }
}

.NET Framework 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

Shape 클래스

Microsoft.VisualBasic.PowerPacks 네임스페이스

기타 리소스

방법: LineShape 컨트롤로 선 그리기(Visual Studio)

방법: OvalShape 및 RectangleShape 컨트롤을 사용하여 도형 그리기(Visual Studio)

Line 및 Shape 컨트롤 소개(Visual Studio)