Screen 類別

定義

表示單一系統上的顯示裝置或多重顯示裝置。

public ref class Screen
public class Screen
type Screen = class
Public Class Screen
繼承
Screen

範例

下列程式碼範例示範如何使用 類別的各種方法和屬性 Screen 。 此範例會 AllScreens 呼叫 屬性,以擷取連線至系統之所有畫面的陣列。 針對每個傳 Screen 回的 ,此範例會將裝置名稱、界限、類型、工作區和主要畫面新增至 ListBox 。 若要使用範例,請將 和 Button 新增 ListBox 至表單,然後新增 Click 按鈕的事件處理常式。

private:
    void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
    {
        // For each screen, add the screen properties to a list box.
        for each (Screen^ screen in Screen::AllScreens) {
            listBox1->Items->Add( 
                String::Concat("Device Name: ", screen->DeviceName));
            listBox1->Items->Add( 
                String::Concat("Bounds: ", screen->Bounds));
            listBox1->Items->Add( 
                String::Concat("Type: ", screen->GetType()));
            listBox1->Items->Add( 
                String::Concat("Working Area: ", screen->WorkingArea));
            listBox1->Items->Add( 
                String::Concat("Primary Screen: ", screen->Primary));
        }
    }
private void button1_Click(object sender, System.EventArgs e)
{
    // For each screen, add the screen properties to a list box.
    foreach (var screen in System.Windows.Forms.Screen.AllScreens)
    {
        listBox1.Items.Add("Device Name: " + screen.DeviceName);
        listBox1.Items.Add("Bounds: " + 
            screen.Bounds.ToString());
        listBox1.Items.Add("Type: " + 
            screen.GetType().ToString());
        listBox1.Items.Add("Working Area: " + 
            screen.WorkingArea.ToString());
        listBox1.Items.Add("Primary Screen: " + 
            screen.Primary.ToString());
    }
}
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    ' For each screen, add the screen properties to a list box.
    For Each screen In System.Windows.Forms.Screen.AllScreens
        With ListBox1.Items
            .Add("Device Name: " + screen.DeviceName)
            .Add("Bounds: " + screen.Bounds.ToString())
            .Add("Type: " + screen.GetType().ToString())
            .Add("Working Area: " + screen.WorkingArea.ToString())
            .Add("Primary Screen: " + screen.Primary.ToString())
        End With
    Next
End Sub

備註

此物件的建構函式不是公用的,因此您無法明確建立 Screen 物件。 當您呼叫物件的公用方法時,就會建立物件。

屬性

AllScreens

取得系統上所有顯示的陣列。

BitsPerPixel

取得記憶體的位元數 (與資料的單一像素有關)。

Bounds

取得顯示的界限。

DeviceName

取得與顯示關聯的裝置名稱。

Primary

取得值,指出特定的顯示是否為主要裝置。

PrimaryScreen

取得主要的顯示。

WorkingArea

取得顯示的工作區域。 工作區域是指顯示的桌面區域,不包括工具列、停駐視窗和停駐工具列。

方法

Equals(Object)

取得或設定值,指出指定物件是否等於這個 Screen

FromControl(Control)

擷取顯示的 Screen,其包含指定控制項的最大部分。

FromHandle(IntPtr)

擷取顯示的 Screen,其包含由指定控制代碼參考之物件的最大部分。

FromPoint(Point)

擷取包含指定點之顯示的 Screen

FromRectangle(Rectangle)

擷取顯示的 Screen,其包含矩形的最大部分。

GetBounds(Control)

擷取包含指定控制項最大部分的顯示界限。

GetBounds(Point)

擷取包含指定點的顯示界限。

GetBounds(Rectangle)

擷取包含指定矩形最大部分的顯示界限。

GetHashCode()

計算並擷取某個物件的雜湊程式碼。

GetType()

取得目前執行個體的 Type

(繼承來源 Object)
GetWorkingArea(Control)

擷取包含指定控制項最大區域的顯示工作區域。 工作區域是指顯示的桌面區域,不包括工具列、停駐視窗和停駐工具列。

GetWorkingArea(Point)

擷取離指定點最近的工作區域。 工作區域是指顯示的桌面區域,不包括工具列、停駐視窗和停駐工具列。

GetWorkingArea(Rectangle)

擷取包含指定矩形最大部分的顯示工作區域。 工作區域是指顯示的桌面區域,不包括工具列、停駐視窗和停駐工具列。

MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

擷取表示這個物件的字串。

適用於