다음을 통해 공유


PictureBox.LoadProgressChanged 이벤트

정의

비동기 이미지 로드 작업의 진행률이 변경될 때 발생합니다.

public:
 event System::ComponentModel::ProgressChangedEventHandler ^ LoadProgressChanged;
public event System.ComponentModel.ProgressChangedEventHandler LoadProgressChanged;
public event System.ComponentModel.ProgressChangedEventHandler? LoadProgressChanged;
member this.LoadProgressChanged : System.ComponentModel.ProgressChangedEventHandler 
Public Custom Event LoadProgressChanged As ProgressChangedEventHandler 

이벤트 유형

예제

다음 코드 예제에서는 이벤트를 처리 하는 방법을 보여 줍니다 LoadProgressChanged . 이 예제를 실행하려면 다음 코드를 명명된 이름, Button 명명된 이름 startLoadButton및 이름이 progressBar1pictureBox1포함된 PictureBox Windows Form에 ProgressBar 붙여넣습니다. 메서드가 단추의 startLoadButton_ClickClick 이벤트와 연결되고 메서드가 pictureBox1_LoadProgressChanged 에 대한 pictureBox1이벤트와 LoadProgressChanged 연결되어 있는지 확인합니다. 이미지 파일 경로를 시스템에서 유효한 경로로 변경해야 합니다.

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");
}
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
void pictureBox1_LoadProgressChanged(object sender, 
    ProgressChangedEventArgs e)
{
    progressBar1.Value = e.ProgressPercentage;
}
Private Sub pictureBox1_LoadProgressChanged(ByVal sender As Object, _
    ByVal e As ProgressChangedEventArgs) _
    Handles pictureBox1.LoadProgressChanged

    progressBar1.Value = e.ProgressPercentage

End Sub

설명

LoadProgressChanged 문제는 메서드 중 하나를 사용하여 이미지가 비동기적으로 로드되는 경우에만 발생합니다 LoadAsync . 이미지 로드의 진행률 백분율은 .의 속성을 사용하여 ProgressPercentage 보고됩니다 ProgressChangedEventArgs.

LoadProgressChanged 또는 유사한 컨트롤에서 비동기 이미지 로드 작업의 ProgressBar 진행률을 반영하려는 경우를 처리합니다. ProgressPercentage 진행률 값을 업데이트하려면 해당 ProgressChangedEventArgs 속성을 사용합니다.

이벤트 처리에 대한 자세한 내용은 이벤트 처리 및 발생시키기를 참조하십시오.

적용 대상