PictureBox.Load 方法

定义

PictureBox 中显示图像。Displays an image in the PictureBox.

重载

Load()

显示由 ImageLocationPictureBox 属性指定的图像。Displays the image specified by the ImageLocation property of the PictureBox.

Load(String)

ImageLocation 设置为指定的 URL,并显示指示的图像。Sets the ImageLocation to the specified URL and displays the image indicated.

Load()

显示由 ImageLocationPictureBox 属性指定的图像。Displays the image specified by the ImageLocation property of the PictureBox.

public:
 void Load();
public void Load ();
member this.Load : unit -> unit
Public Sub Load ()

例外

ImageLocationnull 或空字符串。ImageLocation is null or an empty string.

另请参阅

适用于

Load(String)

ImageLocation 设置为指定的 URL,并显示指示的图像。Sets the ImageLocation to the specified URL and displays the image indicated.

public:
 void Load(System::String ^ url);
public void Load (string url);
member this.Load : string -> unit
Public Sub Load (url As String)

参数

url
String

要在 PictureBox 中显示的图像的路径。The path for the image to display in the PictureBox.

例外

urlnull 或空字符串。url is null or an empty string.

url 引用无法访问的 Web 上的图像。url refers to an image on the Web that cannot be accessed.

url 引用非图像的文件。url refers to a file that is not an image.

url 引用的文件不存在。url refers to a file that does not exist.

注解

如果 url 参数指示本地文件,则建议的格式为本地文件路径。If the url parameter indicates a local file, the recommended format is a local file path. 例如,名为 myPicture.jpg的图像文件位于 atc: \通过传递参数 c:\myPicture.jpg 来访问 urlFor example, an image file named myPicture.jpglocated atc:\ would be accessed by passing c:\myPicture.jpg for the url parameter. 可以使用完整路径(如 http://www.contoso.com/path/images/image.jpg ),也可以使用相对路径(如 /images/image.jpg)。A full path, such as http://www.contoso.com/path/images/image.jpg, or a relative path, such as ./images/image.jpg, can be used. 如果使用相对路径,则会将其视为相对于工作目录。If a relative path is used, it will be considered relative to the working directory. 调用 Load 方法可将 ImageLocation 属性设置为的值 urlA call to the Load method sets the ImageLocation property to the value of url.

另请参阅

适用于