上图演示

  private void display_Click(object sender, EventArgs e)
{
Frm_Info.Instance().ShowForm();//显示窗体
} private void close_Click(object sender, EventArgs e)
{
Frm_Info.Instance().CloseForm();//隐藏窗体
}
        #region 显示窗体
public void ShowForm()
{
switch (this.FormNowState)
{
case FormState.Hide:
if (this.Height <= this.Rect.Height - 192)//当窗体没有完全显示时
this.SetBounds(Rect.X, this.Top - 192, Rect.Width, this.Height + 192);//使窗体不断上移
else
{
this.SetBounds(Rect.X,Rect.Y,Rect.Width,Rect.Height);//设置当前窗体的边界
}
AnimateWindow(this.Handle, 800, AW_SLIDE + AW_VER_NEGATIVE);//动态显示本窗体
break;
}
}
#endregion #region 关闭窗体
public void CloseForm()
{
AnimateWindow(this.Handle,800,AW_SLIDE + AW_VER_POSITIVE + AW_HIDE);//动画隐藏窗体
this.FormNowState = FormState.Hide;//设定当前窗体的状态为隐藏
}
#endregion

Popup 窗体

  public partial class Frm_Info :System.Windows.Forms.Form
{
#region 声明的变量
private System.Drawing.Rectangle Rect;//定义一个存储矩形框的数组
private FormState InfoStyle = FormState.Hide;//定义变量为隐藏
static private Frm_Info dropDownForm = new Frm_Info();//实例化当前窗体
private static int AW_HIDE = 0x00010000; //该变量表示动画隐藏窗体
private static int AW_SLIDE = 0x00040000;//该变量表示出现滑行效果的窗体
private static int AW_VER_NEGATIVE = 0x00000008;//该变量表示从下向上开屏
private static int AW_VER_POSITIVE = 0x00000004;//该变量表示从上向下开屏
#endregion #region 该窗体的构造方法
public Frm_Info()
{
InitializeComponent();
//初始化工作区大小
System.Drawing.Rectangle rect = System.Windows.Forms.Screen.GetWorkingArea(this);//实例化一个当前窗口的对象
this.Rect = new System.Drawing.Rectangle(rect.Right - this.Width - 1,rect.Bottom - this.Height - 1,this.Width,this.Height);//为实例化的对象创建工作区域
}
#endregion #region 调用API函数显示窗体
[DllImportAttribute("user32.dll")]
private static extern bool AnimateWindow(IntPtr hwnd, int dwTime, int dwFlags);
#endregion #region 鼠标控制图片的变化
private void pictureBox1_MouseEnter(object sender, EventArgs e)
{
pictureBox1.Image = imageList1.Images[1];//设定当鼠标进入PictureBox控件时PictureBox控件的图片
} private void pictureBox1_MouseLeave(object sender, EventArgs e)
{
pictureBox1.Image = imageList1.Images[0]; //设定当鼠标离开PictureBox控件时PictureBox控件的图片
}
#endregion #region 定义标识窗体移动状态的枚举值
protected enum FormState
{ Hide=0,//隐藏窗体
Display=1,//显示窗体
Displaying=2,//显示窗体中
Hiding=3 //隐藏窗体中
}
#endregion #region 用属性标识当前状态
protected FormState FormNowState
{
get { return this.InfoStyle; } //返回窗体的当前状态
set { this.InfoStyle = value; } //设定窗体当前状态的值
}
#endregion #region 显示窗体
public void ShowForm()
{
switch (this.FormNowState)
{
case FormState.Hide:
if (this.Height <= this.Rect.Height - 192)//当窗体没有完全显示时
this.SetBounds(Rect.X, this.Top - 192, Rect.Width, this.Height + 192);//使窗体不断上移
else
{
this.SetBounds(Rect.X,Rect.Y,Rect.Width,Rect.Height);//设置当前窗体的边界
}
AnimateWindow(this.Handle, 800, AW_SLIDE + AW_VER_NEGATIVE);//动态显示本窗体
break;
}
}
#endregion #region 关闭窗体
public void CloseForm()
{
AnimateWindow(this.Handle,800,AW_SLIDE + AW_VER_POSITIVE + AW_HIDE);//动画隐藏窗体
this.FormNowState = FormState.Hide;//设定当前窗体的状态为隐藏
}
#endregion #region 返回当前窗体的实例化对象
static public Frm_Info Instance()
{
return dropDownForm; //返回当前窗体的实例化对象
}
#endregion
}

