单击TextBox(MetroTextBox)时是否可以显示datetimepicker?那么我想要做的是当我单击TextBox时,它将在文本框上方或文本框下方显示datetimepicker然后如果我选择某个日期,它将在文本框中显示日期。
我以此为基础,但我无法使其发挥作用。
答案 0 :(得分:0)
我使用MonthCalendar而不是DTP来达到我想要的结果。
这里是其他人想要相同输出的未来参考代码。谢谢,和平!...
Private Sub NotificationV2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
MonthCalendar1.BringToFront()
MonthCalendar1.Location = New Point(265, 160)
MonthCalendar1.Visible = False
End Sub
Private Sub MetroTextBox8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MetroTextBox8.Click
MonthCalendar1.Visible = Not MonthCalendar1.Visible
End Sub
Private Sub MonthCalendar1_DateSelected(ByVal sender As Object, ByVal e As System.Windows.Forms.DateRangeEventArgs) Handles MonthCalendar1.DateSelected
MonthCalendar1.Visible = False
MetroTextBox8.Text = e.Start.ToShortDateString
End Sub