BitmapImage in WPF does lock file

前端 未结 4 640
自闭症患者
自闭症患者 2020-11-27 22:34

I use:

Dim bmi As New BitmapImage(New Uri(fiInfo.FullName, UriKind.Absolute))
bmi.CacheOption = BitmapCacheOption.OnLoad

this does not Use

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-27 23:30

    As shown in the question you link to, you'd need to call BeginInit and EndInit, like so as well as set the UriSource property:

    Dim bmi As New BitmapImage()
    bmi.BeginInit()
    bmi.CacheOption = BitmapCacheOption.OnLoad
    bmi.UriSource = New Uri(fiInfo.FullName, UriKind.Absolute)
    bmi.EndInit()
    

提交回复
热议问题