Initial commit

Added all files from https://sourceforge.net/p/winformscalenda/code/HEAD/tarball
This commit is contained in:
Derek Antrican
2019-04-23 12:29:22 -07:00
parent e7db788c44
commit 9f6dc416fd
56 changed files with 12079 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
/*
Copyright 2012 Justin LeCheminant
This file is part of WindowsFormsCalendar.
indowsFormsCalendar is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
indowsFormsCalendar is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with indowsFormsCalendar. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace WindowsFormsCalendar
{
/// <summary>
/// Event data with a <see cref="CalendarDay"/> element
/// </summary>
public class CalendarDayEventArgs
:EventArgs
{
/// <summary>
/// Creates a new event with the specified day
/// </summary>
/// <param name="day">Day of the event</param>
public CalendarDayEventArgs(CalendarDay day)
{
_calendarDay = day;
}
#region Props
private CalendarDay _calendarDay;
/// <summary>
/// Gets the day related to the event
/// </summary>
public CalendarDay CalendarDay
{
get { return _calendarDay; }
}
#endregion
}
}

View File

@@ -0,0 +1,57 @@
/*
Copyright 2012 Justin LeCheminant
This file is part of WindowsFormsCalendar.
indowsFormsCalendar is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
indowsFormsCalendar is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with indowsFormsCalendar. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
namespace WindowsFormsCalendar
{
/// <summary>
/// Event arguments for calendar cancel item event
/// </summary>
public class CalendarItemCancelEventArgs
: CancelEventArgs
{
/// <summary>
/// Creates a new <see cref="CalendarItemEventArgs"/>
/// </summary>
/// <param name="item">Related Item</param>
public CalendarItemCancelEventArgs( CalendarItem item )
{
_item = item;
}
#region Props
private CalendarItem _item;
/// <summary>
/// Gets the <see cref="CalendarItem"/> related to the event
/// </summary>
public CalendarItem Item
{
get { return _item; }
}
#endregion
}
}

View File

@@ -0,0 +1,57 @@
/*
Copyright 2012 Justin LeCheminant
This file is part of WindowsFormsCalendar.
indowsFormsCalendar is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
indowsFormsCalendar is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with indowsFormsCalendar. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
namespace WindowsFormsCalendar
{
/// <summary>
/// Event arguments for the calendar item events.
/// </summary>
public class CalendarItemEventArgs
: EventArgs
{
/// <summary>
/// Creates a new <see cref="CalendarItemEventArgs"/>
/// </summary>
/// <param name="item">Related Item</param>
public CalendarItemEventArgs(CalendarItem item)
{
_item = item;
}
#region Props
private CalendarItem _item;
/// <summary>
/// Gets the <see cref="CalendarItem"/> related to the event
/// </summary>
public CalendarItem Item
{
get { return _item; }
}
#endregion
}
}

View File

@@ -0,0 +1,82 @@
/*
Copyright 2012 Justin LeCheminant
This file is part of WindowsFormsCalendar.
indowsFormsCalendar is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
indowsFormsCalendar is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with indowsFormsCalendar. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace WindowsFormsCalendar
{
/// <summary>
/// Holds data of a Calendar Loading Items of certain date range
/// </summary>
public class CalendarLoadEventArgs
: EventArgs
{
#region Fields
private Calendar _calendar;
private DateTime _dateStart;
private DateTime _dateEnd;
#endregion
/// <summary>
/// Initializes a new instance of the <see cref="CalendarLoadEventArgs"/> class.
/// </summary>
/// <param name="calendar">The calendar.</param>
/// <param name="dateStart">The date start.</param>
/// <param name="dateEnd">The date end.</param>
public CalendarLoadEventArgs(Calendar calendar, DateTime dateStart, DateTime dateEnd)
{
_calendar = calendar;
_dateEnd = dateEnd;
_dateStart = dateStart;
}
#region Props
/// <summary>
/// Gets the calendar that originated the event
/// </summary>
public Calendar Calendar
{
get { return _calendar; }
}
/// <summary>
/// Gets the start date of the load
/// </summary>
public DateTime DateStart
{
get { return _dateStart; }
set { _dateStart = value; }
}
/// <summary>
/// Gets the end date of the load
/// </summary>
public DateTime DateEnd
{
get { return _dateEnd; }
}
#endregion
}
}

View File

@@ -0,0 +1,235 @@
/*
Copyright 2012 Justin LeCheminant
This file is part of WindowsFormsCalendar.
indowsFormsCalendar is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
indowsFormsCalendar is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with indowsFormsCalendar. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
namespace WindowsFormsCalendar
{
/// <summary>
/// Contains information about something's bounds and text to draw on the calendar
/// </summary>
public class CalendarRendererBoxEventArgs
: CalendarRendererEventArgs
{
#region Fields
private Color _backgroundColor;
private Rectangle _bounds;
private Font _font;
private TextFormatFlags _format;
private string _text;
private Color _textColor;
private Size _textSize;
#endregion
/// <summary>
/// Initializes some fields
/// </summary>
private CalendarRendererBoxEventArgs()
{
this.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
this.Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
this.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
this.Graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
}
/// <summary>
/// Initializes a new instance of the <see cref="CalendarRendererBoxEventArgs"/> class.
/// </summary>
/// <param name="original">The <see cref="WindowsFormsCalendar.CalendarRendererEventArgs"/> instance containing the event data.</param>
public CalendarRendererBoxEventArgs(CalendarRendererEventArgs original)
: base(original)
{
Font = original.Calendar.Font;
Format |= TextFormatFlags.Default | TextFormatFlags.WordBreak | TextFormatFlags.PreserveGraphicsClipping;// | TextFormatFlags.WordEllipsis;
TextColor = SystemColors.ControlText;
}
/// <summary>
/// Initializes a new instance of the <see cref="CalendarRendererBoxEventArgs"/> class.
/// </summary>
/// <param name="original">The <see cref="WindowsFormsCalendar.CalendarRendererEventArgs"/> instance containing the event data.</param>
/// <param name="bounds">The bounds.</param>
public CalendarRendererBoxEventArgs(CalendarRendererEventArgs original, Rectangle bounds)
: this(original)
{
Bounds = bounds;
}
/// <summary>
/// Initializes a new instance of the <see cref="CalendarRendererBoxEventArgs"/> class.
/// </summary>
/// <param name="original">The <see cref="WindowsFormsCalendar.CalendarRendererEventArgs"/> instance containing the event data.</param>
/// <param name="bounds">The bounds.</param>
/// <param name="text">The text.</param>
public CalendarRendererBoxEventArgs(CalendarRendererEventArgs original, Rectangle bounds, string text)
: this(original)
{
Bounds = bounds;
Text = text;
}
/// <summary>
/// Initializes a new instance of the <see cref="CalendarRendererBoxEventArgs"/> class.
/// </summary>
/// <param name="original">The <see cref="WindowsFormsCalendar.CalendarRendererEventArgs"/> instance containing the event data.</param>
/// <param name="bounds">The bounds.</param>
/// <param name="text">The text.</param>
/// <param name="flags">The flags.</param>
public CalendarRendererBoxEventArgs(CalendarRendererEventArgs original, Rectangle bounds, string text, TextFormatFlags flags)
: this(original)
{
Bounds = bounds;
Text = text;
Format |= flags;
}
/// <summary>
/// Initializes a new instance of the <see cref="CalendarRendererBoxEventArgs"/> class.
/// </summary>
/// <param name="original">The <see cref="WindowsFormsCalendar.CalendarRendererEventArgs"/> instance containing the event data.</param>
/// <param name="bounds">The bounds.</param>
/// <param name="text">The text.</param>
/// <param name="textColor">Color of the text.</param>
public CalendarRendererBoxEventArgs(CalendarRendererEventArgs original, Rectangle bounds, string text, Color textColor)
: this(original)
{
Bounds = bounds;
Text = text;
TextColor = textColor;
}
/// <summary>
/// Initializes a new instance of the <see cref="CalendarRendererBoxEventArgs"/> class.
/// </summary>
/// <param name="original">The <see cref="WindowsFormsCalendar.CalendarRendererEventArgs"/> instance containing the event data.</param>
/// <param name="bounds">The bounds.</param>
/// <param name="text">The text.</param>
/// <param name="textColor">Color of the text.</param>
/// <param name="flags">The flags.</param>
public CalendarRendererBoxEventArgs(CalendarRendererEventArgs original, Rectangle bounds, string text, Color textColor, TextFormatFlags flags)
: this(original)
{
Bounds = bounds;
Text = text;
TextColor = TextColor;
Format |= flags;
}
/// <summary>
/// Initializes a new instance of the <see cref="CalendarRendererBoxEventArgs"/> class.
/// </summary>
/// <param name="original">The <see cref="WindowsFormsCalendar.CalendarRendererEventArgs"/> instance containing the event data.</param>
/// <param name="bounds">The bounds.</param>
/// <param name="text">The text.</param>
/// <param name="textColor">Color of the text.</param>
/// <param name="backgroundColor">Color of the background.</param>
public CalendarRendererBoxEventArgs(CalendarRendererEventArgs original, Rectangle bounds, string text, Color textColor, Color backgroundColor)
: this(original)
{
Bounds = bounds;
Text = text;
TextColor = TextColor;
BackgroundColor = backgroundColor;
}
#region Props
/// <summary>
/// Gets or sets the background color of the text
/// </summary>
public Color BackgroundColor
{
get { return _backgroundColor; }
set { _backgroundColor = value; }
}
/// <summary>
/// Gets or sets the bounds to draw the text
/// </summary>
public Rectangle Bounds
{
get { return _bounds; }
set { _bounds = value; }
}
/// <summary>
/// Gets or sets the font of the text to be rendered
/// </summary>
public Font Font
{
get { return _font; }
set { _font = value; _textSize = Size.Empty; }
}
/// <summary>
/// Gets or sets the format to draw the text
/// </summary>
public TextFormatFlags Format
{
get { return _format; }
set { _format = value; _textSize = Size.Empty; }
}
/// <summary>
/// Gets or sets the text to draw
/// </summary>
public string Text
{
get { return _text; }
set { _text = value; _textSize = Size.Empty; }
}
/// <summary>
/// Gets the result of measuring the text
/// </summary>
public Size TextSize
{
get
{
if (_textSize.IsEmpty)
{
_textSize = TextRenderer.MeasureText(Text, Font);
}
return _textSize;
}
}
/// <summary>
/// Gets or sets the color to draw the text
/// </summary>
public Color TextColor
{
get { return _textColor; }
set { _textColor = value; }
}
#endregion
#region Methods
#endregion
}
}

View File

@@ -0,0 +1,60 @@
/*
Copyright 2012 Justin LeCheminant
This file is part of WindowsFormsCalendar.
indowsFormsCalendar is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
indowsFormsCalendar is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with indowsFormsCalendar. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace WindowsFormsCalendar
{
/// <summary>
/// Contains information about a day to draw on the calendar
/// </summary>
public class CalendarRendererDayEventArgs
: CalendarRendererEventArgs
{
#region Fields
private CalendarDay _day;
#endregion
/// <summary>
/// Creates a new <see cref="CalendarRendererDayEventArgs"/> object
/// </summary>
/// <param name="original">Orignal object to copy basic paramters</param>
/// <param name="day">Day to render</param>
public CalendarRendererDayEventArgs(CalendarRendererEventArgs original, CalendarDay day)
: base(original)
{
_day = day;
}
#region Props
/// <summary>
/// Gets the day to paint
/// </summary>
public CalendarDay Day
{
get { return _day; }
}
#endregion
}
}

View File

@@ -0,0 +1,171 @@
/*
Copyright 2012 Justin LeCheminant
This file is part of WindowsFormsCalendar.
indowsFormsCalendar is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
indowsFormsCalendar is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with indowsFormsCalendar. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
namespace WindowsFormsCalendar
{
/// <summary>
/// Contains basic information about a drawing event for <see cref="CalendarRenderer"/>
/// </summary>
public class CalendarRendererEventArgs
: EventArgs
{
#region Events
#endregion
#region Fields
private Calendar _calendar;
private Rectangle _clip;
private Graphics _graphics;
private object _tag;
#endregion
#region Properties
/// <summary>
/// Gets the calendar where painting
/// </summary>
public Calendar Calendar
{
get { return _calendar; }
}
/// <summary>
/// Gets the clip of the paint event
/// </summary>
public Rectangle ClipRectangle
{
get { return _clip; }
}
/// <summary>
/// Gets the device where to paint
/// </summary>
public Graphics Graphics
{
get { return _graphics; }
}
/// <summary>
/// Gets or sets a tag for the event
/// </summary>
public object Tag
{
get { return _tag; }
set { _tag = value; }
}
#endregion
/// <summary>
/// Use it wisely just to initialize some stuff
/// </summary>
protected CalendarRendererEventArgs()
{
this.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
this.Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
this.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
this.Graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
}
/// <summary>
/// Creates a new <see cref="CalendarRendererEventArgs"/>
/// </summary>
/// <param name="calendar">Calendar where painting</param>
/// <param name="graphics">The graphics.</param>
/// <param name="clipRectangle">The clip rectangle.</param>
public CalendarRendererEventArgs( Calendar calendar, Graphics graphics, Rectangle clipRectangle )
{
_calendar = calendar;
_graphics = graphics;
_clip = clipRectangle;
if( _graphics != null )
{
_graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
_graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
_graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
_graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
}
}
/// <summary>
/// Creates a new <see cref="CalendarRendererEventArgs"/>
/// </summary>
/// <param name="calendar">Calendar where painting</param>
/// <param name="graphics">The graphics.</param>
/// <param name="clipRectangle">The clip rectangle.</param>
/// <param name="tag">The tag.</param>
public CalendarRendererEventArgs( Calendar calendar, Graphics graphics, Rectangle clipRectangle, object tag )
{
_calendar = calendar;
_graphics = graphics;
_clip = clipRectangle;
_tag = tag;
if( _graphics != null )
{
_graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
_graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
_graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
_graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
}
}
/// <summary>
/// Copies the parameters from the specified <see cref="CalendarRendererEventArgs"/>
/// </summary>
/// <param name="original">The <see cref="WindowsFormsCalendar.CalendarRendererEventArgs"/> instance containing the event data.</param>
public CalendarRendererEventArgs( CalendarRendererEventArgs original )
{
_calendar = original.Calendar;
_graphics = original.Graphics;
_clip = original.ClipRectangle;
_tag = original.Tag;
if( _graphics != null )
{
_graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
_graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
_graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
_graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
}
}
#region Public Methods
#endregion
#region Private Methods
#endregion
}
}

View File

@@ -0,0 +1,100 @@
/*
Copyright 2012 Justin LeCheminant
This file is part of WindowsFormsCalendar.
indowsFormsCalendar is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
indowsFormsCalendar is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with indowsFormsCalendar. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
namespace WindowsFormsCalendar
{
/// <summary>
/// Event arguments for calendar renter item bounds
/// </summary>
public class CalendarRendererItemBoundsEventArgs
: CalendarRendererItemEventArgs
{
#region Fields
private Rectangle _bounds;
private bool _isFirst;
private bool _isLast;
#endregion
#region Properties
/// <summary>
/// Gets the bounds of the item to be rendered.
/// </summary>
/// <remarks>
/// Items may have more than one bounds due to week segmentation.
/// </remarks>
public Rectangle Bounds
{
get { return _bounds; }
}
/// <summary>
/// Gets a value indicating if the bounds are the first of the item.
/// </summary>
/// <remarks>
/// Items may have more than one bounds due to week segmentation.
/// </remarks>
public bool IsFirst
{
get { return _isFirst; }
}
/// <summary>
/// Gets a value indicating if the bounds are the last of the item.
/// </summary>
/// <remarks>
/// Items may have more than one bounds due to week segmentation.
/// </remarks>
public bool IsLast
{
get { return _isLast; }
set { _isLast = value; }
}
#endregion
/// <summary>
/// Creates a new Event
/// </summary>
/// <param name="original"></param>
/// <param name="bounds"></param>
/// <param name="isFirst"></param>
/// <param name="isLast"></param>
internal CalendarRendererItemBoundsEventArgs(CalendarRendererItemEventArgs original, Rectangle bounds, bool isFirst, bool isLast)
: base(original, original.Item)
{
_isFirst = isFirst;
_isLast = isLast;
_bounds = bounds;
this.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
this.Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
this.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
this.Graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
}
}
}

View File

@@ -0,0 +1,66 @@
/*
Copyright 2012 Justin LeCheminant
This file is part of WindowsFormsCalendar.
indowsFormsCalendar is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
indowsFormsCalendar is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with indowsFormsCalendar. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace WindowsFormsCalendar
{
/// <summary>
/// Contains information to render an item
/// </summary>
public class CalendarRendererItemEventArgs
: CalendarRendererEventArgs
{
#region Fields
private CalendarItem _item;
#endregion
#region Properties
/// <summary>
/// Gets the Item being rendered
/// </summary>
public CalendarItem Item
{
get { return _item; }
}
#endregion
/// <summary>
/// Initializes a new instance of the <see cref="CalendarRendererItemEventArgs"/> class.
/// </summary>
/// <param name="original">The <see cref="WindowsFormsCalendar.CalendarRendererEventArgs"/> instance containing the event data.</param>
/// <param name="item">The item.</param>
public CalendarRendererItemEventArgs( CalendarRendererEventArgs original, CalendarItem item )
: base( original )
{
_item = item;
this.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
this.Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
this.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
this.Graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
}
}
}

View File

@@ -0,0 +1,77 @@
/*
Copyright 2012 Justin LeCheminant
This file is part of WindowsFormsCalendar.
indowsFormsCalendar is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
indowsFormsCalendar is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with indowsFormsCalendar. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace WindowsFormsCalendar
{
/// <summary>
/// Contains information about a <see cref="CalendarTimeScaleUnit"/> that is about to be painted
/// </summary>
public class CalendarRendererTimeUnitEventArgs
: CalendarRendererEventArgs
{
#region Events
#endregion
#region Fields
private CalendarTimeScaleUnit _unit;
#endregion
#region Properties
/// <summary>
/// Gets the unit that is about to be painted
/// </summary>
public CalendarTimeScaleUnit Unit
{
get { return _unit; }
}
#endregion
/// <summary>
/// Initializes a new instance of the <see cref="CalendarRendererTimeUnitEventArgs"/> class.
/// </summary>
/// <param name="original">The <see cref="WindowsFormsCalendar.CalendarRendererEventArgs"/> instance containing the event data.</param>
/// <param name="unit">The unit.</param>
public CalendarRendererTimeUnitEventArgs(CalendarRendererEventArgs original, CalendarTimeScaleUnit unit)
: base(original)
{
_unit = unit;
this.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
this.Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
this.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
this.Graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
}
#region Public Methods
#endregion
#region Private Methods
#endregion
}
}

View File

@@ -0,0 +1,215 @@
/*
Copyright 2012 Justin LeCheminant
This file is part of WindowsFormsCalendar.
indowsFormsCalendar is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
indowsFormsCalendar is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with indowsFormsCalendar. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
namespace WindowsFormsCalendar
{
/// <summary>
/// Holds data about a box of text to be rendered on the month view
/// </summary>
public class MonthViewBoxEventArgs
{
#region Fields
private Graphics _graphics;
private Color _textColor;
private Color _backgroundColor;
private string _text;
private Color _borderColor;
private Rectangle _bounds;
private Font _font;
private TextFormatFlags _TextFlags;
#endregion
#region Properties
/// <summary>
/// Gets or sets the bounds of the box
/// </summary>
public Rectangle Bounds
{
get { return _bounds; }
}
/// <summary>
/// Gets or sets the font of the text. If null, default will be used.
/// </summary>
public Font Font
{
get { return _font; }
set { _font = value; }
}
/// <summary>
/// Gets or sets the Graphics object where to draw
/// </summary>
public Graphics Graphics
{
get { return _graphics; }
}
/// <summary>
/// Gets or sets the border color of the box
/// </summary>
public Color BorderColor
{
get { return _borderColor; }
set { _borderColor = value; }
}
/// <summary>
/// Gets or sets the text of the box
/// </summary>
public string Text
{
get { return _text; }
set { _text = value; }
}
/// <summary>
/// Gets or sets the background color of the box
/// </summary>
public Color BackgroundColor
{
get { return _backgroundColor; }
set { _backgroundColor = value; }
}
/// <summary>
/// Gets or sets the text color of the box
/// </summary>
public Color TextColor
{
get { return _textColor; }
set { _textColor = value; }
}
/// <summary>
/// Gets or sets the flags of the text
/// </summary>
public TextFormatFlags TextFlags
{
get { return _TextFlags; }
set { _TextFlags = value; }
}
#endregion
/// <summary>
/// Initializes a new instance of the <see cref="MonthViewBoxEventArgs"/> class.
/// </summary>
/// <param name="graphics">The graphics.</param>
/// <param name="bounds">The bounds.</param>
/// <param name="text">The text.</param>
/// <param name="textAlign">The text align.</param>
/// <param name="textColor">Color of the text.</param>
/// <param name="backColor">Color of the back.</param>
/// <param name="borderColor">Color of the border.</param>
internal MonthViewBoxEventArgs( Graphics graphics, Rectangle bounds, string text, StringAlignment textAlign, Color textColor, Color backColor, Color borderColor )
{
_graphics = graphics;
_graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
_graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
_graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
_graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
_bounds = bounds;
Text = text;
TextColor = textColor;
BackgroundColor = backColor;
BorderColor = borderColor;
switch( textAlign )
{
case StringAlignment.Center:
TextFlags |= TextFormatFlags.HorizontalCenter;
break;
case StringAlignment.Far:
TextFlags |= TextFormatFlags.Right;
break;
case StringAlignment.Near:
TextFlags |= TextFormatFlags.Left;
break;
default:
break;
}
TextFlags |= TextFormatFlags.VerticalCenter;
}
/// <summary>
/// Initializes a new instance of the <see cref="MonthViewBoxEventArgs"/> class.
/// </summary>
/// <param name="graphics">The graphics.</param>
/// <param name="bounds">The bounds.</param>
/// <param name="text">The text.</param>
/// <param name="textColor">Color of the text.</param>
internal MonthViewBoxEventArgs( Graphics graphics, Rectangle bounds, string text, Color textColor )
: this( graphics, bounds, text, StringAlignment.Center, textColor, Color.Empty, Color.Empty )
{ }
/// <summary>
/// Initializes a new instance of the <see cref="MonthViewBoxEventArgs"/> class.
/// </summary>
/// <param name="graphics">The graphics.</param>
/// <param name="bounds">The bounds.</param>
/// <param name="text">The text.</param>
/// <param name="textColor">Color of the text.</param>
/// <param name="backColor">Color of the back.</param>
internal MonthViewBoxEventArgs( Graphics graphics, Rectangle bounds, string text, Color textColor, Color backColor )
: this( graphics, bounds, text, StringAlignment.Center, textColor, backColor, Color.Empty )
{ }
/// <summary>
/// Initializes a new instance of the <see cref="MonthViewBoxEventArgs"/> class.
/// </summary>
/// <param name="graphics">The graphics.</param>
/// <param name="bounds">The bounds.</param>
/// <param name="text">The text.</param>
/// <param name="textAlign">The text align.</param>
/// <param name="textColor">Color of the text.</param>
/// <param name="backColor">Color of the back.</param>
internal MonthViewBoxEventArgs( Graphics graphics, Rectangle bounds, string text, StringAlignment textAlign, Color textColor, Color backColor )
: this( graphics, bounds, text, textAlign, textColor, backColor, Color.Empty )
{ }
/// <summary>
/// Initializes a new instance of the <see cref="MonthViewBoxEventArgs"/> class.
/// </summary>
/// <param name="graphics">The graphics.</param>
/// <param name="bounds">The bounds.</param>
/// <param name="text">The text.</param>
/// <param name="textAlign">The text align.</param>
/// <param name="textColor">Color of the text.</param>
internal MonthViewBoxEventArgs( Graphics graphics, Rectangle bounds, string text, StringAlignment textAlign, Color textColor )
: this( graphics, bounds, text, textAlign, textColor, Color.Empty, Color.Empty )
{ }
}
}

View File

@@ -0,0 +1,33 @@
/*
Copyright 2012 Justin LeCheminant
This file is part of WindowsFormsCalendar.
indowsFormsCalendar is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
indowsFormsCalendar is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with indowsFormsCalendar. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace WindowsFormsCalendar
{
/// <summary>
/// Month view event argument data
/// </summary>
public class MonthViewMontEventArgs
{
}
}