Redigera

Dela via


HtmlWindow.ResizeTo Method

Definition

Changes the size of the window to the specified dimensions.

Overloads

ResizeTo(Size)

Changes the size of the window to the specified dimensions.

ResizeTo(Int32, Int32)

Changes the size of the window to the specified dimensions.

ResizeTo(Size)

Source:
HtmlWindow.cs
Source:
HtmlWindow.cs
Source:
HtmlWindow.cs

Changes the size of the window to the specified dimensions.

public:
 void ResizeTo(System::Drawing::Size size);
public void ResizeTo (System.Drawing.Size size);
member this.ResizeTo : System.Drawing.Size -> unit
Public Sub ResizeTo (size As Size)

Parameters

size
Size

A Size describing the desired width and height of the window, in pixels. Must be 100 pixels or more in both dimensions.

Exceptions

The window you are trying to resize is in a different domain than its parent window. This restriction is part of cross-frame scripting security.

Examples

The following code example opens a new window, and resizes it to fill the available screen area.

HtmlWindow resizableWindow = null;

private void ResizeWindow()
{
    if (webBrowser1.Document != null)
    {
        resizableWindow = webBrowser1.Document.Window.OpenNew(new Uri("http://www.microsoft.com/"), "");
        resizableWindow.ResizeTo(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
    }
}
Dim ResizableWindow As HtmlWindow

Private Sub ResizeWindow()
    If (WebBrowser1.Document IsNot Nothing) Then
        ResizableWindow = WebBrowser1.Document.Window.OpenNew(New Uri("http://www.microsoft.com/"), "")
        ResizableWindow.ResizeTo(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height)
    End If
End Sub

See also

Applies to

ResizeTo(Int32, Int32)

Source:
HtmlWindow.cs
Source:
HtmlWindow.cs
Source:
HtmlWindow.cs

Changes the size of the window to the specified dimensions.

public:
 void ResizeTo(int width, int height);
public void ResizeTo (int width, int height);
member this.ResizeTo : int * int -> unit
Public Sub ResizeTo (width As Integer, height As Integer)

Parameters

width
Int32

Describes the desired width of the window, in pixels. Must be 100 pixels or more.

height
Int32

Describes the desired height of the window, in pixels. Must be 100 pixels or more.

Exceptions

The window you are trying to resize is in a different domain than its parent window. This restriction is part of cross-frame scripting security; for more information, see About Cross-Frame Scripting and Security.

Applies to