我正在尝试在加载时为表单设置动画。我使用了 AnimateWindow:
public partial class AdministrationMDI : Form
{
[DllImport("user32")]
static extern bool AnimateWindow(IntPtr hwnd, int time, AnimateWindowFlags flags);
public AdministrationMDI()
{
InitializeComponent();
}
enum AnimateWindowFlags : uint
{
AW_HOR_POSITIVE = 0x00000001,
AW_HOR_NEGATIVE = 0x00000002,
AW_VER_POSITIVE = 0x00000004,
AW_VER_NEGATIVE = 0x00000008,
AW_CENTER = 0x00000010,
AW_HIDE = 0x00010000,
AW_ACTIVATE = 0x00020000,
AW_SLIDE = 0x00040000,
AW_BLEND = 0x00080000
}
我在 form_load 上调用它:
private void AdministrationMDI_Load(object sender, EventArgs e)
{
AnimateWindow(this.Handle, 1000, AnimateWindowFlags.AW_BLEND);
}
但是当我将 windowstate 属性设置为 'maximized' 时,动画不起作用。有什么解决方案可以解决这个问题吗?谢谢!