設(shè)置窗體的text為空,設(shè)置窗體的controlbox屬性為false,設(shè)置窗體的FormBorderStyle 屬性為Sizable,就可以改變窗體大小了,并且可以在任務(wù)欄點擊。
創(chuàng)新互聯(lián)公司為企業(yè)級客戶提高一站式互聯(lián)網(wǎng)+設(shè)計服務(wù),主要包括成都網(wǎng)站設(shè)計、成都網(wǎng)站建設(shè)、成都app軟件開發(fā)、成都小程序開發(fā)、宣傳片制作、LOGO設(shè)計等,幫助客戶快速提升營銷能力和企業(yè)形象,創(chuàng)新互聯(lián)各部門都有經(jīng)驗豐富的經(jīng)驗,可以確保每一個作品的質(zhì)量和創(chuàng)作周期,同時每年都有很多新員工加入,為我們帶來大量新的創(chuàng)意。
當(dāng)用戶按下左鍵時,為按下對象的MouseMove事件綁定處理方法,并記錄鼠標(biāo)坐標(biāo)(窗體左上角為原點,在事件的MouseEventArgs類型的e參數(shù)中提供)。此時用戶移動鼠標(biāo),保持窗體原點與鼠標(biāo)新坐標(biāo)的相對位置不變。當(dāng)用戶釋放左鍵時,撤銷按下對象的MouseMove事件處理方法
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 以當(dāng)前鼠標(biāo)位置為基礎(chǔ) 找出目標(biāo)位置 oMoveToPoint = Me PointToScreen(New Point(e X e Y)) 根據(jù)開始位置作出調(diào)整 oMoveToPoint Offset(Me oPointClicked X * _ (Me oPointClicked Y + _ SystemInformation CaptionHeight + _ SystemInformation BorderSize Height) * ) 移動窗體 Me Location = oMoveToPoint End If
lishixinzhi/Article/program/ASP/201311/21755