With the following code, I am creating a child form when my main form loads:
Once it loads, the main form doesn't seem to handle the mouseclick event. Is that because the child fom is showing, and somehow IT has to handle the click event (even though I'm not clicking within the boundaries of the child form)?Code:Public Class Form1 Dim cForm As New System.Windows.Forms.Form Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load cForm.MdiParent = Me cForm.BackColor = Color.Yellow cForm.Left = 0 cForm.Top = 0 cForm.ControlBox = False cForm.Width = 20 cForm.Height = Me.Height cForm.Show() End Sub Private Sub Form1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseClick If e.Button = Windows.Forms.MouseButtons.Right Then cform.close() Me.Text = "right mouse button clicked" End If End Sub End Class
Thanks in advance!
Bryce




Reply With Quote