Question border visible first time, second time not

ud2008

Well-known member
Joined
Jul 5, 2010
Messages
148
Programming Experience
Beginner
I create an app, with it when I click a button it opens a new form on a second monitor.
This works perfectly, but every first time the app start and I open the second form, on my primary screen (right side) I see the border of the second form. When I click the button again, the form is hidden, and when I click it again, it appears again but then the border is gone.

What I want is that the border is gone the first time and never appears.

Here is the code I have on the button_click event:
VB.NET:
Private Sub RadButton3_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadButton3.click
        If screen.AllScreens.Length > 1 Then
            If Me.RadButton3.ButtonElement.ButtonFillElement.BackColor = Color.Orange Then
                scfrm.Controls.Add(lab)
                lab.Dock = DockStyle.Fill
                'Show the form on second screen
                screen = screen.AllScreens(1)
                scfrm.StartPosition = FormStartPosition.Manual
                scfrm.Location = screen.Bounds.Location + New Point(100, 100)
                scfrm.Show()
                scfrm.WindowState = FormWindowState.Maximized
                scfrm.FormBorderStyle = Windows.Forms.FormBorderStyle.None
                scfrm.BackgroundImage = System.Drawing.Image.FromFile(My.Settings.bgImage)
                RadButton2.Enabled = True
                RadButton1.Enabled = True
            Else
                scfrm.Hide()
                ButtonItem16.Checked = False
                RadButton2.Text = "Black Screen"
                lab.Text = ""
                RadButton2.Enabled = False
                RadButton1.Enabled = False
            End If
        Else
            MsgBox("No extended screen found, dual video needs an extended screen.")
            ButtonItem16.Checked = False
            Me.RadButton3.ButtonElement.ButtonFillElement.BackColor = Color.Transparent
            RadButton3.Text = "Open Beamer"
            lab.Text = ""
            RadButton2.Enabled = False
            RadButton1.Enabled = False
        End If
    End Sub

Any help would be great.
 
Back
Top