Torna al Thread
Private Sub DisegnaSettore(ByVal NumFile As Integer, ByVal NumPosti As Integer, ByVal Capienza As Integer, ByVal IDSettore As Long)
Dim idx As Integer, idy As Integer, cLbl As Integer, cLeft As Long, cTop As Long
Dim oPS As PostoSettore, cTot As Long
m_Disegna = True
m_isPPOK = False
Try
Me.Cursor = Cursors.WaitCursor
Application.DoEvents()
Me.Panel2.Controls.Clear()
cTot = NumFile * NumPosti
If cTot > 32767 Then
MsgBox("Numero dei posti da visualizzare maggiore di 32768", vbCritical, "TolSettori")
Exit Sub
End If
ReDim lblPosto(cTot)
m_PostiSettore = Nothing
m_Settori.LoadSettoreBase(CCGlobals.DBAccess, IDSettore)
m_PostiSettore = m_Settori.GetPostiSettore
cLbl = 0
lblPosto(0) = New Label
lblPosto(0).Width = Zoom
lblPosto(0).Height = Zoom
Dim lblPalco As New Label
With lblPalco
.BackColor = Color.FromArgb(128, 255, 255)
.Top = 1
.Left = 4
.Width = Zoom * Me.NumeroPosti
.Height = 20
.TextAlign = ContentAlignment.MiddleCenter
.BorderStyle = BorderStyle.FixedSingle
.Text = "Palcoscenico"
.Visible = True
End With
Me.Panel2.Controls.Add(lblPalco)
For idy = 1 To NumFile
cTop = ((idy - 1) * Zoom) + 4 + lblPalco.Height
For idx = 1 To NumPosti
cLeft = ((idx - 1) * Zoom) + 4
cLbl = cLbl + 1
Dim lbl As New Label
With lbl
.BorderStyle = BorderStyle.FixedSingle
.Left = cLeft
.Top = cTop
.Width = Zoom
.Height = Zoom
.TextAlign = ContentAlignment.MiddleCenter
.Visible = True
.Tag = cLbl
End With
AddHandler lbl.Click, AddressOf LblClick
AddHandler lbl.MouseDown, AddressOf LblMouseDown
AddHandler lbl.MouseMove, AddressOf LblMouseMove
lblPosto(cLbl) = lbl
oPS = m_PostiSettore.Selection(m_Settori.GetPostiSettore.MakeKey(cLbl, idx))
If oPS Is Nothing Then
m_isDefined = False
lblPosto(cLbl).Enabled = False
MostraColore(0, cLbl)
Else
If oPS.Stato = -6 Then
lblPosto(cLbl).Visible = False
End If
m_isDefined = True
MostraColore(oPS.Stato, cLbl)
End If
Me.Panel2.Controls.Add(lbl)
oPS = Nothing
Next
Next
If m_isDefined Then
MostraPostiDefiniti()
Me.TrackBar1.Enabled = True
Else
Me.TrackBar1.Enabled = False
End If
UndefinedSector(m_isDefined)
Catch ex As Exception
MsgBox("!! Errore nel disegno del settore. Contattare l'assistenza segnalando gli estremi dell'anomalia: Manifestazione, Data, Settore", vbExclamation)
Finally
m_Disegna = False
Me.Cursor = Cursors.Default
End Try
End Sub