C# 从桌面右下角显示 Popup 窗口提醒的更多相关文章

  1. C# winform窗体在桌面右下角显示(任务栏上方)

    问题描述: 有一个主窗口程序,需要给该程序添加一个通知子窗口.子窗口的位置为右下角. 解决方法: 在子窗口frmPopMsg的代码文件中添加如下代码: public frmPopMsg() { Ini ...

  2. linux如何隐藏和显示所有窗口?

    centos7 基本上就跟fedora23是一样的了, 也许它们使用的内和是一样的, fedora23使用的是4.2.3, 所以使用fedora对使用centos和redhat是有优势和好处福利的. ...

  3. C#实现右下角弹出窗口效果

    /// <summary> /// 窗体动画函数 注意:要引用System.Runtime.InteropServices; /// </summary> /// <pa ...

  4. C# winform 右下角弹出窗口结果

    using System.Runtime.InteropServices; [DllImport("user32")] private static extern bool Ani ...

  5. Excel在任务栏中只显示一个窗口的解决办法

     Excel在任务栏中只显示一个窗口的解决办法  以前朋友遇到过这个问题,这次自己又遇到了,习惯了以前的那种在任务栏中显示全部窗口,方便用Alt+Tab键进行切换. 如果同时打开许多Excel工作簿, ...

  6. Windows Server 2012 R2在桌面上显示计算机/网络图标

    原文 Windows Server 2012 R2在桌面上显示计算机/网络图标 从Windows2012开始,微软取消了服务器桌面个性化选项,如何重新调出配置界面,可以使用微软命令调出.具体方法如下: ...

  7. c# 右下角弹出窗口

    public partial class Form2 : Form { System.Diagnostics.Stopwatch sth = new System.Diagnostics.Stopwa ...

  8. c# Windows Service 桌面上显示UI

    介绍 本文的目的是说明如何从Windows Vista中的服务正确启动交互式进程,以及演示如何以完全管理员权限启动该进程.交互式过程是能够在桌面上显示UI的过程. 本文介绍如何创建一个名为Loader ...

  9. C# winform实现右下角弹出窗口结果的方法

    using System.Runtime.InteropServices; [DllImport("user32")] private static extern bool Ani ...

  10. mfc对话框启动就直接隐藏在右下角显示托盘图标

    之前在网络上找了一份mfc对话框启动就直接隐藏窗体,在右下角显示托盘图标的demo 在win7下可以正常使用,但在win10上直接溢出,导致计算机跟注销似的崩溃现象. 后来找到原因是因为在OnInit ...

随机推荐

  1. [ABC233G] Strongest Takahashi

    Problem Statement There is a $N \times N$ grid, with blocks on some squares. The grid is described b ...

  2. TensorFlow C++ 初始化 Tensor 内存 到GPU 内存

    最近使用TensorFlow C++版本实现神经网络的部署,我通过GPU 处理得到网络的输入值,因此输入值在GPU内存上保存, TF 输入tensor 的调用语句为 Tensor inputTenso ...

  3. bash shell笔记整理——date命令

    date命令初步了解 简单来说date的主要作用大多数用于以给定的格式来显示时间. 在后期我们写一些脚本当中也会使用到,比如说按照日期来给文件备份打包等. 下面我们来看看帮助信息: [root@ngi ...

  4. 23年底,我出齐了Spring boot,Spring cloud和案例方面的书,正在写一本面试书(代年终总结)

    年末了,再来总结一下吧,希望本人明年的年终总结文还能在博客园发. 这次总结的主题是本人出的java书.这几年本人出了不少书,其中有python.redis和Java方面的. 姑且不说其它,java方面 ...

  5. 记一次windows病毒联合排查全过程

    8月2日通过态势感知平台,发现大量内部DNS服务器有恶意请求,且告警描述为:试图解析僵尸网络C&C服务器xmr-eu2.nanopool.org的地址,通过截图可以看到,用户每5分钟会定期向目 ...

  6. Linux 多路复用(多路转接)

    出现原因 如果需要从一个文件描述符中读取数据,然后将数据写入到另一个文件描述符时,可以按照如下的阻塞 IO : while ((n = read(STDIN_FILENO, buf, BUFFER_S ...

  7. Spring源码学习笔记6——Spring bean的实例化

    一丶前言 前面我们了解到读取xml or 根据扫描路径生成BeanDefinition并注册到BeanFactory,相当于我们具备了生火做饭的原材料:BeanDefinition,接下来就是Spri ...

  8. xpath语法与lxml库详解

    xpath语法与lxml库 摘要:本文详细介绍了xpath语法,lxml库的使用以及两者的结合使用 注:平常爬虫运用的Xpath不是来自element中通过Chrome插件XPath Helper写出 ...

  9. 初识GaussDB(for Cassandra)

    摘要:GaussDB(for Cassandra)是一款基于华为自主研发的计算存储分离架构的分布式云数据库服务. "local quorum查询某个分区键的条数,每次查询,条数都不一样.&q ...

  10. 【“互联网+”大赛华为云赛道】CloudIDE命题攻略:明确业务场景,快速开发插件

    摘要:基于华为云CloudIDE和插件开发框架自行设计并开发插件. IDE是每个开发人员必备的生产工具,一款好的IDE + 插件的组合,除了帮助开发者把编写代码.组织项目.编译运行放在一个环境中外,还 ...