다음을 통해 공유


SystemInformation.BootMode 속성

시스템 시작에 사용된 부팅 모드를 나타내는 BootMode 값을 가져옵니다.

네임스페이스: System.Windows.Forms
어셈블리: System.Windows.Forms(system.windows.forms.dll)

구문

‘선언
Public Shared ReadOnly Property BootMode As BootMode
‘사용 방법
Dim value As BootMode

value = SystemInformation.BootMode
public static BootMode BootMode { get; }
public:
static property BootMode BootMode {
    BootMode get ();
}
/** @property */
public static BootMode get_BootMode ()
public static function get BootMode () : BootMode

속성 값

시스템 시작에 사용된 부팅 모드를 나타내는 BootMode 값 중 하나입니다.

설명

BootMode 속성은 운영 체제가 표준 모드에서 부팅되었는지 안전 모드에서 부팅되었는지를 나타냅니다.

예제

다음 코드 예제에서는 SystemInformation 클래스의 모든 속성을 ListBox에 나열하고 목록의 항목이 선택되면 TextBox의 현재 속성 값을 표시합니다.

Imports Microsoft.VisualBasic
Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Drawing
Imports System.Reflection
Imports System.Windows.Forms

Public Class SystemInfoBrowserForm
    Inherits System.Windows.Forms.Form
    
    Private listBox1 As System.Windows.Forms.ListBox
    Private textBox1 As System.Windows.Forms.TextBox  
    
    Public Sub New()
        Me.SuspendLayout()
        InitForm()
        
        ' Add each property of the SystemInformation class to the list box.
        Dim t As Type = GetType(System.Windows.Forms.SystemInformation)
        Dim pi As PropertyInfo() = t.GetProperties()
        Dim i As Integer
        For i = 0 To pi.Length - 1
            listBox1.Items.Add(pi(i).Name)
        Next i
        textBox1.Text = "The SystemInformation class has " + pi.Length.ToString() + " properties." + ControlChars.CrLf
        
        ' Configure the list item selected handler for the list box to invoke a 
        ' method that displays the value of each property.
        AddHandler listBox1.SelectedIndexChanged, AddressOf listBox1_SelectedIndexChanged
        
        Me.ResumeLayout(False)
    End Sub    
    
    Private Sub listBox1_SelectedIndexChanged(sender As Object, e As EventArgs)
        ' Return if no list item is selected.
        If listBox1.SelectedIndex = - 1 Then
            Return
        End If         
        ' Get the property name from the list item.
        Dim propname As String = listBox1.Text
        
        If propname = "PowerStatus" Then
            ' Cycle and display the values of each property of the PowerStatus property.
            textBox1.Text += ControlChars.CrLf + "The value of the PowerStatus property is:"
            Dim t As Type = GetType(System.Windows.Forms.PowerStatus)
            Dim pi As PropertyInfo() = t.GetProperties()
            Dim i As Integer
            For i = 0 To pi.Length - 1
                Dim propval As Object = pi(i).GetValue(SystemInformation.PowerStatus, Nothing)
                textBox1.Text += ControlChars.CrLf + "    PowerStatus." + pi(i).Name + " is: " + propval.ToString()
            Next i
        Else
            ' Display the value of the selected property of the SystemInformation type.
            Dim t As Type = GetType(System.Windows.Forms.SystemInformation)
            Dim pi As PropertyInfo() = t.GetProperties()
            Dim prop As PropertyInfo = Nothing
            Dim i As Integer
            For i = 0 To pi.Length - 1
                If pi(i).Name = propname Then
                    prop = pi(i)
                    Exit For
                End If
            Next i
            Dim propval As Object = prop.GetValue(Nothing, Nothing)
            textBox1.Text += ControlChars.CrLf + "The value of the " + propname + " property is: " + propval.ToString()
        End If
    End Sub    
    
    Private Sub InitForm()
        ' Initialize the form settings
        Me.listBox1 = New System.Windows.Forms.ListBox()
        Me.textBox1 = New System.Windows.Forms.TextBox()
        Me.listBox1.Anchor = CType(System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left Or System.Windows.Forms.AnchorStyles.Right, System.Windows.Forms.AnchorStyles)
        Me.listBox1.Location = New System.Drawing.Point(8, 16)
        Me.listBox1.Size = New System.Drawing.Size(172, 496)
        Me.listBox1.TabIndex = 0
        Me.textBox1.Anchor = CType(System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right, System.Windows.Forms.AnchorStyles)
        Me.textBox1.Location = New System.Drawing.Point(188, 16)
        Me.textBox1.Multiline = True
        Me.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
        Me.textBox1.Size = New System.Drawing.Size(420, 496)
        Me.textBox1.TabIndex = 1
        Me.ClientSize = New System.Drawing.Size(616, 525)
        Me.Controls.Add(Me.textBox1)
        Me.Controls.Add(Me.listBox1)
        Me.Text = "Select a SystemInformation property to get the value of"
    End Sub
        
    <STAThread()>  _
    Shared Sub Main()
        Application.Run(New SystemInfoBrowserForm())
    End Sub

