PictureBox.WaitOnLoad Property (System.Windows.Forms)

Switch View :
ScriptFree
.NET Framework Class Library
PictureBox.WaitOnLoad Property

Gets or sets a value indicating whether an image is loaded synchronously.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)
Syntax

Visual Basic
Public Property WaitOnLoad As Boolean
C#
public bool WaitOnLoad { get; set; }
Visual C++
public:
property bool WaitOnLoad {
	bool get ();
	void set (bool value);
}
F#
member WaitOnLoad : bool with get, set

Property Value

Type: System.Boolean
true if an image-loading operation is completed synchronously; otherwise, false. The default is false.
Remarks

Setting the WaitOnLoad property to true means the image is loaded synchronously. This causes the user interface to be blocked from other input until the image is loaded. When WaitOnLoad is false (the default) and the LoadAsync method is used to load the image, the InitialImage image is displayed when the specified image is loaded, and the user can interact with the interface during the load process.

Examples

The following code example demonstrates how to use the WaitOnLoad property. To run this example, paste the following code into a Windows Form that contains a PictureBox named pictureBox1 and a Button named startLoadButton. Make sure that the Click event for the button is associated with the startLoadButton_Click method in this example. You must change the image file path to one that is valid on your system.

Visual Basic

Private Sub startLoadButton_Click(ByVal sender As Object, _
    ByVal e As EventArgs) Handles startLoadButton.Click

    ' Ensure WaitOnLoad is false.
    pictureBox1.WaitOnLoad = False

    ' Load the image asynchronously.
    pictureBox1.LoadAsync("http://localhost/print.gif")

End Sub



C#

private void startButton_Click(object sender, EventArgs e)
{
    // Ensure WaitOnLoad is false.
    pictureBox1.WaitOnLoad = false;

    // Load the image asynchronously.
    pictureBox1.LoadAsync(@"http://localhost/print.gif");
}


Version Information

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Platforms

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
See Also

Reference