設(shè)置窗體的text為空,設(shè)置窗體的controlbox屬性為false,設(shè)置窗體的FormBorderStyle 屬性為Sizable,就可以改變窗體大小了,并且可以在任務(wù)欄點(diǎn)擊。
成都創(chuàng)新互聯(lián)公司是一家專業(yè)的成都網(wǎng)站建設(shè)公司,我們專注網(wǎng)站設(shè)計(jì)、成都做網(wǎng)站、網(wǎng)絡(luò)營銷、企業(yè)網(wǎng)站建設(shè),買友情鏈接,一元廣告為企業(yè)客戶提供一站式建站解決方案,能帶給客戶新的互聯(lián)網(wǎng)理念。從網(wǎng)站結(jié)構(gòu)的規(guī)劃UI設(shè)計(jì)到用戶體驗(yàn)提高,創(chuàng)新互聯(lián)力求做到盡善盡美。
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
當(dāng)用戶按下左鍵時(shí),為按下對象的MouseMove事件綁定處理方法,并記錄鼠標(biāo)坐標(biāo)(窗體左上角為原點(diǎn),在事件的MouseEventArgs類型的e參數(shù)中提供)。此時(shí)用戶移動鼠標(biāo),保持窗體原點(diǎn)與鼠標(biāo)新坐標(biāo)的相對位置不變。當(dāng)用戶釋放左鍵時(shí),撤銷按下對象的MouseMove事件處理方法