PictureBox.WaitOnLoad Property

Note: This property is new in the .NET Framework version 2.0.

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)

public bool WaitOnLoad { get; set; }
/** @property */
public boolean get_WaitOnLoad ()

/** @property */
public void set_WaitOnLoad (boolean value)

public function get WaitOnLoad () : boolean

public function set WaitOnLoad (value : boolean)

Property Value

true if an image-loading operation is done synchronously, otherwise, false. The default is false.

Setting the WaitOnLoad property to true means the image is loaded synchronously, which 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 while the specified image is loaded, and the user can interact with the interface during the load process.

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 the Click event for the button is associated with the startLoadButton_Click method in this example. You will need to change the image file path to one that is valid on your system.

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

    // Load the image asynchronously.

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

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

.NET Framework

Supported in: 2.0

Community Additions