|
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
namespace System.Windows.Forms.Calendar
{
public class MonthViewDay
{
#region Fields
Rectangle _bounds;
private DateTime _date;
private MonthViewMonth _month;
private MonthView _monthView;
#endregion
#region Ctor
internal MonthViewDay(MonthViewMonth month, DateTime date)
{
_month = month;
_monthView = month.MonthView;
_date = date;
}
#endregion
#region Props
/// <summary>
/// Gets the parent MonthView
/// </summary>
public MonthView MonthView
{
get { return _monthView; }
set { _monthView = value; }
}
/// <summary>
/// Gets the parent MonthViewMonth
/// </summary>
public MonthViewMonth Month
{
get { return _month; }
}
/// <summary>
/// Gets the bounds of the day
/// </summary>
public Rectangle Bounds
{
get { return _bounds; }
}
/// <summary>
/// Gets the date this day represents
/// </summary>
public DateTime Date
{
get { return _date; }
}
/// <summary>
/// Gets or sets if the day is currently selected
/// </summary>
public bool Selected
{
get { return Date >= MonthView.SelectionStart && Date <= MonthView.SelectionEnd; }
}
/// <summary>
/// Gets if the day is grayed
/// </summary>
public bool Grayed
{
get { return Month.Date.Month != Date.Month; }
}
/// <summary>
/// Gets a value indicating if the day instance is visible on the calendar
/// </summary>
public bool Visible
{
get
{
return !(Grayed && (Date > MonthView.ViewStart && Date < MonthView.ViewEnd));
}
}
#endregion
#region Methods
/// <summary>
/// Sets the value of the <see cref="Bounds"/> property
/// </summary>
/// <param name="bounds"></param>
internal void SetBounds(Rectangle bounds)
{
_bounds = bounds;
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
- I've been programming Windows and Web apps since 1997.
- My greatest concern nowadays is product, user interface, and usability.
- TypeScript / React expert
@geeksplainer