End Class
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Reflection;
using System.Windows.Forms;

namespace SystemInfoBrowser
{
    public class SystemInfoBrowserForm : System.Windows.Forms.Form
    {
        private System.Windows.Forms.ListBox listBox1;
        private System.Windows.Forms.TextBox textBox1;        
        
        public SystemInfoBrowserForm()
        {
            this.SuspendLayout();
            InitForm();
            
            // Add each property of the SystemInformation class to the list box.
            Type t = typeof(System.Windows.Forms.SystemInformation);            
            PropertyInfo[] pi = t.GetProperties();            
            for( int i=0; i<pi.Length; i++ )
                listBox1.Items.Add( pi[i].Name );            
            textBox1.Text = "The SystemInformation class has "+pi.Length.ToString()+" properties.\r\n";

            // Configure the list item selected handler for the list box to invoke a 
            // method that displays the value of each property.
            listBox1.SelectedIndexChanged += new EventHandler(listBox1_SelectedIndexChanged);
            this.ResumeLayout(false);
        }
        
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            // Return if no list item is selected.
            if( listBox1.SelectedIndex == -1 ) return;
            // Get the property name from the list item.
            string propname = listBox1.Text;
            
            if( propname == "PowerStatus" )
            {
                // Cycle and display the values of each property of the PowerStatus property.
                textBox1.Text += "\r\nThe value of the PowerStatus property is:";                                
                Type t = typeof(System.Windows.Forms.PowerStatus);
                PropertyInfo[] pi = t.GetProperties();            
                for( int i=0; i<pi.Length; i++ )
                {
                    object propval = pi[i].GetValue(SystemInformation.PowerStatus, null);            
                    textBox1.Text += "\r\n    PowerStatus."+pi[i].Name+" is: "+propval.ToString();
                }
            }
            else
            {
                // Display the value of the selected property of the SystemInformation type.
                Type t = typeof(System.Windows.Forms.SystemInformation);
                PropertyInfo[] pi = t.GetProperties();            
                PropertyInfo prop = null;
                for( int i=0; i<pi.Length; i++ )
                    if( pi[i].Name == propname )
                    {
                        prop = pi[i];
                        break;           
                    }
                object propval = prop.GetValue(null, null);            
                textBox1.Text += "\r\nThe value of the "+propname+" property is: "+propval.ToString();
            }
        }

        private void InitForm()
        {
            // Initialize the form settings
            this.listBox1 = new System.Windows.Forms.ListBox();
            this.textBox1 = new System.Windows.Forms.TextBox();            
            this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
                | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right)));
            this.listBox1.Location = new System.Drawing.Point(8, 16);
            this.listBox1.Size = new System.Drawing.Size(172, 496);
            this.listBox1.TabIndex = 0;            
            this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
                | System.Windows.Forms.AnchorStyles.Right)));
            this.textBox1.Location = new System.Drawing.Point(188, 16);
            this.textBox1.Multiline = true;
            this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;           
            this.textBox1.Size = new System.Drawing.Size(420, 496);
            this.textBox1.TabIndex = 1;            
            this.ClientSize = new System.Drawing.Size(616, 525);            
            this.Controls.Add(this.textBox1);
            this.Controls.Add(this.listBox1);            
            this.Text = "Select a SystemInformation property to get the value of";                   
        }

        [STAThread]
        static void Main() 
        {
            Application.Run(new SystemInfoBrowserForm());
        }
    }
}
#using <System.Windows.Forms.dll>
#using <System.Drawing.dll>
#using <System.dll>

