FormWindowState Code Appear to Stop 'Call' from working

  • Thread starter Thread starter gtx_viper
  • Start date Start date
G

gtx_viper

Guest
I call on the sub "Call LoadMap()" in two buttons and in 2 events.

It works in every instance except for in the sub "btn_ToggleScreen_Click"

It is meant to refresh the loadmap code but doesn't... it clears the picturebox

Can you please look at the code and make a suggestion as to where I am going wrong...


Public Class frm_Map

Public FullScreenStatus As Boolean = False
Public BrushRed As New System.Drawing.SolidBrush(System.Drawing.Color.Red)
Public BrushBlue As New System.Drawing.SolidBrush(System.Drawing.Color.Blue)
Public DrawStyle = BrushRed

Private Sub frm_Map_ResizeEnd(sender As Object, e As EventArgs) Handles Me.ResizeEnd
Call LoadMap()
End Sub

Private Sub btn_LoadMap_Click(sender As Object, e As EventArgs) Handles btn_LoadMapClearMap.Click

Call LoadMap()

End Sub

Private Sub btn_ToggleScreen_Click(sender As Object, e As EventArgs) Handles btn_ToggleScreen.Click

Call CenterToScreen()

If Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None And Me.WindowState = FormWindowState.Maximized Then
FullScreenStatus = False
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable
Me.WindowState = FormWindowState.Normal
Me.Controls.Item("btn_ToggleScreen").Text = "Full Screen"
Else
FullScreenStatus = True
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
Me.WindowState = FormWindowState.Maximized
Me.Controls.Item("btn_ToggleScreen").Text = "Normal Screen"
End If

'Call LoadMap()

End Sub

Private Sub frm_Map_Resize(sender As Object, e As EventArgs) Handles Me.Resize

Dim FullScreenFudgeFactor_Width As Integer : FullScreenFudgeFactor_Width = 0
Dim FullScreenFudgeFactor_Height As Integer : FullScreenFudgeFactor_Height = 0

If FullScreenStatus = True Then
FullScreenFudgeFactor_Width = 18
FullScreenFudgeFactor_Height = 40
End If

pbx_Map.Width = Me.Width - 150 + FullScreenFudgeFactor_Width
pbx_Map.Height = Me.Height - 50 + FullScreenFudgeFactor_Height

End Sub

Private Sub LoadMap()

Dim DrawEntity As System.Drawing.Graphics
Dim DrawEntity_X As Integer
Dim DrawEntity_Y As Integer
Dim DrawEntity_Dia As Integer

'Name, X, Y, Dia, ProbeType
'DrillBrushColour, ProbeBrushColour

DrawEntity_X = 10
DrawEntity_Y = 20
DrawEntity_Dia = 10

DrawEntity = pbx_Map.CreateGraphics
DrawEntity.FillEllipse(DrawStyle, DrawEntity_X, DrawEntity_Y, DrawEntity_Dia, DrawEntity_Dia)

End Sub

Private Sub btn_ToggleViewType_Click(sender As Object, e As EventArgs) Handles btn_ToggleViewType.Click

If Me.Controls.Item("btn_ToggleViewType").Text = "View By Drill Size" Then
Me.Controls.Item("btn_ToggleViewType").Text = "View By Probe Type"
DrawStyle = BrushBlue
Else
Me.Controls.Item("btn_ToggleViewType").Text = "View By Drill Size"
DrawStyle = BrushRed
End If

Call LoadMap()

End Sub
Private Sub btn_End_Click(sender As Object, e As EventArgs) Handles btn_Exit.Click
End
End Sub

End Class

Continue reading...
 
Back
Top