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] Form Resize / 폼의 크기가 변할때 발생하는 이벤트 활용법 - 컨트롤 내부 사이즈 19.10.05
- 다음글[vb.net] Controls 화면 업데이트를 중지시키는 방법(Controls ScreenUpdating) 19.09.18
댓글목록
등록된 댓글이 없습니다.