
正文
vb.net无边框弹窗 vb无边框窗体
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
VB.NET 拖动无边框窗体编程实例
Imports System Drawing Imports System Windows Forms ****************************************** Private oOriginalRegion As Region = Nothing 用于窗体移动 Private bFormDragging As Boolean = False Private oPointClicked As Point ****************************************** Private Sub Form _MouseDown(ByVal sender As Object ByVal e As System Windows Forms MouseEventArgs) Handles MyBase MouseDown Me bFormDragging = True Me oPointClicked = New Point(e X e Y) End Sub ****************************************** Private Sub Form _MouseUp(ByVal sender As Object ByVal e As System Windows Forms MouseEventArgs) Handles MyBase MouseUp Me bFormDragging = False End Sub ****************************************** Private Sub Form _MouseMove(ByVal sender As Object ByVal e As System Windows Forms MouseEventArgs) Handles MyBase MouseMove If Me bFormDragging Then Dim oMoveToPoint As Point 以当前鼠标位置为基础 找出目标位置 oMoveToPoint = Me PointToScreen(New Point(e X e Y)) 根据开始位置作出调整 oMoveToPoint Offset(Me oPointClicked X * _ (Me oPointClicked Y + _ SystemInformation CaptionHeight + _ SystemInformation BorderSize Height) * ) 移动窗体 Me Location = oMoveToPoint End If
lishixinzhi/Article/program/ASP/201311/21755
相关问答
Q1: vb 怎样制作全透明无边框的窗体,我是小白,希望能具体写下代码。
首先,把窗体的BorderStyle属性设为0
然后,输入以下代码:
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
Private Const WS_EX_LAYERED = H80000
Private Const GWL_EXSTYLE = (-20)
Private Const LWA_ALPHA = H2
Private Const LWA_COLORKEY = H1
Private Sub Form_Load()
Me.AutoRedraw = True
Me.BackColor = HFF0001
SetWindowLong Me.HWnd, GWL_EXSTYLE, GetWindowLong(Me.HWnd, GWL_EXSTYLE) Or WS_EX_LAYERED
SetLayeredWindowAttributes Me.HWnd, HFF0001, 0, LWA_COLORKEY
End Sub
运行后就是全透明无边框的窗体了
Q2: VB.net怎样按住鼠标移动无边框窗体
当用户按下左键时,为按下对象的MouseMove事件绑定处理方法,并记录鼠标坐标(窗体左上角为原点,在事件的MouseEventArgs类型的e参数中提供)。此时用户移动鼠标,保持窗体原点与鼠标新坐标的相对位置不变。当用户释放左键时,撤销按下对象的MouseMove事件处理方法
Q3: 如何移动VB中的无边框窗体
1、无边框窗体也就是无标题栏窗体,对于这样的窗体移动需要编程实现。
2、vb有两种办法实现,一直接编程实现,二调用windows API编程实现。
3、这里示例直接编程实现:
Option Explicit
Dim BolIsMove As Boolean, MousX As Long, MousY As Long
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then BolIsMove = True
MousX = X
MousY = Y
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim CurrX As Long, CurrY As Long
If BolIsMove Then
CurrX = Me.Left - MousX + X
CurrY = Me.Top - MousY + Y
Me.Move CurrX, CurrY
End If
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
BolIsMove = False
End Sub
Q4: vb.net 无边框窗体的问题
设置窗体的text为空,设置窗体的controlbox属性为false,设置窗体的FormBorderStyle 属性为Sizable,就可以改变窗体大小了,并且可以在任务栏点击。
Q5: 跪求大神指点vb.net 怎么用api 在屏幕指定的位置 创建一个无边框的窗体呀?
我只会vb6.0
创建窗体用CreateWindiw函数,注册窗体用RegisterWndClass函数
也可以用setwindiwlong函数直接把一个现有的窗口边框去掉
vb.net无边框弹窗的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于vb无边框窗体、vb.net无边框弹窗的信息别忘了在本站进行查找喔。






