C#利用API制作类似QQ一样的右下角弹出窗体
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace testWindowsForms
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
int x = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Width - this.Width - 10;
int y = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Height - this.Height - 10;
this.SetDesktopLocation(x, y);
Win32.SetWindowPos(this.Handle, 100,
Screen.PrimaryScreen.Bounds.Width - this.Width,
Screen.PrimaryScreen.Bounds.Height - this.Height - 30, 50, 50, 1);
Win32.AnimateWindow(this.Handle, 500, Win32.AW_VER_NEGATIVE);
this.label1.Text = "宽:" + this.Width;
this.label2.Text = "高:" + this.Height;
}
}
public class Win32
{
public const Int32 AW_HOR_POSITIVE = 0x00000001;
public const Int32 AW_HOR_NEGATIVE = 0x00000002;
public const Int32 AW_VER_POSITIVE = 0x00000004;
public const Int32 AW_VER_NEGATIVE = 0x00000008;
public const Int32 AW_CENTER = 0x00000010;
public const Int32 AW_HIDE = 0x00010000;
public const Int32 AW_ACTIVATE = 0x00020000;
public const Int32 AW_SLIDE = 0x00040000;
public const Int32 AW_BLEND = 0x00080000;
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern bool AnimateWindow(IntPtr hwnd, int dwTime, int dwFlags);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern bool SetWindowPos(
IntPtr hwnd,
int hWndInsertAfter,
int x,
int y,
int cx,
int cy,
int wFlags
);
}
}
以上代码测试通过!
C#利用API制作类似QQ一样的右下角弹出窗体的更多相关文章
- 仿QQ空间根据位置弹出PopupWindow显示更多操作效果
我们打开QQ空间的时候有个箭头按钮点击之后弹出PopupWindow会根据位置的变化显示在箭头的上方还是下方,比普通的PopupWindow弹在屏幕中间显示好看的多. 先看QQ空间效果图: ...
- 【转】swift实现ios类似微信输入框跟随键盘弹出的效果
swift实现ios类似微信输入框跟随键盘弹出的效果 为什么要做这个效果 在聊天app,例如微信中,你会注意到一个效果,就是在你点击输入框时输入框会跟随键盘一起向上弹出,当你点击其他地方时,输入框又会 ...
- 转(C# 类似右键菜单弹出窗体)
文章来自 https://www.cnblogs.com/ahdung/p/FloatLayerBase.html 每天进步一点点 新建类 FloatLayerBase 继承Form, 自己有点小改 ...
- Duilib 实现右下角弹出像QQ新闻窗口,3秒后自动关闭(一)
转载:https://blog.twofei.com/667/ 自绘或子类化控件时,有时需要处理鼠标进入(MouseEnter)/鼠标离开(MouseLeave)/鼠标停留(MouseHover)消息 ...
- iOS UITableView制作类似QQ好友列表视图
#import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDele ...
- swift实现ios类似微信输入框跟随键盘弹出的效果
封面(图文无关) 为什么要做这个效果 在聊天app,例如微信中,你会注意到一个效果,就是在你点击输入框时输入框会跟随键盘一起向上弹出,当你点击其他地方时,输入框又会跟随键盘一起向下收回,二者完全无缝连 ...
- 仿苹果短信(微信 ,qq)左划弹出菜单
难点: 1.功能的实现,左划.ListView的复用 2.单行显示,多行显示 3.ListView分割线.点击阴影,上下滑动左右滑动无阴影.多点触控改为单点触控 4.融球动画 http://blog. ...
- Duilib 实现右下角弹出像QQ新闻窗口,3秒后窗口透明度渐变最后关闭,若在渐变过程中鼠标放到窗口上,窗口恢复最初状态(二)
效果: 1.定义两个个定时器ID #define ID_TIMER_DISPLAY_DELAY 30 #define ID_TIMER_DISPLAY_CLOSE 40 2.添加一个成员函数和成员变量 ...
- Android封装类似微信的顶部TitleBar弹出的PopupWindow代码
Android仿微信顶部titlebar,点击加号弹出的PopupWindow,是封装好的PopupWindow,直接拿来用即可,先看效果图: 调用代码非常简单,这是MainActivity的代码: ...
随机推荐
- linux 新建用户、用户组 以及为新用户分配权限
Linux 系统是一个多用户多任务的分时操作系统,任何一个要使用系统资源的用户,都必须首先向系统管理员申请一个账号,然后以这个账号的身份进入系统.用户的账号 一方面可以帮助系统管理员对使用系统的用户进 ...
- JQUERY 选择器 总结,比较全
jQuery 的选择器可谓之强大无比,这里简单地总结一下常用的元素查找方法 $("#myELement") 选择id值等于myElement的元素,id值不能重复在文档中只能有一个 ...
- 'ascii' codec can't encode characters in position 0-8: ordinal not in range(128)的解决办法
使用的python2.7,运行的时候出现了'ascii' codec can't encode characters in position 0-8: ordinal not in range(128 ...
- poj 2676 Sudoku ( dfs )
dfs 用的还是不行啊,做题还是得看别人的博客!!! 题目:http://poj.org/problem?id=2676 题意:把一个9行9列的网格,再细分为9个3*3的子网格,要求每行.每列.每个子 ...
- 函数fsp_alloc_seg_inode
从inode page中申请inode entry inode = fsp_alloc_seg_inode(space_header, mtr); /************************* ...
- Datalist增删改查——联系人管理
关于Datalist,其实和Repeater差不多,都是存放数据的控件,相比较下,Datalist和Repeater虽然都是用的模板,但是Datalist比之多了Edit模板,也就是编辑栏的模板,事件 ...
- SCADA软件整体架构
SCADA软件整体框架如下所示: 1.免费版本可以支持的IO容量为2048点,无运行时间限制. 2.免费版本仅支持本地Runtime运行,CLServer服务器只能运行24小时. 3.免费版本支持的驱 ...
- MyEclipse/Eclipse导入sun.misc.BASE64Encoder jar包步骤
1.右键项目 -->Properties -->Java Bulid Path-> Libraries -->JRE System Library-->Access ru ...
- Hadoop文件系统常用命令
1.查看指定目录下内容 hadoop dfs –ls [文件目录] eg: hadoop dfs –ls /user/wangkai.pt 2.打开某个已存在文件 hadoop dfs –cat [f ...
- hadoop hdfs的java操作
访问hdfs上的文件并写出到输出台 /** * 访问hdfs上的文件并写出到输出台 * @param args */ public static void main(String[] args) { ...
转载▼