VB.NET窗口置顶在最前面显示的时候不影响目前鼠标焦点.这是一个关于模态窗口与非模态窗口的问题 。
实现非模态窗口也没什么难度
Dim form As New Form1
form.TopMost = True
form.Show()
vb.net置顶你再将鼠标移到父窗口上vb.net置顶 , 弹出的窗口也不会消失 。
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
【vb.net置顶 vba 窗口置顶】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如何让弹出的窗体显示在所有的窗体的最前面(包括其他程序打开的窗体)你可以这样做vb.net置顶,设置窗体的TopMost 属性为真vb.net置顶!
Me.TopMost = True
Form.TopMost 属性
获取或设置一个值,指示该窗体是否应显示为最顶层窗体 。
急:vb.net设计的软件中,如何让主窗口置顶?用SetWindowPos,参数TOP_MOST
就是直接设置窗口的TOPMOST属性也行啊 , 把默认的false改成true,自己在窗口的属性列表里找找吧
VB.NET 画直线 问题 怎样让直线置顶(就是不被其它控件覆盖) 100分(希望详细些)如较麻烦,会追加分数这个必须用控件的方法解决,VB6有个Line控件很容易解决这个问题,但是VB.NET没有了,幸好微软也想到了这个缺陷,提供免费的Visual Basic PowerPacks控件箱,其中有Line控件 。
Visual Basic PowerPacks下载地址:
使用 LineShape 控件绘制直线:
vb.net中使用Application.Dialogs(8).Show()调用选择打印机时,为什么选择打印机的窗体不能置顶?PrintDialog1.ShowDialog()
就是模态置顶显示vb.net置顶的vb.net置顶 , 不关闭没法操作下面vb.net置顶的窗体
vb.net置顶的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于vba 窗口置顶、vb.net置顶的信息别忘了在本站进行查找喔 。
推荐阅读
- 如何营销商品,怎么样做好营销,把产品卖出去
- 硬盘格式化怎么回复,硬盘格式化后如何恢复
- mysql中如何输入生日,mysql怎么输入语句
- php无刷下更新数据 php刷新页面保存数据
- 云考ai鸿蒙手机怎么样,云考ai鸿蒙手机怎么样
- flutter日漫频率震动,flutter 振动
- 上城区如何推广品牌衣服,衣服品牌推广方案
- 怎么确定oracle实例 怎么查看oracle实例
- 安卓手机虚标电池怎么办,安卓手机虚电怎么拨号解决