Imports System Drawing Imports System Windows Forms ****************************************** Private oOriginalRegion As Region = Nothing 用于窗體移動(dòng) 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 以當(dāng)前鼠標(biāo)位置為基礎(chǔ) 找出目標(biāo)位置 oMoveToPoint = Me PointToScreen(New Point(e X e Y)) 根據(jù)開(kāi)始位置作出調(diào)整 oMoveToPoint Offset(Me oPointClicked X * _ (Me oPointClicked Y + _ SystemInformation CaptionHeight + _ SystemInformation BorderSize Height) * ) 移動(dòng)窗體 Me Location = oMoveToPoint End If
創(chuàng)新互聯(lián)公司主營(yíng)昌圖網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營(yíng)網(wǎng)站建設(shè)方案,app開(kāi)發(fā)定制,昌圖h5重慶小程序開(kāi)發(fā)公司搭建,昌圖網(wǎng)站營(yíng)銷推廣歡迎昌圖等地區(qū)企業(yè)咨詢
lishixinzhi/Article/program/ASP/201311/21755
軟件bug。vb.net創(chuàng)建是會(huì)有窗體進(jìn)行應(yīng)用的,沒(méi)有應(yīng)用就是軟件bug原因,需要用戶將軟件關(guān)閉,點(diǎn)擊系統(tǒng)修復(fù)下載,再打開(kāi)軟件即可。
把窗體的 Opacity 設(shè)為 0
ShowInTaskbar設(shè)為 False
或者不用窗體,做成控制臺(tái)程序
VB6.0寫(xiě)的,代碼很簡(jiǎn)單,無(wú)意中寫(xiě)成的。應(yīng)該可以參考。不需要任何api函數(shù)。在無(wú)邊框窗體頂部中放入一個(gè)label標(biāo)簽。然后用label的 mouse down 和mouse move事件實(shí)現(xiàn)
Dim a, b As Single
Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
a = X
b = Y
End Sub
Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Form1.Move Left + X - a, Top + Y - b
End If
End Sub
vb.net鎖定除頂級(jí)窗體以外的操作步驟如下:
1、通過(guò)Show方法,用以顯示MDIForm或Form對(duì)象。
2、當(dāng)Show在顯示無(wú)模式窗體時(shí),隨后遇到的代碼則要執(zhí)行。
3、當(dāng)Show在顯示模式窗體時(shí),則隨后的代碼直到該窗體被隱藏或卸載時(shí)執(zhí)行即可。
設(shè)置窗體的text為空,設(shè)置窗體的controlbox屬性為false,設(shè)置窗體的FormBorderStyle 屬性為Sizable,就可以改變窗體大小了,并且可以在任務(wù)欄點(diǎn)擊。