다음을 통해 공유


Screen 클래스

단일 시스템에 있는 하나 이상의 디스플레이 장치를 나타냅니다.

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

구문

‘선언
Public Class Screen
‘사용 방법
Dim instance As Screen
public class Screen
public ref class Screen
public class Screen
public class Screen

설명

이 개체에 대한 생성자는 공용이 아니므로 Screen 개체를 명시적으로 만들 수 없습니다. 이 개체는 해당 공용 메서드를 호출할 때 만들어집니다.

예제

다음 코드 예제에서는 Screen 클래스의 다양한 메서드와 속성을 사용하는 방법을 보여 줍니다. 이 예제에서는 AllScreens 속성을 호출하여 시스템에 연결된 모든 화면의 배열을 검색합니다. 그 다음 반환된 각 Screen에 대해 장치 이름, 범위, 형식, 작업 영역 및 기본 화면을 ListBox에 추가합니다.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnGetScreenInfo.Click

    Dim Index As Integer
    Dim UpperBound As Integer

    ' Gets an array of all the screens connected to the system.

    Dim Screens() As System.Windows.Forms.Screen = _
        System.Windows.Forms.Screen.AllScreens
    UpperBound = Screens.GetUpperBound(0)

    For Index = 0 To UpperBound

        ' For each screen, add the screen properties to a list box.

        ListBox1.Items.Add("Device Name: " + Screens(Index).DeviceName)
        ListBox1.Items.Add("Bounds: " + Screens(Index).Bounds.ToString())
        ListBox1.Items.Add("Type: " + Screens(Index).GetType().ToString())
        ListBox1.Items.Add("Working Area: " + Screens(Index).WorkingArea.ToString())
        ListBox1.Items.Add("Primary Screen: " + Screens(Index).Primary.ToString())

    Next



End Sub
private void button1_Click(object sender, System.EventArgs e)
{
    int index;
    int upperBound; 

    // Gets an array of all the screens connected to the system.

    Screen [] screens = Screen.AllScreens;
    upperBound = screens.GetUpperBound(0);

    for(index = 0; index <= upperBound; index++)
    {

        // For each screen, add the screen properties to a list box.

        listBox1.Items.Add("Device Name: " + screens[index].DeviceName);
        listBox1.Items.Add("Bounds: " + screens[index].Bounds.ToString());
        listBox1.Items.Add("Type: " + screens[index].GetType().ToString());
        listBox1.Items.Add("Working Area: " + screens[index].WorkingArea.ToString());
        listBox1.Items.Add("Primary Screen: " + screens[index].Primary.ToString());

    }

}
private:
   void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
   {
      int index;
      int upperBound;

      // Gets an array of all the screens connected to the system.
      array<Screen^>^screens = Screen::AllScreens;
      upperBound = screens->GetUpperBound( 0 );
      for ( index = 0; index <= upperBound; index++ )
      {
         // For each screen, add the screen properties to a list box.
         listBox1->Items->Add( String::Concat( "Device Name: ", screens[ index ]->DeviceName ) );
         listBox1->Items->Add( String::Concat( "Bounds: ", screens[ index ]->Bounds ) );
         listBox1->Items->Add( String::Concat( "Type: ", screens[ index ]->GetType() ) );
         listBox1->Items->Add( String::Concat( "Working Area: ", screens[ index ]->WorkingArea ) );
         listBox1->Items->Add( String::Concat( "Primary Screen: ", screens[ index ]->Primary ) );
      }
   }
private void button1_Click(Object sender, System.EventArgs e)
{
    int index;
    int upperBound;
    // Gets an array of all the screens connected to the system.
    Screen screens[] = Screen.get_AllScreens();
    upperBound = screens.GetUpperBound(0);

    for (index = 0; index <= upperBound; index++) {
        // For each screen, add the screen properties to a list box.
        listBox1.get_Items().Add("Device Name: " + screens[index].
            get_DeviceName());
        listBox1.get_Items().Add("Bounds: " + screens[index].get_Bounds()
            .ToString());
        listBox1.get_Items().Add("Type: " + screens[index].GetType().
            ToString());
        listBox1.get_Items().Add("Working Area: " + screens[index].
            get_WorkingArea().ToString());
        listBox1.get_Items().Add("Primary Screen: " + 
            ((System.Boolean)screens[index].get_Primary()).ToString());
    }
} //button1_Click

상속 계층 구조

System.Object
  System.Windows.Forms.Screen

스레드로부터의 안전성

이 형식의 모든 public static(Visual Basic의 경우 Shared) 멤버는 스레드로부터 안전합니다. 인터페이스 멤버는 스레드로부터 안전하지 않습니다.

플랫폼

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에서 지원

.NET Compact Framework

2.0, 1.0에서 지원

참고 항목

참조

Screen 멤버
System.Windows.Forms 네임스페이스