WinForm利用 WinApi实现 淡入淡出 弹出 效果 仿QQ消息

摘要:
消息框:usingSystem.Runtime InteropServices;namespaceWindows_API_实现屏幕的右下角_消息框_{publicpartialclassMsg:Form{publicMsg(){InitializeComponent();Pointp=newPoint(screen.PrimaryScreen.WorkingArea.Widththis.Width

消息框:

using System.Runtime.InteropServices;

namespace Windows_API_实现屏幕右下角_消息框_
{
    public partial class Msg : Form
    {
        public Msg()
        {
            InitializeComponent();
            Point p = new Point(Screen.PrimaryScreen.WorkingArea.Width - this.Width - 3, Screen.PrimaryScreen.WorkingArea.Height - this.Height - 3);
            this.PointToScreen(p);
            this.Location = p;
        }

        [DllImport("user32.dll")]
        public static extern bool ReleaseCapture();
        [DllImport("user32.dll")]
        public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
        public const int WM_SYSCOMMAND = 0x0112;
        public const int SC_MOVE = 0xF010;
        public const int HTCAPTION = 0x0002;

        private void FrmLogin_MouseDown(object sender, MouseEventArgs e)
        {
            ReleaseCapture();
            SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
        }

        private Thread td;
        delegate void SetTextCallBack(string txt);
        private void Msg_Load(object sender, EventArgs e)
        {
            OnLoad();
        }
        private void SetText(string txt)
        {
            if (string.IsNullOrEmpty(txt))
                return;
            string first = txt.Substring(0, 1);
            string second = txt.Substring(1, txt.Length - 1);
            string thrid = second + first;
            if (lblMsg.InvokeRequired)
            {
                SetTextCallBack cb = new SetTextCallBack(SetText);
                BeginInvoke(cb, thrid);
            }
            else
                lblMsg.Text = thrid;
        }

        private void Msg_FormClosing(object sender, FormClosingEventArgs e)
        {
            td.Abort();
        }

        internal void OnLoad()
        {
            td = new Thread(() =>
            {
                while (true)
                {
                    SetText(lblMsg.Text);
                    Thread.Sleep(200);
                }
            });
            td.Start();
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
WinForm利用 WinApi实现 淡入淡出 弹出 效果 仿QQ消息第1张WinForm利用 WinApi实现 淡入淡出 弹出 效果 仿QQ消息第2张
namespace Windows_API_实现屏幕右下角_消息框_
{
    partial class Msg
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Msg));
            this.lblMsg = new System.Windows.Forms.Label();
            this.btnClose = new System.Windows.Forms.Button();
            this.SuspendLayout();
            // 
            // lblMsg
            // 
            this.lblMsg.BackColor = System.Drawing.Color.Transparent;
            this.lblMsg.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.lblMsg.ForeColor = System.Drawing.Color.DarkGreen;
            this.lblMsg.Location = new System.Drawing.Point(3, 162);
            this.lblMsg.Name = "lblMsg";
            this.lblMsg.Size = new System.Drawing.Size(269, 23);
            this.lblMsg.TabIndex = 0;
            this.lblMsg.Text = "Hello~ WinAPI 实现屏幕右下角“消息框”                       ";
            this.lblMsg.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            // 
            // btnClose
            // 
            this.btnClose.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnClose.BackgroundImage")));
            this.btnClose.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
            this.btnClose.Location = new System.Drawing.Point(244, 0);
            this.btnClose.Name = "btnClose";
            this.btnClose.Size = new System.Drawing.Size(39, 26);
            this.btnClose.TabIndex = 1;
            this.btnClose.UseVisualStyleBackColor = true;
            this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
            // 
            // Msg
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
            this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
            this.ClientSize = new System.Drawing.Size(285, 190);
            this.Controls.Add(this.btnClose);
            this.Controls.Add(this.lblMsg);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.Name = "Msg";
            this.Text = "Msg";
            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Msg_FormClosing);
            this.Load += new System.EventHandler(this.Msg_Load);
            this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.FrmLogin_MouseDown);
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.Label lblMsg;
        private System.Windows.Forms.Button btnClose;
    }
}
View Code

主窗体:

/*
   说明:
 *   Msg msg = new Msg();
            if (AnimateWindow(msg.Handle, 500, AnimationType.AW_HOR_POSITIVE | AnimationType.AW_VER_NEGATIVE | AnimationType.AW_SLIDE))
            {
                msg.Show();
            }
 * 等方式为了演示多效果,具体实现时将 AnimateWindow 方法放在 窗体的 Load,Close 事件中
 */
using System.Runtime.InteropServices;

namespace Windows_API_实现屏幕右下角_消息框_
{
    public partial class frmMain : Form
    {

        #region WinAPI http://msdn.microsoft.com/en-us/library/ms632669%28VS.85%29.aspx
        /// <summary>
        /// Enables you to produce special effects when showing or hiding windows. There are four types of animation: roll, slide, collapse or expand, and alpha-blended fade.
        /// </summary>
        /// <param name="handle">A handle to the window to animate. The calling thread must own this window.</param>
        /// <param name="time">The time it takes to play the animation, in milliseconds. Typically, an animation takes 200 milliseconds to play. </param>
        /// <param name="type">The type of animation. This parameter can be one or more of the following values. Note that, by default, these flags take effect when showing a window. To take effect when hiding a window, use AW_HIDE and a logical OR operator with the appropriate flags. </param>
        /// <returns>If the function succeeds, the return value is nonzero.</returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto, EntryPoint = "AnimateWindow")]
        private static extern bool AnimateWindow(IntPtr handle, int time, AnimationType type);
        #endregion
        public frmMain()
        {
            InitializeComponent();
        }
        #region Direction
        /// <summary>
        /// 自下而上入/出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPopup_BottomTop_Click(object sender, EventArgs e)
        {
            if (msg == null)
                msg = new Msg();
            if (AnimateWindow(msg.Handle, 500, AnimationType.AW_VER_NEGATIVE | AnimationType.AW_SLIDE))
            {
                msg.Show();
            }
            else if (AnimateWindow(msg.Handle, 500, AnimationType.AW_VER_NEGATIVE | AnimationType.AW_SLIDE | AnimationType.AW_HIDE))
            {
                msg.Close();
                msg = null;
            }
        }
        /// <summary>
        /// 自上而下入/出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPopup_TopBottom_Click(object sender, EventArgs e)
        {
            if (msg == null) msg = new Msg();
            if (AnimateWindow(msg.Handle, 500, AnimationType.AW_VER_POSITIVE | AnimationType.AW_SLIDE))
            {
                msg.Show();
            }
            else if (AnimateWindow(msg.Handle, 500, AnimationType.AW_VER_POSITIVE | AnimationType.AW_SLIDE | AnimationType.AW_HIDE))
            {
                msg.Close();
                msg = null;
            }
        }
        /// <summary>
        /// 自下而上显/隐
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDraw_BottomTop_Click(object sender, EventArgs e)
        { 
            if (msg == null) msg = new Msg();
            if (AnimateWindow(msg.Handle, 500, AnimationType.AW_VER_NEGATIVE))
            {
                msg.Show();
            }
            else if (AnimateWindow(msg.Handle, 500, AnimationType.AW_VER_NEGATIVE | AnimationType.AW_HIDE))
            {
                msg.Close();
                msg = null;
            }
        }
        /// <summary>
        /// 自上而下显/隐
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDraw_TopBottom_Click(object sender, EventArgs e)
        { 
            if (msg == null) msg = new Msg();
            if (AnimateWindow(msg.Handle, 500, AnimationType.AW_VER_POSITIVE))
            {
                msg.Show();
            }
            else if (AnimateWindow(msg.Handle, 500, AnimationType.AW_VER_POSITIVE | AnimationType.AW_HIDE))
            {
                msg.Close();
                msg = null;
            }
        }
        /// <summary>
        /// 从左到右入/出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPopup_LeftRight_Click(object sender, EventArgs e)
        { 
            if (msg == null) msg = new Msg();
            if (AnimateWindow(msg.Handle, 500, AnimationType.AW_HOR_POSITIVE | AnimationType.AW_SLIDE))
            {
                msg.Show();
            }
            else if (AnimateWindow(msg.Handle, 500, AnimationType.AW_HOR_POSITIVE | AnimationType.AW_SLIDE | AnimationType.AW_HIDE))
            {
                msg.Close();
                msg = null;
            }
        }
        /// <summary>
        /// 从右到左入/出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPopup_RightLeft_Click(object sender, EventArgs e)
        { 
            if (msg == null) msg = new Msg();
            if (AnimateWindow(msg.Handle, 500, AnimationType.AW_HOR_NEGATIVE | AnimationType.AW_SLIDE))
            {
                msg.Show();
            }
            else if (AnimateWindow(msg.Handle, 500, AnimationType.AW_HOR_NEGATIVE | AnimationType.AW_SLIDE | AnimationType.AW_HIDE))
            {
                msg.Close();
                msg = null;
            }
        }
        /// <summary>
        /// 从左到右显/隐
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDraw_LeftRight_Click(object sender, EventArgs e)
        { 
            if (msg == null) msg = new Msg();
            if (AnimateWindow(msg.Handle, 500, AnimationType.AW_HOR_POSITIVE))
            {
                msg.Show();
            }
            else if (AnimateWindow(msg.Handle, 500, AnimationType.AW_HOR_POSITIVE | AnimationType.AW_HIDE))
            {
                msg.Close();
                msg = null;
            }
        }
        /// <summary>
        /// 从右到左显/隐
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDraw_RightLeft_Click(object sender, EventArgs e)
        { 
            if (msg == null) msg = new Msg();
            if (AnimateWindow(msg.Handle, 500, AnimationType.AW_HOR_NEGATIVE))
            {
                msg.Show();
            }
            else if (AnimateWindow(msg.Handle, 500, AnimationType.AW_HOR_NEGATIVE | AnimationType.AW_HIDE))
            {
                msg.Close();
                msg = null;
            }
        }
        #endregion 
        /// <summary>
        /// 由内向外显/隐
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSpreadInOut_Click(object sender, EventArgs e)
        {
            if (msg == null)
                msg = new Msg();
            if (AnimateWindow(msg.Handle, 1000, AnimationType.AW_CENTER))
            {
                msg.Show();
            }
            else if (AnimateWindow(msg.Handle, 1000, AnimationType.AW_CENTER | AnimationType.AW_HIDE))
            {
                msg.Close();
                msg = null;
            }
        }

        private static Msg msg;
        /// <summary>
        /// 淡入
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_FadeInOut_Click(object sender, EventArgs e)
        {
            if (msg == null)
                msg = new Msg();
            if (AnimateWindow(msg.Handle, 1000, AnimationType.AW_BLEND))
            {
                msg.Show();
            }
            else if (AnimateWindow(msg.Handle, 1000, AnimationType.AW_BLEND | AnimationType.AW_HIDE))
            {
                msg.Close();
                msg = null;
            }
        }
        /// <summary>
        /// 左斜角向上入/出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPopup_Left_AngleUpward_Click(object sender, EventArgs e)
        { 
            if (msg == null)
                msg = new Msg();
            if (AnimateWindow(msg.Handle, 1000, AnimationType.AW_HOR_POSITIVE | AnimationType.AW_VER_NEGATIVE | AnimationType.AW_SLIDE))
            {
                msg.Show();
            }
            else if (AnimateWindow(msg.Handle, 1000, AnimationType.AW_HOR_POSITIVE | AnimationType.AW_VER_NEGATIVE | AnimationType.AW_SLIDE | AnimationType.AW_HIDE))
            {
                msg.Close();
                msg = null;
            }
        }
        /// <summary>
        /// 右斜角向上入/出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPopup_Right_AngleUpward_Click(object sender, EventArgs e)
        { 
            if (msg == null)
                msg = new Msg();
            if (AnimateWindow(msg.Handle, 1000, AnimationType.AW_VER_NEGATIVE | AnimationType.AW_HOR_NEGATIVE | AnimationType.AW_SLIDE))
            {
                msg.Show();
            }
            else if (AnimateWindow(msg.Handle, 1000, AnimationType.AW_VER_NEGATIVE | AnimationType.AW_HOR_NEGATIVE | AnimationType.AW_SLIDE | AnimationType.AW_HIDE))
            {
                msg.Close();
                msg = null;
            }
        }
        /// <summary>
        /// 左斜角向下入/出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPopup_Left_BevelDown_Click(object sender, EventArgs e)
        { 
            if (msg == null)
                msg = new Msg();
            if (AnimateWindow(msg.Handle, 1000, AnimationType.AW_HOR_POSITIVE | AnimationType.AW_VER_POSITIVE | AnimationType.AW_SLIDE))
            {
                msg.Show();
            }
            else if (AnimateWindow(msg.Handle, 1000, AnimationType.AW_HOR_POSITIVE | AnimationType.AW_VER_POSITIVE | AnimationType.AW_SLIDE | AnimationType.AW_HIDE))
            {
                msg.Close();
                msg = null;
            }
        }
        /// <summary>
        /// 右斜角向下入/出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPopup_Right_BevelDown_Click(object sender, EventArgs e)
        { 
            if (msg == null)
                msg = new Msg();
            if (AnimateWindow(msg.Handle, 1000, AnimationType.AW_HOR_NEGATIVE | AnimationType.AW_VER_POSITIVE | AnimationType.AW_SLIDE))
            {
                msg.Show();
            }
            else if (AnimateWindow(msg.Handle, 1000, AnimationType.AW_HOR_NEGATIVE | AnimationType.AW_VER_POSITIVE | AnimationType.AW_SLIDE | AnimationType.AW_HIDE))
            {
                msg.Close();
                msg = null;
            }
        }
        /// <summary>
        /// 左斜角向上显/隐
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDraw_Left_AngleUpward_Click(object sender, EventArgs e)
        { 
            if (msg == null)
                msg = new Msg();
            if (AnimateWindow(msg.Handle, 1000, AnimationType.AW_HOR_POSITIVE | AnimationType.AW_VER_NEGATIVE))
            {
                msg.Show();
            }
            else if (AnimateWindow(msg.Handle, 1000, AnimationType.AW_HOR_POSITIVE | AnimationType.AW_VER_NEGATIVE | AnimationType.AW_HIDE))
            {
                msg.Close();
                msg = null;
            }
        }
        /// <summary>
        /// 右斜角向上显/隐
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDraw_Right_AngleUpward_Click(object sender, EventArgs e)
        { 
            if (msg == null)
                msg = new Msg();
            if (AnimateWindow(msg.Handle, 1000, AnimationType.AW_VER_NEGATIVE | AnimationType.AW_HOR_NEGATIVE))
            {
                msg.Show();
            }
            else if (AnimateWindow(msg.Handle, 1000, AnimationType.AW_VER_NEGATIVE | AnimationType.AW_HOR_NEGATIVE | AnimationType.AW_HIDE))
            {
                msg.Close();
                msg = null;
            }
        }
        /// <summary>
        /// 左斜角向下显/隐
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDraw_Left_BevelDown_Click(object sender, EventArgs e)
        { 
            if (msg == null)
                msg = new Msg();
            if (AnimateWindow(msg.Handle, 500, AnimationType.AW_HOR_POSITIVE | AnimationType.AW_VER_POSITIVE))
            {
                msg.Show();
            }
            else if (AnimateWindow(msg.Handle, 500, AnimationType.AW_HOR_POSITIVE | AnimationType.AW_VER_POSITIVE | AnimationType.AW_HIDE))
            {
                msg.Close();
                msg = null;
            }
        }
        /// <summary>
        /// 右斜角向下显/隐
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDraw_Right_BevelDown_Click(object sender, EventArgs e)
        { 
            if (msg == null)
                msg = new Msg();
            if (AnimateWindow(msg.Handle, 500, AnimationType.AW_HOR_NEGATIVE | AnimationType.AW_VER_POSITIVE))
            {
                msg.Show();
            }
            else if (AnimateWindow(msg.Handle, 500, AnimationType.AW_HOR_NEGATIVE | AnimationType.AW_VER_POSITIVE | AnimationType.AW_HIDE))
            {
                msg.Close();
                msg = null;
            }
        } 
    }
    public enum AnimationType : int
    {
        /// <summary>
        /// Animates the window from left to right. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.
        /// </summary>
        AW_HOR_POSITIVE = 0x00000001,
        /// <summary>
        /// Animates the window from right to left. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.
        /// </summary>
        AW_HOR_NEGATIVE = 0x00000002,
        /// <summary>
        /// Animates the window from top to bottom. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND. 
        /// </summary>
        AW_VER_POSITIVE = 0x00000004,
        /// <summary>
        /// Animates the window from bottom to top. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND. 
        /// </summary>
        AW_VER_NEGATIVE = 0x00000008,
        /// <summary>
        /// Makes the window appear to collapse inward if AW_HIDE is used or expand outward if the AW_HIDE is not used. The various direction flags have no effect. 
        /// </summary>
        AW_CENTER = 0x00000010,
        /// <summary>
        /// Hides the window. By default, the window is shown. 
        /// </summary>
        AW_HIDE = 0x00010000,
        /// <summary>
        /// Activates the window. Do not use this value with AW_HIDE. 
        /// </summary>
        AW_ACTIVATE = 0x00020000,
        /// <summary>
        /// Uses slide animation. By default, roll animation is used. This flag is ignored when used with AW_CENTER. 
        /// </summary>
        AW_SLIDE = 0x00040000,
        /// <summary>
        /// Uses a fade effect. This flag can be used only if hwnd is a top-level window.  
        /// </summary>
        AW_BLEND = 0x00080000
    }
}
WinForm利用 WinApi实现 淡入淡出 弹出 效果 仿QQ消息第3张WinForm利用 WinApi实现 淡入淡出 弹出 效果 仿QQ消息第4张
namespace Windows_API_实现屏幕右下角_消息框_
{
    partial class frmMain
    {
        /// <summary>
        /// 必需的设计器变量。
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// 清理所有正在使用的资源。
        /// </summary>
        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows 窗体设计器生成的代码

        /// <summary>
        /// 设计器支持所需的方法 - 不要
        /// 使用代码编辑器修改此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {
            this.btnPopup_BottomTop = new System.Windows.Forms.Button();
            this.btnPopup_TopBottom = new System.Windows.Forms.Button();
            this.btnDraw_TopBottom = new System.Windows.Forms.Button();
            this.btnDraw_BottomTop = new System.Windows.Forms.Button();
            this.btnDraw_RightLeft = new System.Windows.Forms.Button();
            this.btnDraw_LeftRight = new System.Windows.Forms.Button();
            this.btnPopup_RightLeft = new System.Windows.Forms.Button();
            this.btnPopup_LeftRight = new System.Windows.Forms.Button();
            this.btnSpreadInOut = new System.Windows.Forms.Button();
            this.btn_FadeInOut = new System.Windows.Forms.Button();
            this.btnDraw_Right_BevelDown = new System.Windows.Forms.Button();
            this.btnDraw_Right_AngleUpward = new System.Windows.Forms.Button();
            this.btnPopup_Right_BevelDown = new System.Windows.Forms.Button();
            this.btnPopup_Right_AngleUpward = new System.Windows.Forms.Button();
            this.btnDraw_Left_BevelDown = new System.Windows.Forms.Button();
            this.btnDraw_Left_AngleUpward = new System.Windows.Forms.Button();
            this.btnPopup_Left_BevelDown = new System.Windows.Forms.Button();
            this.btnPopup_Left_AngleUpward = new System.Windows.Forms.Button();
            this.SuspendLayout();
            // 
            // btnPopup_BottomTop
            // 
            this.btnPopup_BottomTop.Location = new System.Drawing.Point(12, 12);
            this.btnPopup_BottomTop.Name = "btnPopup_BottomTop";
            this.btnPopup_BottomTop.Size = new System.Drawing.Size(103, 23);
            this.btnPopup_BottomTop.TabIndex = 0;
            this.btnPopup_BottomTop.Text = "自下而上入/出";
            this.btnPopup_BottomTop.UseVisualStyleBackColor = true;
            this.btnPopup_BottomTop.Click += new System.EventHandler(this.btnPopup_BottomTop_Click);
            // 
            // btnPopup_TopBottom
            // 
            this.btnPopup_TopBottom.Location = new System.Drawing.Point(12, 35);
            this.btnPopup_TopBottom.Name = "btnPopup_TopBottom";
            this.btnPopup_TopBottom.Size = new System.Drawing.Size(103, 23);
            this.btnPopup_TopBottom.TabIndex = 1;
            this.btnPopup_TopBottom.Text = "自上而下入/出";
            this.btnPopup_TopBottom.UseVisualStyleBackColor = true;
            this.btnPopup_TopBottom.Click += new System.EventHandler(this.btnPopup_TopBottom_Click);
            // 
            // btnDraw_TopBottom
            // 
            this.btnDraw_TopBottom.Location = new System.Drawing.Point(12, 87);
            this.btnDraw_TopBottom.Name = "btnDraw_TopBottom";
            this.btnDraw_TopBottom.Size = new System.Drawing.Size(103, 23);
            this.btnDraw_TopBottom.TabIndex = 3;
            this.btnDraw_TopBottom.Text = "自上而下显/隐";
            this.btnDraw_TopBottom.UseVisualStyleBackColor = true;
            this.btnDraw_TopBottom.Click += new System.EventHandler(this.btnDraw_TopBottom_Click);
            // 
            // btnDraw_BottomTop
            // 
            this.btnDraw_BottomTop.Location = new System.Drawing.Point(12, 64);
            this.btnDraw_BottomTop.Name = "btnDraw_BottomTop";
            this.btnDraw_BottomTop.Size = new System.Drawing.Size(103, 23);
            this.btnDraw_BottomTop.TabIndex = 2;
            this.btnDraw_BottomTop.Text = "自下而上显/隐";
            this.btnDraw_BottomTop.UseVisualStyleBackColor = true;
            this.btnDraw_BottomTop.Click += new System.EventHandler(this.btnDraw_BottomTop_Click);
            // 
            // btnDraw_RightLeft
            // 
            this.btnDraw_RightLeft.Location = new System.Drawing.Point(121, 87);
            this.btnDraw_RightLeft.Name = "btnDraw_RightLeft";
            this.btnDraw_RightLeft.Size = new System.Drawing.Size(103, 23);
            this.btnDraw_RightLeft.TabIndex = 7;
            this.btnDraw_RightLeft.Text = "从右到左显/隐";
            this.btnDraw_RightLeft.UseVisualStyleBackColor = true;
            this.btnDraw_RightLeft.Click += new System.EventHandler(this.btnDraw_RightLeft_Click);
            // 
            // btnDraw_LeftRight
            // 
            this.btnDraw_LeftRight.Location = new System.Drawing.Point(121, 64);
            this.btnDraw_LeftRight.Name = "btnDraw_LeftRight";
            this.btnDraw_LeftRight.Size = new System.Drawing.Size(103, 23);
            this.btnDraw_LeftRight.TabIndex = 6;
            this.btnDraw_LeftRight.Text = "从左到右显/隐";
            this.btnDraw_LeftRight.UseVisualStyleBackColor = true;
            this.btnDraw_LeftRight.Click += new System.EventHandler(this.btnDraw_LeftRight_Click);
            // 
            // btnPopup_RightLeft
            // 
            this.btnPopup_RightLeft.Location = new System.Drawing.Point(121, 35);
            this.btnPopup_RightLeft.Name = "btnPopup_RightLeft";
            this.btnPopup_RightLeft.Size = new System.Drawing.Size(103, 23);
            this.btnPopup_RightLeft.TabIndex = 5;
            this.btnPopup_RightLeft.Text = "从右到左入/出";
            this.btnPopup_RightLeft.UseVisualStyleBackColor = true;
            this.btnPopup_RightLeft.Click += new System.EventHandler(this.btnPopup_RightLeft_Click);
            // 
            // btnPopup_LeftRight
            // 
            this.btnPopup_LeftRight.Location = new System.Drawing.Point(121, 12);
            this.btnPopup_LeftRight.Name = "btnPopup_LeftRight";
            this.btnPopup_LeftRight.Size = new System.Drawing.Size(103, 23);
            this.btnPopup_LeftRight.TabIndex = 4;
            this.btnPopup_LeftRight.Text = "从左到右入/出";
            this.btnPopup_LeftRight.UseVisualStyleBackColor = true;
            this.btnPopup_LeftRight.Click += new System.EventHandler(this.btnPopup_LeftRight_Click);
            // 
            // btnSpreadInOut
            // 
            this.btnSpreadInOut.Location = new System.Drawing.Point(12, 116);
            this.btnSpreadInOut.Name = "btnSpreadInOut";
            this.btnSpreadInOut.Size = new System.Drawing.Size(103, 38);
            this.btnSpreadInOut.TabIndex = 9;
            this.btnSpreadInOut.Text = "伸/缩";
            this.btnSpreadInOut.UseVisualStyleBackColor = true;
            this.btnSpreadInOut.Click += new System.EventHandler(this.btnSpreadInOut_Click);
            // 
            // btn_FadeInOut
            // 
            this.btn_FadeInOut.Location = new System.Drawing.Point(121, 116);
            this.btn_FadeInOut.Name = "btn_FadeInOut";
            this.btn_FadeInOut.Size = new System.Drawing.Size(103, 38);
            this.btn_FadeInOut.TabIndex = 10;
            this.btn_FadeInOut.Text = "淡入/出";
            this.btn_FadeInOut.UseVisualStyleBackColor = true;
            this.btn_FadeInOut.Click += new System.EventHandler(this.btn_FadeInOut_Click);
            // 
            // btnDraw_Right_BevelDown
            // 
            this.btnDraw_Right_BevelDown.Location = new System.Drawing.Point(121, 235);
            this.btnDraw_Right_BevelDown.Name = "btnDraw_Right_BevelDown";
            this.btnDraw_Right_BevelDown.Size = new System.Drawing.Size(103, 23);
            this.btnDraw_Right_BevelDown.TabIndex = 18;
            this.btnDraw_Right_BevelDown.Text = "右斜角向下显/隐";
            this.btnDraw_Right_BevelDown.UseVisualStyleBackColor = true;
            this.btnDraw_Right_BevelDown.Click += new System.EventHandler(this.btnDraw_Right_BevelDown_Click);
            // 
            // btnDraw_Right_AngleUpward
            // 
            this.btnDraw_Right_AngleUpward.Location = new System.Drawing.Point(121, 212);
            this.btnDraw_Right_AngleUpward.Name = "btnDraw_Right_AngleUpward";
            this.btnDraw_Right_AngleUpward.Size = new System.Drawing.Size(103, 23);
            this.btnDraw_Right_AngleUpward.TabIndex = 17;
            this.btnDraw_Right_AngleUpward.Text = "右斜角向上显/隐";
            this.btnDraw_Right_AngleUpward.UseVisualStyleBackColor = true;
            this.btnDraw_Right_AngleUpward.Click += new System.EventHandler(this.btnDraw_Right_AngleUpward_Click);
            // 
            // btnPopup_Right_BevelDown
            // 
            this.btnPopup_Right_BevelDown.Location = new System.Drawing.Point(121, 183);
            this.btnPopup_Right_BevelDown.Name = "btnPopup_Right_BevelDown";
            this.btnPopup_Right_BevelDown.Size = new System.Drawing.Size(103, 23);
            this.btnPopup_Right_BevelDown.TabIndex = 16;
            this.btnPopup_Right_BevelDown.Text = "右斜角向下入/出";
            this.btnPopup_Right_BevelDown.UseVisualStyleBackColor = true;
            this.btnPopup_Right_BevelDown.Click += new System.EventHandler(this.btnPopup_Right_BevelDown_Click);
            // 
            // btnPopup_Right_AngleUpward
            // 
            this.btnPopup_Right_AngleUpward.Location = new System.Drawing.Point(121, 160);
            this.btnPopup_Right_AngleUpward.Name = "btnPopup_Right_AngleUpward";
            this.btnPopup_Right_AngleUpward.Size = new System.Drawing.Size(103, 23);
            this.btnPopup_Right_AngleUpward.TabIndex = 15;
            this.btnPopup_Right_AngleUpward.Text = "右斜角向上入/出";
            this.btnPopup_Right_AngleUpward.UseVisualStyleBackColor = true;
            this.btnPopup_Right_AngleUpward.Click += new System.EventHandler(this.btnPopup_Right_AngleUpward_Click);
            // 
            // btnDraw_Left_BevelDown
            // 
            this.btnDraw_Left_BevelDown.Location = new System.Drawing.Point(12, 235);
            this.btnDraw_Left_BevelDown.Name = "btnDraw_Left_BevelDown";
            this.btnDraw_Left_BevelDown.Size = new System.Drawing.Size(103, 23);
            this.btnDraw_Left_BevelDown.TabIndex = 14;
            this.btnDraw_Left_BevelDown.Text = "左斜角向下显/隐";
            this.btnDraw_Left_BevelDown.UseVisualStyleBackColor = true;
            this.btnDraw_Left_BevelDown.Click += new System.EventHandler(this.btnDraw_Left_BevelDown_Click);
            // 
            // btnDraw_Left_AngleUpward
            // 
            this.btnDraw_Left_AngleUpward.Location = new System.Drawing.Point(12, 212);
            this.btnDraw_Left_AngleUpward.Name = "btnDraw_Left_AngleUpward";
            this.btnDraw_Left_AngleUpward.Size = new System.Drawing.Size(103, 23);
            this.btnDraw_Left_AngleUpward.TabIndex = 13;
            this.btnDraw_Left_AngleUpward.Text = "左斜角向上显/隐";
            this.btnDraw_Left_AngleUpward.UseVisualStyleBackColor = true;
            this.btnDraw_Left_AngleUpward.Click += new System.EventHandler(this.btnDraw_Left_AngleUpward_Click);
            // 
            // btnPopup_Left_BevelDown
            // 
            this.btnPopup_Left_BevelDown.Location = new System.Drawing.Point(12, 183);
            this.btnPopup_Left_BevelDown.Name = "btnPopup_Left_BevelDown";
            this.btnPopup_Left_BevelDown.Size = new System.Drawing.Size(103, 23);
            this.btnPopup_Left_BevelDown.TabIndex = 12;
            this.btnPopup_Left_BevelDown.Text = "左斜角向下入/出";
            this.btnPopup_Left_BevelDown.UseVisualStyleBackColor = true;
            this.btnPopup_Left_BevelDown.Click += new System.EventHandler(this.btnPopup_Left_BevelDown_Click);
            // 
            // btnPopup_Left_AngleUpward
            // 
            this.btnPopup_Left_AngleUpward.Location = new System.Drawing.Point(12, 160);
            this.btnPopup_Left_AngleUpward.Name = "btnPopup_Left_AngleUpward";
            this.btnPopup_Left_AngleUpward.Size = new System.Drawing.Size(103, 23);
            this.btnPopup_Left_AngleUpward.TabIndex = 11;
            this.btnPopup_Left_AngleUpward.Text = "左斜角向上入/出";
            this.btnPopup_Left_AngleUpward.UseVisualStyleBackColor = true;
            this.btnPopup_Left_AngleUpward.Click += new System.EventHandler(this.btnPopup_Left_AngleUpward_Click);
            // 
            // frmMain
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(239, 266);
            this.Controls.Add(this.btnDraw_Right_BevelDown);
            this.Controls.Add(this.btnDraw_Right_AngleUpward);
            this.Controls.Add(this.btnPopup_Right_BevelDown);
            this.Controls.Add(this.btnPopup_Right_AngleUpward);
            this.Controls.Add(this.btnDraw_Left_BevelDown);
            this.Controls.Add(this.btnDraw_Left_AngleUpward);
            this.Controls.Add(this.btnPopup_Left_BevelDown);
            this.Controls.Add(this.btnPopup_Left_AngleUpward);
            this.Controls.Add(this.btn_FadeInOut);
            this.Controls.Add(this.btnSpreadInOut);
            this.Controls.Add(this.btnDraw_RightLeft);
            this.Controls.Add(this.btnDraw_LeftRight);
            this.Controls.Add(this.btnPopup_RightLeft);
            this.Controls.Add(this.btnPopup_LeftRight);
            this.Controls.Add(this.btnDraw_TopBottom);
            this.Controls.Add(this.btnDraw_BottomTop);
            this.Controls.Add(this.btnPopup_TopBottom);
            this.Controls.Add(this.btnPopup_BottomTop);
            this.Name = "frmMain";
            this.Text = "主窗体";
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.Button btnPopup_BottomTop;
        private System.Windows.Forms.Button btnPopup_TopBottom;
        private System.Windows.Forms.Button btnDraw_TopBottom;
        private System.Windows.Forms.Button btnDraw_BottomTop;
        private System.Windows.Forms.Button btnDraw_RightLeft;
        private System.Windows.Forms.Button btnDraw_LeftRight;
        private System.Windows.Forms.Button btnPopup_RightLeft;
        private System.Windows.Forms.Button btnPopup_LeftRight;
        private System.Windows.Forms.Button btnSpreadInOut;
        private System.Windows.Forms.Button btn_FadeInOut;
        private System.Windows.Forms.Button btnDraw_Right_BevelDown;
        private System.Windows.Forms.Button btnDraw_Right_AngleUpward;
        private System.Windows.Forms.Button btnPopup_Right_BevelDown;
        private System.Windows.Forms.Button btnPopup_Right_AngleUpward;
        private System.Windows.Forms.Button btnDraw_Left_BevelDown;
        private System.Windows.Forms.Button btnDraw_Left_AngleUpward;
        private System.Windows.Forms.Button btnPopup_Left_BevelDown;
        private System.Windows.Forms.Button btnPopup_Left_AngleUpward;
    }
}
View Code

免责声明:文章转载自《WinForm利用 WinApi实现 淡入淡出 弹出 效果 仿QQ消息》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇如何理解“产品”、“迭代”、“版本”[学习笔记]云计算扫盲下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

Winform下KeyDown,KeyPress,KeyUp事件的总结(转)

原文: http://www.cnblogs.com/xiashengwang/archive/2011/09/15/2578798.html 在winform程序中,经常会用到这几个事件用于控制数字输入,按键动作等操作,但一直没有完全弄清楚他们之间的区别和联系,到底什么时候用哪一个事件合适,闲暇无事,做了一个小小的总结,以免以后犯糊涂。 1) 这三个事件...

winform窗体 【打开多个窗体、窗体之间传值、打开唯一窗体】

1、打开多个窗体 2、窗体之间的传值 3打开唯一窗体 Form1中btn1按钮点击show出Form2,当Form2处于开启状态时,再次点击btn1不会继续弹出窗体,而是将焦点定位至已开启的Form2上;当Form2关闭后,再次点击btn1则会show出一个新的Form2; Form1: //创建一个全局集合,用来放置已经show出的窗体对象 L...

微软:正式发布针对 .NET Core的 Winform 设计器

转载请注明出处:葡萄城官网,葡萄城为开发者提供专业的开发工具、解决方案和服务,赋能开发者。 原文出处:https://devblogs.microsoft.com/dotnet/windows-forms-designer-for-net-core-released/ 作为微软最引以为傲的IDE编辑器,Visual Studio已经让无数专注于 .NE...

Winform设置开机启动-操作注册表

#region 设置开机运行 /// <summary> /// 设置开机运行 /// </summary> /// <param name="R_startPath">需要运行的程序.exe</param> /// <returns></returns> public static...

实现WinForm窗体的美化(借助第三方控件)

在winform项目中,其实皮肤就是一个第三方的控件,名字是IrisSkin4.dll只要添加到你的工具箱里就可以和其它控件一样使用了 一.添加控件IrisSkin4.dll。方法: 先把IrisSkin4.dll文件添加到当前项目引用(解决方案资源管理器->当前项目->引用->右键->添加引用,找到IrisSkin4.dll文件....

C#winform中ListView的使用

使用ListView模仿Windows系统的资源管理器界面,实现文件(夹)的浏览、重命名、删除及查询等功能,主要功能界面展示如下: 1.MainForm.cs及MainForm.Designer.cs 1 using System; 2 using System.Collections.Generic; 3 using System....