日期:2014-05-18 浏览次数:20932 次
/// <summary> /// 窗体显示方式 /// </summary> public enum AnimateWindowEmu { AW_HOR_POSITIVE = 0x0001,//从左向右显示 AW_HOR_NEGATIVE = 0x0002,//从右向左显示 AW_VER_POSITIVE = 0x0004,//从上到下显示 AW_VER_NEGATIVE = 0x0008,//从下到上显示 AW_CENTER = 0x0010,//从中间向四周 AW_HIDE = 0x10000, //隐蔽 AW_ACTIVATE = 0x20000,//普通显示 AW_SLIDE = 0x40000, //显示 AW_BLEND = 0x80000,//透明渐变显示 } private void timer1_Tick(object sender, EventArgs e) { frmMsg _Form = new frmMsg(); _Form.Size = new Size(200, 100); int _X = Screen.PrimaryScreen.Bounds.Width - _Form.Size.Width; int _Y = SystemInformation.WorkingArea.Height - _Form.Size.Height; _Form.StartPosition = FormStartPosition.Manual; _Form.Location = new Point(_X, _Y); //AnimateWindow. | AnimateWindow.AW_VER_NEGATIVE AnimateWindow(_Form.Handle, 1000, AnimateWindowEmu.AW_SLIDE | AnimateWindowEmu.AW_VER_NEGATIVE); _Form.Show(); }
------解决方案--------------------
http://www.cnblogs.com/xianzuoqiaoqi/archive/2009/08/24/1552811.html
timer 或者 利用
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern bool AnimateWindow(
IntPtr hwnd, // handle to window
int dwTime, // duration of animation
int dwFlags // animation type
);
------解决方案--------------------
最简单的办法:做一个半透明Form弹出,控制其Location偏移量
代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace CommonModel
{
public class BalloonForm : Form
{
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()