/* 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 . */ using System; using System.Collections.Generic; using System.Text; using System.Drawing; namespace WindowsFormsCalendar { /// /// Contains basic information about a drawing event for /// public class CalendarRendererEventArgs : EventArgs { #region Events #endregion #region Fields private Calendar _calendar; private Rectangle _clip; private Graphics _graphics; private object _tag; #endregion #region Properties /// /// Gets the calendar where painting /// public Calendar Calendar { get { return _calendar; } } /// /// Gets the clip of the paint event /// public Rectangle ClipRectangle { get { return _clip; } } /// /// Gets the device where to paint /// public Graphics Graphics { get { return _graphics; } } /// /// Gets or sets a tag for the event /// public object Tag { get { return _tag; } set { _tag = value; } } #endregion /// /// Use it wisely just to initialize some stuff /// 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; } /// /// Creates a new /// /// Calendar where painting /// The graphics. /// The clip rectangle. 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; } } /// /// Creates a new /// /// Calendar where painting /// The graphics. /// The clip rectangle. /// The tag. 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; } } /// /// Copies the parameters from the specified /// /// The instance containing the event data. 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 } }