可以使用API ClipCursor,如果你不嫌麻烦的话。

以下方法:

    Private Sub Form1_MouseDown(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
        Dim X, Y As Integer
        Dim loc As System.Drawing.Point = Me.Location + Me.MonthCalendar1.Location
        X = (Me.Width - Me.ClientRectangle.Width) / 2
        Y = (Me.Height - Me.ClientRectangle.Height - SystemInformation.CaptionHeight) / 2 + SystemInformation.CaptionHeight
        loc.X = loc.X + X
        loc.Y = loc.Y + Y

        System.Windows.Forms.Cursor.Clip = New Rectangle(loc, Me.MonthCalendar1.Size)
    End Sub

    Private Sub Form1_MouseUp(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseUp
        System.Windows.Forms.Cursor.Clip = System.Windows.Forms.Screen.PrimaryScreen.Bounds
    End Sub
View Code

相关文章:

  • 2022-12-23
  • 2021-12-29
  • 2021-12-05
  • 2022-01-04
  • 2022-12-23
  • 2021-12-14
  • 2022-12-23
  • 2021-05-10
猜你喜欢
  • 2021-08-22
  • 2022-12-23
  • 2021-05-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-11
相关资源
相似解决方案