2022/02/13(Sun) 14:30:23 編集(投稿者)
手前に透過ウインドウを置くとか。
Private TransparentWindow As Form
Private Sub MDIParent1_Shown(sender As Object, e As EventArgs) Handles Me.Shown
TransparentWindow = New Form With {
.ControlBox = False,
.FormBorderStyle = FormBorderStyle.None,
.Bounds = Me.Bounds,
.BackColor = Color.White,
.TransparencyKey = Color.White,
.ShowInTaskbar = False
}
TransparentWindow.Show(Me)
AddHandler TransparentWindow.Paint, AddressOf TransparentWindow_Paint
Me.Activate()
End Sub
Private Sub TransparentWindow_Paint(sender As Object, ByVal e As PaintEventArgs)
e.Graphics.DrawLine(Pens.Red, New Point(100, 100), New Point(200, 200))
End Sub
Private Sub MDIParent1_LocationChanged(sender As Object, e As EventArgs) Handles Me.LocationChanged
If TransparentWindow IsNot Nothing Then
TransparentWindow.Location = Me.Location
End If
End Sub
Private Sub MDIParent1_SizeChanged(sender As Object, e As EventArgs) Handles Me.SizeChanged
If TransparentWindow IsNot Nothing Then
TransparentWindow.Size = Me.Size
End If
End Sub