Controls [vb.net] FlowLayoutPanel 동적 삽입하여 달력 만들기
페이지 정보
본문
Public Class FrmAppoint
Private listFlDay As New List(Of FlowLayoutPanel)
Private Sub FrmAppoint(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim flDays As New FlowLayoutPanel
flDays.Name = "flDays"
flDays.Dock = DockStyle.Fill
Me.Controls.Add(flDays)
GenerateDayPanel(42)
AddLabelDayToFlDay(5)
End Sub
Private Sub GenerateDayPanel(ByVal totalDays As Integer)
Dim flDays As FlowLayoutPanel = Controls("flDays")
flDays.Controls.Clear()
listFlDay.Clear()
For i As Integer = 1 To totalDays
Dim fl As New FlowLayoutPanel
fl.Name = "flDays" & i
fl.Size = New Size(120, 120)
fl.BackColor = Color.FromArgb(100, 0, 0, 255)
fl.BorderStyle = BorderStyle.FixedSingle
flDays.Controls.Add(fl)
listFlDay.Add(fl)
Next
End Sub
Private Sub AddLabelDayToFlDay(ByVal startDay As Integer)
Dim day As Integer = 1
For i As Integer = startDay To listFlDay.Count - 1
Dim lbl As New Label
lbl.Name = "lblDay{i}"
lbl.AutoSize = False
lbl.TextAlign = ContentAlignment.MiddleRight
lbl.Size = New Size(116, 18)
lbl.Text = day
lbl.Font = New Font("Microsoft Sans Serif", 12)
listFlDay(i - 1).Controls.Add(lbl)
day += 1
Next
End Sub
End Class
- 이전글[vb.net] 수학 함수(Visual Basic) 19.09.30
- 다음글[vb.net] DataGridView 외 컨트롤 관련 정리중 19.09.19
댓글목록
등록된 댓글이 없습니다.