WinFormsPopupAlerts/BasicPopupAlert.cs

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Drawing;

namespace WinFormsPopupAlerts
{
    public class BasicPopupAlert : PopupAlert
    {
        public BasicPopupAlert()
        {

        }

        public BasicPopupAlert(object[] args)
            : base(args)
        {

        }

        public override void Hide(Action<PopupAlert> callback)
        {
            if (HiddingStyle == HiddingStyle.Fade)
            {
                Action<PopupAlert> hidding = new Action<PopupAlert>(delegate(PopupAlert obj)
                {
                    float v = 1f / (float)HiddingDuration;
                    System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
                    sw.Start();
                    while (obj.Opacity > 0)
                    {
                        int msec = (int)sw.ElapsedMilliseconds;
                        obj.Invoke(new MethodInvoker(delegate() { obj.Opacity = 1 - v * msec; }));
                        System.Threading.Thread.Sleep(10);
                    }
                    obj.Invoke(new MethodInvoker(delegate() { obj.InternalHide(); }));
                    callback(obj);
                });
                hidding.BeginInvoke(this, null, null);
            }
            else if (HiddingStyle == WinFormsPopupAlerts.HiddingStyle.Slide)
            {
                Action<PopupAlert> hidding = new Action<PopupAlert>(delegate(PopupAlert obj)
                {
                    int screenWidth = Screen.PrimaryScreen.Bounds.Width;
                    int startLeft = obj.Left;
                    float v = (screenWidth - obj.Left) / (float)HiddingDuration;
                    System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
                    sw.Start();
                    while (screenWidth - obj.Left > 0)
                    {
                        int msec = (int)sw.ElapsedMilliseconds;
                        obj.Invoke(new MethodInvoker(delegate() { obj.Left = (int)((float)startLeft + v * msec); }));
                        System.Threading.Thread.Sleep(10);
                    }
                    obj.Invoke(new MethodInvoker(delegate() { obj.InternalHide(); }));
                    callback(obj);
                });
后面还有 79 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。