C# SetWindowPos窗口置顶使用说明
来源:互联网 发布:redis 命令查看数据库 编辑:程序博客网 时间:2024/04/30 12:24
就是有时候窗口不能够成功置顶,这时需要重新切换下标签,就可以置顶了,本文介绍C# SetWindowPos实现窗口置顶的方法:
[DllImport("user32.dll", CharSet = CharSet.Auto)] private static extern int SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int x, int y, int Width, int Height, int flags); /// <summary> /// 得到当前活动的窗口 /// </summary> /// <returns></returns> [DllImport("user32.dll", CharSet = CharSet.Auto)] private static extern System.IntPtr GetForegroundWindow();
哪个窗体想要置顶,在Form_Load中加上
SetWindowPos(this.Handle, -1, 0, 0, 0, 0, 1 | 2); //最后参数也有用1 | 4
具体说明,看API函数说明
如果是用点击一个按钮后弹出新窗体,并置顶,则:
Form2 frm = new Form2(); frm.Show(); SetWindowPos(GetForegroundWindow(), -1, 0, 0, 0, 0, 1 | 2);
0 0
- C# SetWindowPos窗口置顶使用说明
- SetWindowPos窗口置顶
- 置顶窗口SetWindowPos()的用法
- Python使用win32gui.SetWindowPos置顶窗口
- vc将窗口置顶的SetWindowPos()函数以及相关
- vc将窗口置顶的SetWindowPos()函数以及相关
- 将窗口置顶的方法:SetWindowPos、AttachThreadInput、SwitchToThisWindow
- 窗口置顶之SetWindowPos与SetForegroundWindow的区别
- MFC对话框置顶SetWindowPos()用法
- SetWindowPos把窗口置最前
- MFC中SetWindowPos简单使用说明
- 重叠窗口,需要改变下层窗口的状态时,改变内容后,需要SetWindowPos把该窗口置顶(位置并非就跑到上面了)
- 窗口置顶/取消置顶
- 窗口置顶
- 窗口置顶
- 窗口置顶
- 窗口置顶
- 窗口置顶
- html5可视化图形编辑器(基于canvas)
- ubuntu14.04安装gitbook和使用
- 牛客网编程2
- Byte、 Boolean 、Integer、Long、Short、Character缓存
- shrio 权限管理filterChainDefinitions过滤器配置
- C# SetWindowPos窗口置顶使用说明
- JavaWeb:HttpServletResponse和HttpServletRequest
- MFC之CFrameWnd类的探索
- shell 脚本-while用法
- 信号量总结
- js 放大镜
- MFC消息的分类
- Java程序员面试题集(51-70)
- ccf 最优灌溉