using namespace System;
using namespace System::Collections;
using namespace System::ComponentModel;
using namespace System::Drawing;
using namespace System::Reflection;
using namespace System::Windows::Forms;
public ref class SystemInfoBrowserForm: public System::Windows::Forms::Form
{
private:
   System::Windows::Forms::ListBox^ listBox1;
   System::Windows::Forms::TextBox^ textBox1;

public:
   SystemInfoBrowserForm()
   {
      this->SuspendLayout();
      InitForm();
      
      // Add each property of the SystemInformation class to the list box.
      Type^ t = System::Windows::Forms::SystemInformation::typeid;
      array<PropertyInfo^>^pi = t->GetProperties();
      for ( int i = 0; i < pi->Length; i++ )
         listBox1->Items->Add( pi[ i ]->Name );
      textBox1->Text = String::Format( "The SystemInformation class has {0} properties.\r\n", pi->Length );
      
      // Configure the list item selected handler for the list box to invoke a 
      // method that displays the value of each property.
      listBox1->SelectedIndexChanged += gcnew EventHandler( this, &SystemInfoBrowserForm::listBox1_SelectedIndexChanged );
      this->ResumeLayout( false );
   }


private:
   void listBox1_SelectedIndexChanged( Object^ /*sender*/, EventArgs^ /*e*/ )
   {
      
      // Return if no list item is selected.
      if ( listBox1->SelectedIndex == -1 )
            return;

      
      // Get the property name from the list item.
      String^ propname = listBox1->Text;
      if ( propname->Equals( "PowerStatus" ) )
      {
         
         // Cycle and display the values of each property of the PowerStatus property.
         textBox1->Text = String::Concat( textBox1->Text, "\r\nThe value of the PowerStatus property is:" );
         Type^ t = System::Windows::Forms::PowerStatus::typeid;
         array<PropertyInfo^>^pi = t->GetProperties();
         for ( int i = 0; i < pi->Length; i++ )
         {
            Object^ propval = pi[ i ]->GetValue( SystemInformation::PowerStatus, nullptr );
            textBox1->Text = String::Format( "{0}\r\n    PowerStatus.{1} is: {2}", textBox1->Text, pi[ i ]->Name, propval );

         }
      }
      else
      {
         
         // Display the value of the selected property of the SystemInformation type.
         Type^ t = System::Windows::Forms::SystemInformation::typeid;
         array<PropertyInfo^>^pi = t->GetProperties();
         PropertyInfo^ prop = nullptr;
         for ( int i = 0; i < pi->Length; i++ )
            if ( pi[ i ]->Name == propname )
            {
               prop = pi[ i ];
               break;
            }
         Object^ propval = prop->GetValue( nullptr, nullptr );
         textBox1->Text = String::Format( "{0}\r\nThe value of the {1} property is: {2}", textBox1->Text, propname, propval );
      }
   }

   void InitForm()
   {
      
      // Initialize the form settings
      this->listBox1 = gcnew System::Windows::Forms::ListBox;
      this->textBox1 = gcnew System::Windows::Forms::TextBox;
      this->listBox1->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right);
      this->listBox1->Location = System::Drawing::Point( 8, 16 );
      this->listBox1->Size = System::Drawing::Size( 172, 496 );
      this->listBox1->TabIndex = 0;
      this->textBox1->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Right);
      this->textBox1->Location = System::Drawing::Point( 188, 16 );
      this->textBox1->Multiline = true;
      this->textBox1->ScrollBars = System::Windows::Forms::ScrollBars::Vertical;
      this->textBox1->Size = System::Drawing::Size( 420, 496 );
      this->textBox1->TabIndex = 1;
      this->ClientSize = System::Drawing::Size( 616, 525 );
      this->Controls->Add( this->textBox1 );
      this->Controls->Add( this->listBox1 );
      this->Text = "Select a SystemInformation property to get the value of";
   }

};


[STAThread]
int main()
{
   Application::Run( gcnew SystemInfoBrowserForm );
}
package SystemInfoBrowser;

import System.*;
import System.Collections.*;
import System.ComponentModel.*;
import System.Drawing.*;
import System.Reflection.*;
import System.Windows.Forms.*;

public class SystemInfoBrowserForm extends System.Windows.Forms.Form
{
    private System.Windows.Forms.ListBox listBox1;
    private System.Windows.Forms.TextBox textBox1;

