熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> ASP編程 >> 正文

VB.NET 拖動無邊框窗體編程實例

2022-06-13   來源: ASP編程 

  

  Imports SystemDrawing
  Imports SystemWindowsForms
  ******************************************
  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 SystemWindowsFormsMouseEventArgs) Handles MyBaseMouseDown

  MebFormDragging = True
  MeoPointClicked = New Point(eX eY)

  End Sub
  ******************************************

  Private Sub Form_MouseUp(ByVal sender As Object ByVal e As SystemWindowsFormsMouseEventArgs) Handles MyBaseMouseUp
  MebFormDragging = False

  End Sub
  ******************************************

  Private Sub Form_MouseMove(ByVal sender As Object ByVal e As SystemWindowsFormsMouseEventArgs) Handles MyBaseMouseMove
  If MebFormDragging Then
  Dim oMoveToPoint As Point
   以當前鼠標位置為基礎找出目標位置
  oMoveToPoint = MePointToScreen(New Point(eX eY))
   根據開始位置作出調整
  oMoveToPointOffset(MeoPointClickedX * _
  (MeoPointClickedY + _
  SystemInformationCaptionHeight + _
  SystemInformationBorderSizeHeight) * )
   移動窗體
  MeLocation = oMoveToPoint
  End If


From:http://tw.wingwit.com/Article/program/ASP/201311/21755.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.