2008/03/06 20:15

Image.Source는 어떻게 쓰나

이미지 사용하기가 조금 복잡해졌어요.

Image image = new Image();
image.Source = new BitmapImage(new Uri("http://hugeflow.com/HFLogo.jpg", UriKind.Absolute));

하지만 의미를 찾자면 BitmapImage에 DownloadProgress이벤트가 있다는 것!
이제 이미지가 다 받아졌는지 확인 할 때 Timer 안 써도 된다는 것!

Image image = new Image();
BitmapImage bitmap = new BitmapImage(new Uri("http://hugeflow.com/HFLogo.jpg", UriKind.Absolute));
bitmap.DownloadProgress += new DownloadProgressEventHandler(bitmap_DownloadProgress);

이벤트 핸들러

void bitmap_DownloadProgress(object sender, DownloadProgressEventArgs e)
{
    BitmapImage bitmap = sender as BitmapImage;

    if (e.Progress == 1)
    {
         // 다 받아졌다!
    }
}


네임스페이스

using System.Windows.Media.Imaging;
이올린에 북마크하기(0) 이올린에 추천하기(0)
크리에이티브 커먼즈 라이선스
Creative Commons License
Trackback 0 Comment 0

Trackback : http://gilverlight.net/trackback/2750 관련글 쓰기