ensure remove picture box also on the same image
This commit is contained in:
@@ -21,14 +21,14 @@ public class RadPictureBoxElement_PasteImageFixes
|
||||
|
||||
public static void Postfix(object __instance)
|
||||
{
|
||||
if (__instance is RadPictureBoxElement pb && images.TryGetValue(pb, out var image) && pb.Image != image)
|
||||
if (__instance is RadPictureBoxElement pb && images.TryGetValue(pb, out var image))
|
||||
{
|
||||
// Remove first to avoid conflicts on error
|
||||
images.Remove(pb);
|
||||
|
||||
// Call "OnImageLoaded"
|
||||
var method = typeof(RadPictureBoxElement).GetMethod("OnImageLoaded", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
|
||||
method.Invoke(pb, null);
|
||||
if (pb.Image != image)
|
||||
typeof(RadPictureBoxElement).GetMethod("OnImageLoaded", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)?.Invoke(pb, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user