当前位置: 移动技术网 > IT编程>开发语言>c# > C# 动画窗体(AnimateWindow)的小例子

C# 动画窗体(AnimateWindow)的小例子

2019年07月18日  | 移动技术网IT编程  | 我要评论
复制代码 代码如下:using system;using system.runtime.interopservices;using system.windows.forms

复制代码 代码如下:

using system;
using system.runtime.interopservices;
using system.windows.forms;

namespace winformtitle
{
    public partial class formtitle : form
    {
        [dllimport("user32.dll", entrypoint = "animatewindow")]
        private static extern bool animatewindow(intptr handle, int ms, int flags);

        public formtitle()
        {
            initializecomponent();
            this.startposition = formstartposition.centerscreen;
        }

        protected override void onload(eventargs e)
        {
            base.onload(e);
            animatewindow(this.handle, 1000, 0x20010);   // 居中逐渐显示。
            //animatewindow(this.handle, 1000, 0xa0000); // 淡入淡出效果。
            //animatewindow(this.handle, 1000, 0x60004); // 自上向下。
            //animatewindow(this.handle, 1000, 0x20004); // 自上向下。
        }

        protected override void onformclosing(formclosingeventargs e)
        {
            base.onformclosing(e);
            animatewindow(this.handle, 1000, 0x10010);    // 居中逐渐隐藏。
            //animatewindow(this.handle, 1000, 0x90000); // 淡入淡出效果。
            //animatewindow(this.handle, 1000, 0x50008); // 自下而上。
            //animatewindow(this.handle, 1000, 0x10008); // 自下而上。
        }
    }
}

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网