    public SystemInfoBrowserForm()
    {
        this.SuspendLayout();
        InitForm();
        // Add each property of the SystemInformation class to the list box.
        Type t = System.Windows.Forms.SystemInformation.class.ToType();
        PropertyInfo pi[] = t.GetProperties();
        for (int i = 0; i < pi.length; i++) {
            listBox1.get_Items().Add(pi[i].get_Name());
        }
        textBox1.set_Text("The SystemInformation class has "
            + ((Int32)pi.length).ToString() + " properties.\r\n");
        // Configure the list item selected handler for the list box to invoke
        // a method that displays the value of each property.
        listBox1.add_SelectedIndexChanged(
            new EventHandler(listBox1_SelectedIndexChanged));
        this.ResumeLayout(false);
    } //SystemInfoBrowserForm

    private void listBox1_SelectedIndexChanged(Object sender, EventArgs e)
    {
        // Return if no list item is selected.
        if (listBox1.get_SelectedIndex() == -1) {
            return;
        }
        // Get the property name from the list item.
        String propname = listBox1.get_Text();

        if (propname.Equals("PowerStatus")) {
            // Cycle and display the values of each property of the
            // PowerStatus property.
            textBox1.set_Text(textBox1.get_Text()
                + "\r\nThe value of the PowerStatus property is:");
            Type t = System.Windows.Forms.PowerStatus.class.ToType();
            PropertyInfo pi[] = t.GetProperties();
            for (int i = 0; i < pi.length; i++) {
                Object propval = pi[i].GetValue(
                    SystemInformation.get_PowerStatus(), null);
                textBox1.set_Text(textBox1.get_Text()
                    + "\r\n    PowerStatus." + pi[i].get_Name()
                    + " is: " + propval.ToString());
            }
        }
        else {
            // Display the value of the selected property of the
            // SystemInformation type.
            Type t = System.Windows.Forms.SystemInformation.class.ToType();
            PropertyInfo pi[] = t.GetProperties();
            PropertyInfo prop = null;
            for (int i = 0; i < pi.length; i++) {
                if (pi[i].get_Name().Equals(propname)) {
                    prop = pi[i];
                    break;
                }
            }
            Object propval = prop.GetValue(null, null);
            textBox1.set_Text(textBox1.get_Text() + "\r\nThe value of the "
                + propname + " property is: " + propval.ToString());
        }
    } //listBox1_SelectedIndexChanged

    private void InitForm()
    {
        // Initialize the form settings
        this.listBox1 = new System.Windows.Forms.ListBox();
        this.textBox1 = new System.Windows.Forms.TextBox();
        this.listBox1.set_Anchor((System.Windows.Forms.AnchorStyles)
            (System.Windows.Forms.AnchorStyles.Top
            | System.Windows.Forms.AnchorStyles.Bottom
            | System.Windows.Forms.AnchorStyles.Left
            | System.Windows.Forms.AnchorStyles.Right));
        this.listBox1.set_Location(new System.Drawing.Point(8, 16));
        this.listBox1.set_Size(new System.Drawing.Size(172, 496));
        this.listBox1.set_TabIndex(0);
        this.textBox1.set_Anchor((System.Windows.Forms.AnchorStyles)
            (System.Windows.Forms.AnchorStyles.Top
            | System.Windows.Forms.AnchorStyles.Bottom
            | System.Windows.Forms.AnchorStyles.Right));
        this.textBox1.set_Location(new System.Drawing.Point(188, 16));
        this.textBox1.set_Multiline(true);
        this.textBox1.set_ScrollBars(System.Windows.Forms.ScrollBars.Vertical);
        this.textBox1.set_Size(new System.Drawing.Size(420, 496));
        this.textBox1.set_TabIndex(1);
        this.set_ClientSize(new System.Drawing.Size(616, 525));
        this.get_Controls().Add(this.textBox1);
        this.get_Controls().Add(this.listBox1);
        this.set_Text("Select a SystemInformation property to get the value of");
    } //InitForm

    /** @attribute STAThread()
     */
    public static void main(String[] args)
    {
        Application.Run(new SystemInfoBrowserForm());
    } //main
} //SystemInfoBrowserForm

.NET Framework 보안

플랫폼

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에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

참고 항목

참조

SystemInformation 클래스
SystemInformation 멤버
System.Windows.Forms 네임스페이스
BootMode 열거형