Screen.PrimaryScreen プロパティ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)



PrimaryScreen プロパティと GetWorkingArea メソッドの使用方法を次のコード例に示します。このメソッドには、Button1 という名前のボタンが配置されているフォームが必要です。
' This method will adjust the size of the form to utilize ' the working area of the screen. Private Sub Button1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button1.Click ' Retrieve the working rectangle from the Screen class ' using the PrimaryScreen and the WorkingArea properties. Dim workingRectangle As System.Drawing.Rectangle = _ Screen.PrimaryScreen.WorkingArea ' Set the size of the form slightly less than size of ' working rectangle. Me.Size = New System.Drawing.Size(workingRectangle.Width - 10, _ workingRectangle.Height - 10) ' Set the location so the entire form is visible. Me.Location = New System.Drawing.Point(5, 5) End Sub
// This method will adjust the size of the form to utilize // the working area of the screen. private void Button1_Click(System.Object sender, System.EventArgs e) { // Retrieve the working rectangle from the Screen class // using the PrimaryScreen and the WorkingArea properties. System.Drawing.Rectangle workingRectangle = Screen.PrimaryScreen.WorkingArea; // Set the size of the form slightly less than size of // working rectangle. this.Size = new System.Drawing.Size( workingRectangle.Width-10, workingRectangle.Height-10); // Set the location so the entire form is visible. this.Location = new System.Drawing.Point(5, 5); }
// This method will adjust the size of the form to utilize // the working area of the screen. private: void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) { // Retrieve the working rectangle from the Screen class // using the PrimaryScreen and the WorkingArea properties. System::Drawing::Rectangle workingRectangle = Screen::PrimaryScreen->WorkingArea; // Set the size of the form slightly less than size of // working rectangle. this->Size = System::Drawing::Size( workingRectangle.Width - 10, workingRectangle.Height - 10 ); // Set the location so the entire form is visible. this->Location = System::Drawing::Point( 5, 5 ); }
// This method will adjust the size of the form to utilize // the working area of the screen. private void button1_Click(Object sender, System.EventArgs e) { // Retrieve the working rectangle from the Screen class // using the PrimaryScreen and the WorkingArea properties. System.Drawing.Rectangle workingRectangle = Screen.get_PrimaryScreen().get_WorkingArea(); // Set the size of the form slightly less than size of // working rectangle. this.set_Size(new System.Drawing.Size(workingRectangle.get_Width() - 10, workingRectangle.get_Height() - 10)); // Set the location so the entire form is visible. this.set_Location(new System.Drawing.Point(5, 5)); } //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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からScreen.PrimaryScreen プロパティを検索する場合は、下記のリンクをクリックしてください。

- Screen.PrimaryScreen プロパティのページへのリンク