case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
return 31 ;
case 4:
case 6:
case 9:
case 11:
return 30 ;
default:
return 31 ;
}
}
private void SetRightFmt()
{
if (IsNull())
EmptyInput() ;
else
{
SetRightMonthDay() ;
}
this.Refresh() ;
}
private void SetRightMonthDay()
{
int MaxDay = GetThisMonthMaxDay() ;
int Day = int.Parse(tbDay.Text) ;
if (Day > MaxDay)
tbDay.Text = MaxDay.ToString() ;
}
private void IncDecDate(int iSign)
{
string strYear = tbYear.Text ;
if (strYear == "")
strYear = DateTime.Now.Year.ToString() ;
string strMonth = tbMonth.Text ;
if (strMonth == "")
strMonth = DateTime.Now.Month.ToString() ;
string strDay = tbDay.Text ;
if (strDay == "")
strDay = DateTime.Now.Day.ToString() ;
string strDate = strYear +"-"+ strMonth +"-" +strDay ;
DateTime dtOld = DateTime.Parse(strDate) ;
if (tbYear.Focused)
{
this.Value = dtOld.AddYears(1*iSign) ;
}
else if (tbMonth.Focused)
{
this.Value = dtOld.AddMonths(1*iSign) ;
}
else
{
this.Value = dtOld.AddDays(1*iSign) ;
}
}
private Form GetWindow()
{
Control con = this ;
while(!(con.Parent is Form))
con = con.Parent ;
return (Form)con.Parent ;
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
