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)
|
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
|
// Remove first to avoid conflicts on error
|
||||||
images.Remove(pb);
|
images.Remove(pb);
|
||||||
|
|
||||||
// Call "OnImageLoaded"
|
// Call "OnImageLoaded"
|
||||||
var method = typeof(RadPictureBoxElement).GetMethod("OnImageLoaded", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
|
if (pb.Image != image)
|
||||||
method.Invoke(pb, null);
|
typeof(RadPictureBoxElement).GetMethod("OnImageLoaded", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)?.Invoke(pb, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user