반응형

* C# API 를 이용한 Form 애니메이션 효과 예제...

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using System.Runtime.InteropServices;

namespace CSharp_Animate
{
    public partial class Form1 : Form
    {
        [DllImport("user32.dll")]
        public static extern int AnimateWindow(IntPtr windowHandle, int animationTime, int animateWindowType);

 
        public Form1()
        {
            InitializeComponent();
        }

        private void Button1_Click(object sender, EventArgs e)
        {
            //CENTER
            Form2 frm = new Form2();
            int AW_CENTER = 0x10;
            AnimateWindow(frm.Handle, 1000, AW_CENTER);

        }

        private void Button2_Click(object sender, EventArgs e)
        {
            //HOR_POSITIVE
            Form2 frm = new Form2();
            int AW_HOR_POSITIVE = 0x01;
            AnimateWindow(frm.Handle, 1000, AW_HOR_POSITIVE);
        }

        private void Button3_Click(object sender, EventArgs e)
        {
            //VER_POSITIVE
            Form2 frm = new Form2();
            int AW_VER_POSITIVE = 0x04;
            AnimateWindow(frm.Handle, 1000, AW_VER_POSITIVE);
        }
    }
}

 

반응형

+ Recent posts