mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-29 10:24:34 +00:00
Move Common functionality to Core project & rendering and Model support as well
This commit is contained in:
23
PckStudio.Core/Extensions/PictureBoxExtensions.cs
Normal file
23
PckStudio.Core/Extensions/PictureBoxExtensions.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace PckStudio.Core.Extensions
|
||||
{
|
||||
public static class PictureBoxExtensions
|
||||
{
|
||||
public static bool IsAnimating(this PictureBox pictureBox)
|
||||
{
|
||||
FieldInfo fi = typeof(PictureBox).GetField("currentlyAnimating", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
return (bool)fi.GetValue(pictureBox);
|
||||
}
|
||||
|
||||
public static void Animate(this PictureBox pictureBox, bool animate)
|
||||
{
|
||||
MethodInfo animateMethod = typeof(PictureBox).GetMethod("Animate", BindingFlags.NonPublic | BindingFlags.Instance,
|
||||
null, new Type[] { typeof(bool) }, null);
|
||||
animateMethod.Invoke(pictureBox, new object[] { animate });
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user