我正在尝试修改月历,但在将用户控件添加到表单之前,VS冻结。问题是在无限循环中,但我找不到错误。请帮帮忙
private void SetDayBoxSize()
{
int bottom = this.Height;
while (HitTest(1, dayTop).HitArea != HitArea.Date &&
HitTest(1, dayTop).HitArea != HitArea.PrevMonthDate) dayTop++;
while (HitTest(1, bottom).HitArea != HitArea.Date &&
HitTest(1, bottom).HitArea != HitArea.NextMonthDate) bottom--;
dayBox = new Rectangle();
dayBox.Size = new Size(this.Width / 7, (bottom - dayTop) / 6);
}发布于 2015-08-19 21:52:48
您可以使用以下代码来解决此问题:
private void SetDayBoxSize()
{
int bottom = this.Height;
while (HitTest(25, dayTop).HitArea != HitArea.Date &&
HitTest(25, dayTop).HitArea != HitArea.PrevMonthDate) dayTop++;
while (HitTest(25, bottom).HitArea != HitArea.Date &&
HitTest(25, bottom).HitArea != HitArea.NextMonthDate) bottom--;
dayBox = new Rectangle();
dayBox.Size = new Size(this.Width / 7, (bottom - dayTop) / 6);
}https://stackoverflow.com/questions/15979426
复制相似问题