vb.net窗体总在最前,winform 窗口一直在最前面
VB.NET如何让弹出的窗体显示在所有的窗体的最前面(包括其他程序打开的窗体)
你可以这样做,设置窗体的TopMost 属性为真!
创新互联建站专注为客户提供全方位的互联网综合服务,包含不限于网站设计制作、成都做网站、宿松网络推广、微信小程序定制开发、宿松网络营销、宿松企业策划、宿松品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们最大的嘉奖;创新互联建站为所有大学生创业者提供宿松建站搭建服务,24小时服务热线:028-86922220,官方网址:www.cdcxhl.com
Me.TopMost = True
Form.TopMost 属性
获取或设置一个值,指示该窗体是否应显示为最顶层窗体。
VB 窗口置顶
你说的是保持在最前面吧!你再说明白点!
Private Declare Function SetWindowPos Lib "user32" (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)
Private Sub Form_Load()
Call SetWindowPos(Me.hwnd, -1, 0, 0, 0, 0, 3)
'其它代码
End Sub
将下面的代码复制到记事本中,并将其保持为Form1.frm
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 0 'None
ClientHeight = 4695
ClientLeft = 0
ClientTop = 0
ClientWidth = 6975
LinkTopic = "Form1"
ScaleHeight = 4695
ScaleWidth = 6975
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Begin VB.Shape Shape3
BackColor = H000080FF
BackStyle = 1 'Opaque
BorderStyle = 0 'Transparent
Height = 855
Left = 3480
Shape = 3 'Circle
Top = 960
Width = 975
End
Begin VB.Shape Shape2
BackColor = H000080FF
BackStyle = 1 'Opaque
BorderStyle = 0 'Transparent
Height = 855
Left = 1560
Shape = 3 'Circle
Top = 960
Width = 975
End
Begin VB.Shape Shape1
BackColor = H000080FF
BackStyle = 1 'Opaque
BorderStyle = 0 'Transparent
Height = 1095
Left = 1920
Shape = 2 'Oval
Top = 1320
Width = 2055
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function SetWindowPos Lib "user32" (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)
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Dim mouse_x As Single
Dim mouse_y As Single
Private Sub Form_Load()
Call SetWindowPos(Me.hwnd, -1, 0, 0, 0, 0, 3)
Me.BackColor = HFF0000
Dim rtn As Long
BorderStyler = 0
rtn = GetWindowLong(hwnd, -20)
rtn = rtn Or H80000
SetWindowLong hwnd, -20, rtn
SetLayeredWindowAttributes hwnd, HFF0000, 0, H1
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
mouse_x = 0
mouse_y = 0
If Button = 1 Then
mouse_x = X
mouse_y = Y
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Form1.Left = Form1.Left + (X - mouse_x)
Form1.Top = Form1.Top + (Y - mouse_y)
End If
End Sub
VB.net有多个MDI子窗体,怎么不用show让他们置顶
Private Sub 窗口切换(ByVal form_name As Form)
Dim I As Integer
If list.Count 0 Then
For I = 0 To list.Count - 1
list.Item(I).hide()
Next
End If
form_name.MdiParent = Me
form_name.Show()
form_name.TopMost = True
End Sub
为什么不能用show呢,不明白
怎样让.NET VB启动的程序都显示在最前面?
shell加个参数:
Shell("D:\Program Files\Microsoft Office\Office14\WINWORD.EXE", AppWinStyle.NormalFocus)
VB.NET窗口置顶在最前面显示的时候不影响目前鼠标焦点.
这是一个关于模态窗口与非模态窗口的问题。
实现非模态窗口也没什么难度
Dim form As New Form1
form.TopMost = True
form.Show()
你再将鼠标移到父窗口上,弹出的窗口也不会消失。
文章题目:vb.net窗体总在最前,winform 窗口一直在最前面
URL链接:http://cdiso.cn/article/heoeei.html