当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > 建立永遠停留在最上層的窗口(VB)

ASP.NET
asp.net Linq TO Sql 分页方法
asp.net 用XML生成放便扩展的自定义树
asp.ent下合并两个结构相同的DataTable
asp.net 遍历repeater中的控件的几种方式
asp.net 处理原文件中过长的viewstate代码
asp.net下遍历页面中所有的指定控件的代码
获取创建Membership的数据库创建脚本
asp.net AJAX注册类
asp.net 处理F5刷新页面重复提交页面的一个思路
ASP.NET 缓存分析和实践浅析提高运行效率
asp.net 读取并显示excel数据的实现代码
ASP.NET中常用的用来输出JS脚本的类
ASP.NET中内嵌页面代码的一个问题
asp.net(C#)操作excel(上路篇)
一个基于Asp.Net MVC的权限方案
ASP.NET实例教程:51job网站地区选择功能
ASP.NET教程:友好的Html和JS适合SEO
ASP.NET教程:使用.ashx文件去除重复内容
ASP.NET做SEO:制作架构清晰和更新及时的网站地图
ASP.NET优化:Sql注入和Html注入的黑帽SEO

ASP.NET 中的 建立永遠停留在最上層的窗口(VB)


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 61 ::
收藏到网摘: n/a

1.建立新的 [標準執行檔] 專案,根據預設值,隨即建立 Form1。 2.在 Form1 上加入兩個指令按鈕 (Command1 與 Command2)。 3.將 Command1 的標題 (Caption) 屬性設為「Always on top」。 4.將 Command2 的標題 (Caption) 屬性設為「Normal」。 5.將下面程式碼放入 Form1 的 [宣告] 區段中: Option Explicit Private Sub Command1_Click() Dim lR As Long lR = SetTopMostWindow(Form1.hwnd, True) End Sub Private Sub Command2_Click() Dim lR As Long lR = SetTopMostWindow(Form1.hwnd, False) End Sub6.在 [專案] 功能表上,按一下 [新增模組],在專案中加入新模組。 7.將下面程式碼加入新模組中: Option Explicit Public Const SWP_NOMOVE = 2 Public Const SWP_NOSIZE = 1 Public Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE Public Const HWND_TOPMOST = -1 Public Const HWND_NOTOPMOST = -2 Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" _ (ByVal hwnd As Long, _ ByVal hWndInsertAfter As Long, _ ByVal x As Long, _ ByVal y As Long, _ ByVal cx As Long, _ ByVal cy As Long, _ ByVal wFlags As Long ) As Long Public Function SetTopMostWindow(hwnd As Long, Topmost As Boolean) _ As Long If Topmost = True Then 'Make the window topmost SetTopMostWindow = SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, _ 0, FLAGS) Else SetTopMostWindow = SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, _ 0, 0,FLAGS) SetTopMostWindow = False End If End Function