Form.SetDesktopBounds メソッド
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

Public Sub SetDesktopBounds ( _ x As Integer, _ y As Integer, _ width As Integer, _ height As Integer _ )
Dim instance As Form Dim x As Integer Dim y As Integer Dim width As Integer Dim height As Integer instance.SetDesktopBounds(x, y, width, height)

デスクトップ座標は、タスクバーを除外した画面の作業領域に基づきます。このメソッドを使用して、デスクトップ上のフォームの位置とサイズを設定できます。デスクトップ座標はフォームの作業領域に基づいているため、このメソッドを使用すると、フォームをデスクトップ上に確実に表示できます。

SetDesktopBounds メソッドを使用するコード例を次に示します。この例を実行するには、Button2 という名前のボタンが配置されているフォームに、次のコードを貼り付けます。必ずすべてのイベントをイベント ハンドラに関連付けるようにしてください。
Private Sub Button2_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button2.Click Dim i As Integer For i = 0 To 20 ' With each loop through the code, the form's desktop location is ' adjusted right and down by 10 pixels and its height and width ' are each decreased by 10 pixels. Me.SetDesktopBounds(Me.Location.X + 10, Me.Location.Y + 10, _ Me.Width - 10, Me.Height - 10) ' Call Sleep to show the form gradually shrinking. System.Threading.Thread.Sleep(50) Next End Sub
private void Button2_Click(System.Object sender, System.EventArgs e) { for(int i = 0; i <= 20; i++) { // With each loop through the code, the form's // desktop location is adjusted right and down // by 10 pixels and its height and width are each // decreased by 10 pixels. this.SetDesktopBounds(this.Location.X+10, this.Location.Y+10, this.Width-10, this.Height-10); // Call Sleep to show the form gradually shrinking. System.Threading.Thread.Sleep(50); } }
void Button2_Click( System::Object^ sender, System::EventArgs^ e ) { for ( int i = 0; i <= 20; i++ ) { // With each loop through the code, the form's // desktop location is adjusted right and down // by 10 pixels and its height and width are each // decreased by 10 pixels. this->SetDesktopBounds( this->Location.X + 10, this->Location.Y + 10, this->Width - 10, this->Height - 10 ); // Call Sleep to show the form gradually shrinking. System::Threading::Thread::Sleep( 50 ); } }
private void button2_Click(Object sender, System.EventArgs e) { for (int i = 0; i <= 20; i++) { // With each loop through the code, the form's // desktop location is adjusted right and down // by 10 pixels and its height and width are each // decreased by 10 pixels. this.SetDesktopBounds(this.get_Location().get_X() + 10, this.get_Location().get_Y() + 10, this.get_Width() - 10, this.get_Height() - 10); // Call Sleep to show the form gradually shrinking. System.Threading.Thread.Sleep(50); } } //button2_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に収録されているすべての辞書からForm.SetDesktopBounds メソッドを検索する場合は、下記のリンクをクリックしてください。

- Form.SetDesktopBounds メソッドのページへのリンク