Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click '一人モード MeAloneOn() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click '通常モード MeAloneOff() End Sub ''' <summary> ''' 自分のフォーム以外を黒くして触れなくする。 ''' この状態を解除するにはMeAloneOffを呼び出す。 ''' </summary> Private Sub MeAloneOn() Dim backForm As New Form ' フォームを黒で半透明に。 backForm.BackColor = Color.Black backForm.Opacity = 0.83 ' タイトルバー消す。 backForm.FormBorderStyle = FormBorderStyle.None ' フォーム最大化 backForm.WindowState = FormWindowState.Maximized Me.Tag = backForm backForm.Show() Me.TopMost = True End Sub ''' <summary>通常モードに戻す</summary> Private Sub MeAloneOff() Dim backForm As Form backForm = CType(Me.Tag, Form) backForm.Close() backForm.Dispose() Me.Tag = Nothing Me.TopMost = False End Sub