構文
解説
使用例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
継承階層
スレッド セーフ
プラットフォーム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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
参照
パブリック プロパティ| 名前 | 説明 | |
|---|---|---|
| WorkingArea | ディスプレイの作業領域を取得します。作業領域とは、ディスプレイのデスクトップ領域からタスクバー、ドッキングされたウィンドウ、およびドッキングされたツール バーを除いた部分です。 |
参照
パブリック メソッド| 名前 | 説明 | |
|---|---|---|
| Equals | オーバーロードされます。 オーバーライドされます。 |
| FromControl | 指定したコントロールの最大部分を保持するディスプレイを表す Screen を取得します。 |
| FromHandle | 指定したハンドルによって参照されているオブジェクトの最大領域を保持するディスプレイを表す Screen を取得します。 |
| FromPoint | 指定したポイントを保持するディスプレイを表す Screen を取得します。 |
| FromRectangle | 四角形の最大部分を保持するディスプレイの Screen を取得します。 |
| GetBounds | オーバーロードされます。 ディスプレイの範囲を取得します。 |
| GetHashCode | オーバーライドされます。 オブジェクトのハッシュ コードを計算して取得します。 |
| GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
| GetWorkingArea | オーバーロードされます。 ディスプレイの作業領域を取得します。 |
| ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
| ToString | オーバーライドされます。 このオブジェクトを表す文字列を取得します。 |
プロテクト メソッド| 名前 | 説明 | |
|---|---|---|
| Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
| MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |
参照1 つのシステム上の 1 つ以上のディスプレイ デバイスを表します。
Screen データ型で公開されるメンバを以下の表に示します。
パブリック プロパティ| 名前 | 説明 | |
|---|---|---|
| WorkingArea | ディスプレイの作業領域を取得します。作業領域とは、ディスプレイのデスクトップ領域からタスクバー、ドッキングされたウィンドウ、およびドッキングされたツール バーを除いた部分です。 |
パブリック メソッド| 名前 | 説明 | |
|---|---|---|
| Equals | オーバーロードされます。 オーバーライドされます。 |
| FromControl | 指定したコントロールの最大部分を保持するディスプレイを表す Screen を取得します。 |
| FromHandle | 指定したハンドルによって参照されているオブジェクトの最大領域を保持するディスプレイを表す Screen を取得します。 |
| FromPoint | 指定したポイントを保持するディスプレイを表す Screen を取得します。 |
| FromRectangle | 四角形の最大部分を保持するディスプレイの Screen を取得します。 |
| GetBounds | オーバーロードされます。 ディスプレイの範囲を取得します。 |
| GetHashCode | オーバーライドされます。 オブジェクトのハッシュ コードを計算して取得します。 |
| GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
| GetWorkingArea | オーバーロードされます。 ディスプレイの作業領域を取得します。 |
| ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
| ToString | オーバーライドされます。 このオブジェクトを表す文字列を取得します。 |
プロテクト メソッド| 名前 | 説明 | |
|---|---|---|
| Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
| MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |
参照(SCREEN から転送)
出典: フリー百科事典『ウィキペディア(Wikipedia)』 (2025/09/14 09:10 UTC 版)
スクリーン (screen) は、原義では風などを遮るもの、仕切り、遮蔽物、薄い布状のもの、またそれを用いたふるいを言う。スクリーンを用いるという意味で動詞としても用いる(スクリーニングを参照)。