基本信息
源码名称:界面切换特效封装类
源码大小:1.04KB
文件格式:.zip
开发语言:C#
更新时间:2019-04-03
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559

本次赞助数额为: 2 元 
   源码介绍
  public class InterfaceDesgin     //界面设计类
    {
            [System.Runtime.InteropServices.DllImport("user32")]

            private static extern bool AnimateWindow(IntPtr hwnd, int dwTime, int Flags);

            private const int AW_HOR_POSITIVE = 0x0001;

            private const int AW_HOR_NEGATIVE = 0x0002;

            private const int AW_VER_POSITIVE = 0x0004;

            private const int AW_VER_NEGATIVE = 0x0008;

            private const int AW_CENTER = 0x0010;

            private const int AW_HIDE = 0x10000;

            private const int AW_ACTIVATE = 0x20000;

            private const int AW_SLIDE = 0x40000;

            private const int AW_BLEND = 0x80000;

            private int CloseOpen = 0x20000; 

            public InterfaceDesgin(IntPtr hwnd, int Flags)
            {
                try
                {
                    switch (Flags)
                    {
                        case 1: AnimateWindow(hwnd, 500, AW_HOR_POSITIVE); break; //从左向右显示

                        case 2: AnimateWindow(hwnd, 400, AW_VER_POSITIVE); break; //从上到下显示 

                        case 3: AnimateWindow(hwnd, 630, AW_HOR_POSITIVE | AW_HIDE); break;//从左向右隐藏

                        case 4: AnimateWindow(hwnd, 1600, AW_CENTER | AW_HIDE); break;//从中间向四周隐

                        case 5: AnimateWindow(hwnd, 470, AW_VER_NEGATIVE | AW_HIDE); break;//从下到上隐藏

                        case 6: AnimateWindow(hwnd, 800, AW_CENTER | CloseOpen); break;//从中间向四周

                    }
                }
                catch { }
            }


            public GraphicsPath GetRoundRectPath(RectangleF rect, float radius)
            {
                return GetRoundRectPath(rect.X, rect.Y, rect.Width, rect.Height, radius);
            }

            public GraphicsPath GetRoundRectPath(float X, float Y, float width, float height, float radius)
            {
                GraphicsPath path = new GraphicsPath();
                path.AddLine(X   radius, Y, (X   width) - (radius * 2f), Y);
                path.AddArc((X   width) - (radius * 2f), Y, radius * 2f, radius * 2f, 270f, 90f);
                path.AddLine((float)(X   width), (float)(Y   radius), (float)(X   width), (float)((Y   height) - (radius * 2f)));
                path.AddArc((float)((X   width) - (radius * 2f)), (float)((Y   height) - (radius * 2f)), (float)(radius * 2f), (float)(radius * 2f), 0f, 90f);
                path.AddLine((float)((X   width) - (radius * 2f)), (float)(Y   height), (float)(X   radius), (float)(Y   height));
                path.AddArc(X, (Y   height) - (radius * 2f), radius * 2f, radius * 2f, 90f, 90f);
                path.AddLine(X, (Y   height) - (radius * 2f), X, Y   radius);
                path.AddArc(X, Y, radius * 2f, radius * 2f, 180f, 90f);
                path.CloseFigure();
                return path;
            }

        }