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

125
TestHarness/Form1.Designer.cs generated Normal file
View File

@@ -0,0 +1,125 @@
namespace TestHarness
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose( bool disposing )
{
if( disposing && ( components != null ) )
{
components.Dispose();
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.monthView1 = new WindowsFormsCalendar.MonthView();
this.calendar1 = new WindowsFormsCalendar.Calendar();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.monthView1);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.AutoScroll = true;
this.splitContainer1.Panel2.AutoScrollMargin = new System.Drawing.Size(5, 5);
this.splitContainer1.Panel2.Controls.Add(this.calendar1);
this.splitContainer1.Size = new System.Drawing.Size(784, 562);
this.splitContainer1.SplitterDistance = 260;
this.splitContainer1.TabIndex = 0;
//
// monthView1
//
this.monthView1.ArrowsColor = System.Drawing.SystemColors.Window;
this.monthView1.ArrowsSelectedColor = System.Drawing.Color.Gold;
this.monthView1.DayBackgroundColor = System.Drawing.Color.Empty;
this.monthView1.DayGrayedText = System.Drawing.SystemColors.GrayText;
this.monthView1.DaySelectedBackgroundColor = System.Drawing.SystemColors.Highlight;
this.monthView1.DaySelectedColor = System.Drawing.SystemColors.WindowText;
this.monthView1.DaySelectedTextColor = System.Drawing.SystemColors.HighlightText;
this.monthView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.monthView1.ItemPadding = new System.Windows.Forms.Padding(2);
this.monthView1.Location = new System.Drawing.Point(0, 0);
this.monthView1.MonthTitleColor = System.Drawing.SystemColors.ActiveCaption;
this.monthView1.MonthTitleColorInactive = System.Drawing.SystemColors.InactiveCaption;
this.monthView1.MonthTitleTextColor = System.Drawing.SystemColors.ActiveCaptionText;
this.monthView1.MonthTitleTextColorInactive = System.Drawing.SystemColors.InactiveCaptionText;
this.monthView1.Name = "monthView1";
this.monthView1.SelectionMode = WindowsFormsCalendar.MonthViewSelection.Week;
this.monthView1.Size = new System.Drawing.Size(260, 562);
this.monthView1.TabIndex = 0;
this.monthView1.Text = "monthView1";
this.monthView1.TodayBorderColor = System.Drawing.Color.Maroon;
this.monthView1.SelectionChanged += new System.EventHandler(this.monthView1_SelectionChanged);
//
// calendar1
//
this.calendar1.AllowDrop = true;
this.calendar1.Dock = System.Windows.Forms.DockStyle.Fill;
this.calendar1.Font = new System.Drawing.Font("Segoe UI", 9F);
this.calendar1.ItemsBackgroundColor = System.Drawing.Color.Red;
this.calendar1.ItemsFont = new System.Drawing.Font("Monotype Corsiva", 12F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.calendar1.ItemsForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192)))));
this.calendar1.Location = new System.Drawing.Point(0, 0);
this.calendar1.Name = "calendar1";
this.calendar1.Size = new System.Drawing.Size(520, 562);
this.calendar1.TabIndex = 0;
this.calendar1.Text = "calendar1";
this.calendar1.LoadItems += new WindowsFormsCalendar.Calendar.CalendarLoadEventHandler(this.calendar1_LoadItems);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(784, 562);
this.Controls.Add(this.splitContainer1);
this.MinimumSize = new System.Drawing.Size(800, 600);
this.Name = "Form1";
this.Text = "Test Harness";
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private WindowsFormsCalendar.MonthView monthView1;
private WindowsFormsCalendar.Calendar calendar1;
private System.Windows.Forms.ToolTip toolTip1;
}
}

70
TestHarness/Form1.cs Normal file
View File

@@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WindowsFormsCalendar;
namespace TestHarness
{
public partial class Form1 : Form
{
#region Fields
private List<CalendarItem> _items = new List<CalendarItem>();
#endregion
/// <summary>
/// Initializes a new instance of the <see cref="Form1"/> class.
/// </summary>
public Form1()
{
InitializeComponent();
CalendarItem item = new CalendarItem( this.calendar1, DateTime.Now, DateTime.Now, "TEST" );
_items.Add( item );
}
#region Calendar Methods
/// <summary>
/// Handles the LoadItems event of the calendar1 control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="WindowsFormsCalendar.CalendarLoadEventArgs"/> instance containing the event data.</param>
private void calendar1_LoadItems( object sender, CalendarLoadEventArgs e )
{
foreach( CalendarItem calendarItem in _items )
{
if( this.calendar1.ViewIntersects( calendarItem ) )
{
this.calendar1.Items.Add( calendarItem );
}
}
}
#endregion
#region Month View Methods
/// <summary>
/// Handles the SelectionChanged event of the monthView1 control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
private void monthView1_SelectionChanged( object sender, EventArgs e )
{
this.calendar1.SetViewRange( this.monthView1.SelectionStart.Date, this.monthView1.SelectionEnd.Date);
}
#endregion
}
}

126
TestHarness/Form1.resx Normal file
View File

@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>54</value>
</metadata>
</root>

21
TestHarness/Program.cs Normal file
View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace TestHarness
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault( false );
Application.Run( new Form1() );
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle( "TestHarness" )]
[assembly: AssemblyDescription( "" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "HP" )]
[assembly: AssemblyProduct( "TestHarness" )]
[assembly: AssemblyCopyright( "Copyright © HP 2012" )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible( false )]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid( "734b7e11-5f67-4701-ae69-c7e558ebdb14" )]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion( "1.0.0.0" )]
[assembly: AssemblyFileVersion( "1.0.0.0" )]

View File

@@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.269
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestHarness.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute( "System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0" )]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute( "Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode" )]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute( global::System.ComponentModel.EditorBrowsableState.Advanced )]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if( ( resourceMan == null ) )
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager( "TestHarness.Properties.Resources", typeof( Resources ).Assembly );
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute( global::System.ComponentModel.EditorBrowsableState.Advanced )]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.269
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestHarness.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute( "Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0" )]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ( (Settings)( global::System.Configuration.ApplicationSettingsBase.Synchronized( new Settings() ) ) );
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{C3A1985B-E396-4125-A176-61C2AEE5A41F}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TestHarness</RootNamespace>
<AssemblyName>TestHarness</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\WindowsFormsCalendar\WindowsFormsCalendar.csproj">
<Project>{25649F08-3046-4891-ADB8-7EA787B57063}</Project>
<Name>WindowsFormsCalendar</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

52
WindowsFormsCalendar.sln Normal file
View File

@@ -0,0 +1,52 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsCalendar", "WindowsFormsCalendar\WindowsFormsCalendar.csproj", "{25649F08-3046-4891-ADB8-7EA787B57063}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestHarness", "TestHarness\TestHarness.csproj", "{C3A1985B-E396-4125-A176-61C2AEE5A41F}"
ProjectSection(ProjectDependencies) = postProject
{25649F08-3046-4891-ADB8-7EA787B57063} = {25649F08-3046-4891-ADB8-7EA787B57063}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9A09091C-9031-48EA-8EB5-C40716E28351}"
ProjectSection(SolutionItems) = preProject
WindowsFormsCalendar\GPL v3.txt = WindowsFormsCalendar\GPL v3.txt
WindowsFormsCalendar\ReadMe.txt = WindowsFormsCalendar\ReadMe.txt
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{25649F08-3046-4891-ADB8-7EA787B57063}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{25649F08-3046-4891-ADB8-7EA787B57063}.Debug|Any CPU.Build.0 = Debug|Any CPU
{25649F08-3046-4891-ADB8-7EA787B57063}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{25649F08-3046-4891-ADB8-7EA787B57063}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{25649F08-3046-4891-ADB8-7EA787B57063}.Debug|x86.ActiveCfg = Debug|Any CPU
{25649F08-3046-4891-ADB8-7EA787B57063}.Release|Any CPU.ActiveCfg = Release|Any CPU
{25649F08-3046-4891-ADB8-7EA787B57063}.Release|Any CPU.Build.0 = Release|Any CPU
{25649F08-3046-4891-ADB8-7EA787B57063}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{25649F08-3046-4891-ADB8-7EA787B57063}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{25649F08-3046-4891-ADB8-7EA787B57063}.Release|x86.ActiveCfg = Release|Any CPU
{C3A1985B-E396-4125-A176-61C2AEE5A41F}.Debug|Any CPU.ActiveCfg = Debug|x86
{C3A1985B-E396-4125-A176-61C2AEE5A41F}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{C3A1985B-E396-4125-A176-61C2AEE5A41F}.Debug|Mixed Platforms.Build.0 = Debug|x86
{C3A1985B-E396-4125-A176-61C2AEE5A41F}.Debug|x86.ActiveCfg = Debug|x86
{C3A1985B-E396-4125-A176-61C2AEE5A41F}.Debug|x86.Build.0 = Debug|x86
{C3A1985B-E396-4125-A176-61C2AEE5A41F}.Release|Any CPU.ActiveCfg = Release|x86
{C3A1985B-E396-4125-A176-61C2AEE5A41F}.Release|Any CPU.Build.0 = Release|x86
{C3A1985B-E396-4125-A176-61C2AEE5A41F}.Release|Mixed Platforms.ActiveCfg = Release|x86
{C3A1985B-E396-4125-A176-61C2AEE5A41F}.Release|Mixed Platforms.Build.0 = Release|x86
{C3A1985B-E396-4125-A176-61C2AEE5A41F}.Release|x86.ActiveCfg = Release|x86
{C3A1985B-E396-4125-A176-61C2AEE5A41F}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,271 @@
/*
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>
/// Provides color information of calendar graphical elements
/// </summary>
public class CalendarColorTable
{
#region Static
/// <summary>
/// Returns the result of combining the specified colors
/// </summary>
/// <param name="c1">First color to combine</param>
/// <param name="c2">Second olor to combine</param>
/// <returns>Average of both colors</returns>
public static Color Combine(Color c1, Color c2)
{
return Color.FromArgb(
(c1.R + c2.R) / 2,
(c1.G + c2.G) / 2,
(c1.B + c2.B) / 2
);
}
/// <summary>
/// Converts the hex formatted color to a <see cref="Color"/>
/// </summary>
/// <param name="hex"></param>
/// <returns></returns>
public static Color FromHex(string hex)
{
if (hex.StartsWith("#"))
hex = hex.Substring(1);
if (hex.Length != 6) throw new Exception("Color not valid");
return Color.FromArgb(
int.Parse(hex.Substring(0, 2), System.Globalization.NumberStyles.HexNumber),
int.Parse(hex.Substring(2, 2), System.Globalization.NumberStyles.HexNumber),
int.Parse(hex.Substring(4, 2), System.Globalization.NumberStyles.HexNumber));
}
#endregion
#region Colors
/// <summary>
/// Background color of calendar
/// </summary>
public Color Background = SystemColors.Control;
/// <summary>
/// Background color of days in even months
/// </summary>
public Color DayBackgroundEven = SystemColors.Control;
/// <summary>
/// Background color of days in odd months
/// </summary>
public Color DayBackgroundOdd = SystemColors.ControlLight;
/// <summary>
/// Background color of selected days
/// </summary>
public Color DayBackgroundSelected = SystemColors.Highlight;
/// <summary>
/// Border of
/// </summary>
public Color DayBorder = SystemColors.ControlDark;
/// <summary>
/// Background color of day headers.
/// </summary>
public Color DayHeaderBackground = Combine(SystemColors.ControlDark, SystemColors.Control);
/// <summary>
/// Color of text of day headers
/// </summary>
public Color DayHeaderText = SystemColors.GrayText;
/// <summary>
/// Color of secondary text in headers
/// </summary>
public Color DayHeaderSecondaryText = SystemColors.GrayText;
/// <summary>
/// Color of border of the top part of the days
/// </summary>
/// <remarks>
/// The DayTop is the zone of the calendar where items that lasts all or more are placed.
/// </remarks>
public Color DayTopBorder = SystemColors.ControlDark;
/// <summary>
/// Color of border of the top parth of the days when selected
/// </summary>
/// <remarks>
/// The DayTop is the zone of the calendar where items that lasts all or more are placed.
/// </remarks>
public Color DayTopSelectedBorder = SystemColors.ControlDark;
/// <summary>
/// Background color of day tops.
/// </summary>
/// <remarks>
/// The DayTop is the zone of the calendar where items that lasts all or more are placed.
/// </remarks>
public Color DayTopBackground = SystemColors.ControlLight;
/// <summary>
/// Background color of selected day tops.
/// </summary>
/// <remarks>
/// The DayTop is the zone of the calendar where items that lasts all or more are placed.
/// </remarks>
public Color DayTopSelectedBackground = SystemColors.Highlight;
/// <summary>
/// Color of items borders
/// </summary>
public Color ItemBorder = SystemColors.ControlText;
/// <summary>
/// Background color of items
/// </summary>
public Color ItemBackground = SystemColors.Window;
/// <summary>
/// Forecolor of items
/// </summary>
public Color ItemText = SystemColors.WindowText;
/// <summary>
/// Color of secondary text on items (Dates and times)
/// </summary>
public Color ItemSecondaryText = SystemColors.GrayText;
/// <summary>
/// Color of items shadow
/// </summary>
public Color ItemShadow = Color.FromArgb(50, Color.Black);
/// <summary>
/// Color of items selected border
/// </summary>
public Color ItemSelectedBorder = SystemColors.Highlight;
/// <summary>
/// Background color of selected items
/// </summary>
public Color ItemSelectedBackground = Combine(SystemColors.Highlight, SystemColors.HighlightText);
/// <summary>
/// Forecolor of selected items
/// </summary>
public Color ItemSelectedText = SystemColors.WindowText;
/// <summary>
/// Background color of week headers
/// </summary>
public Color WeekHeaderBackground = Combine(SystemColors.ControlDark, SystemColors.Control);
/// <summary>
/// Border color of week headers
/// </summary>
public Color WeekHeaderBorder = SystemColors.ControlDark;
/// <summary>
/// Forecolor of week headers
/// </summary>
public Color WeekHeaderText = SystemColors.ControlText;
/// <summary>
/// Forecolor of day names
/// </summary>
public Color WeekDayName = SystemColors.ControlText;
/// <summary>
/// Border color of today day
/// </summary>
public Color TodayBorder = Color.Orange;
/// <summary>
/// Background color of today's DayTop
/// </summary>
public Color TodayTopBackground = Color.Orange;
/// <summary>
/// Color of lines in timescale
/// </summary>
public Color TimeScaleLine = SystemColors.ControlDark;
/// <summary>
/// Color of text representing hours on the timescale
/// </summary>
public Color TimeScaleHours = SystemColors.GrayText;
/// <summary>
/// Color of text representing minutes on the timescale
/// </summary>
public Color TimeScaleMinutes = SystemColors.GrayText;
/// <summary>
/// Background color of time units
/// </summary>
public Color TimeUnitBackground = SystemColors.Control;
/// <summary>
/// Background color of highlighted time units
/// </summary>
public Color TimeUnitHighlightedBackground = Combine(SystemColors.Control, SystemColors.ControlLightLight);
/// <summary>
/// Background color of selected time units
/// </summary>
public Color TimeUnitSelectedBackground = SystemColors.Highlight;
/// <summary>
/// Color of light border of time units
/// </summary>
public Color TimeUnitBorderLight = SystemColors.ControlDark;
/// <summary>
/// Color of dark border of time units
/// </summary>
public Color TimeUnitBorderDark = SystemColors.ControlDarkDark;
/// <summary>
/// Border color of the overflow indicators
/// </summary>
public Color DayOverflowBorder = Color.White;
/// <summary>
/// Background color of the overflow indicators
/// </summary>
public Color DayOverflowBackground = SystemColors.ControlLight;
/// <summary>
/// Background color of selected overflow indicators
/// </summary>
public Color DayOverflowSelectedBackground = Color.Orange;
#endregion
}
}

View File

@@ -0,0 +1,335 @@
/*
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>
/// Represents a day present on the <see cref="Calendar"/> control's view.
/// </summary>
public class CalendarDay
: CalendarSelectableElement
{
#region Static
private Size overflowSize = new Size(16, 16);
private Padding overflowPadding = new Padding(5);
#endregion
#region Events
#endregion
#region Fields
private List<CalendarItem> _containedItems;
private Calendar _calendar;
private DateTime _date;
private CalendarDayTop _dayTop;
private int _index;
private bool _overflowStart;
private bool _overflowEnd;
private bool _overflowStartSelected;
private bool _overlowEndSelected;
private CalendarTimeScaleUnit[] _timeUnits;
#endregion
#region Properties
/// <summary>
/// Gets a list of items contained on the day
/// </summary>
internal List<CalendarItem> ContainedItems
{
get { return _containedItems; }
}
/// <summary>
/// Gets the DayTop of the day, the place where multi-day and all-day items are placed
/// </summary>
public CalendarDayTop DayTop
{
get { return _dayTop; }
}
/// <summary>
/// Gets the bounds of the body of the day (where time-based CalendarItems are placed)
/// </summary>
public Rectangle BodyBounds
{
get
{
return Rectangle.FromLTRB(Bounds.Left, DayTop.Bounds.Bottom, Bounds.Right, Bounds.Bottom);
}
}
/// <summary>
/// Gets the date this day represents
/// </summary>
public override DateTime Date
{
get { return _date; }
}
/// <summary>
/// Gets the bounds of the header of the day
/// </summary>
public Rectangle HeaderBounds
{
get
{
return new Rectangle(Bounds.Left, Bounds.Top, Bounds.Width, Calendar.Renderer.DayHeaderHeight);
}
}
/// <summary>
/// Gets the index of this day on the calendar
/// </summary>
public int Index
{
get { return _index; }
}
/// <summary>
/// Gets a value indicating if the day is specified on the view (See remarks).
/// </summary>
/// <remarks>
/// A day may not be specified on the view, but still present to make up a square calendar.
/// This days should be drawn in a way that indicates it's necessary but unrequested presence.
/// </remarks>
public bool SpecifiedOnView
{
get
{
return Date.CompareTo(Calendar.ViewStart) >= 0 && Date.CompareTo(Calendar.ViewEnd) <= 0;
}
}
/// <summary>
/// Gets the time units contained on the day
/// </summary>
public CalendarTimeScaleUnit[] TimeUnits
{
get { return _timeUnits; }
}
/// <summary>
/// /// <summary>
/// Gets a value indicating if the day contains items not shown through the start of the day
/// </summary>
/// </summary>
public bool OverflowStart
{
get { return _overflowStart; }
}
/// <summary>
/// Gets the bounds of the <see cref="OverflowStart"/> indicator
/// </summary>
public virtual Rectangle OverflowStartBounds
{
get { return new Rectangle(new Point(Bounds.Right - overflowPadding.Right - overflowSize.Width, Bounds.Top + overflowPadding.Top), overflowSize); }
}
/// <summary>
/// Gets a value indicating if the <see cref="OverflowStart"/> indicator is currently selected
/// </summary>
/// <remarks>
/// This value set to <c>true</c> when user hovers the mouse on the <see cref="OverflowStartBounds"/> area
/// </remarks>
public bool OverflowStartSelected
{
get { return _overflowStartSelected; }
}
/// <summary>
/// Gets a value indicating if the day contains items not shown through the end of the day
/// </summary>
public bool OverflowEnd
{
get { return _overflowEnd; }
}
/// <summary>
/// Gets the bounds of the <see cref="OverflowEnd"/> indicator
/// </summary>
public virtual Rectangle OverflowEndBounds
{
get { return new Rectangle(new Point(Bounds.Right - overflowPadding.Right - overflowSize.Width, Bounds.Bottom - overflowPadding.Bottom - overflowSize.Height), overflowSize); }
}
/// <summary>
/// Gets a value indicating if the <see cref="OverflowEnd"/> indicator is currently selected
/// </summary>
/// <remarks>
/// This value set to <c>true</c> when user hovers the mouse on the <see cref="OverflowStartBounds"/> area
/// </remarks>
public bool OverflowEndSelected
{
get { return _overlowEndSelected; }
}
#endregion
/// <summary>
/// Initializes a new instance of the <see cref="CalendarDay"/> class.
/// </summary>
/// <param name="calendar">The calendar.</param>
/// <param name="date">The date.</param>
/// <param name="index">The index.</param>
internal CalendarDay(Calendar calendar, DateTime date, int index)
: base(calendar)
{
_containedItems = new List<CalendarItem>();
_calendar = calendar;
_dayTop = new CalendarDayTop(this);
_date = date;
_index = index;
UpdateUnits();
}
#region Public Methods
/// <summary>
/// Returns a <see cref="System.String"/> that represents this instance.
/// </summary>
/// <returns>
/// A <see cref="System.String"/> that represents this instance.
/// </returns>
public override string ToString()
{
return Date.ToShortDateString();
}
#endregion
#region Private Methods
/// <summary>
/// Adds an item to the <see cref="ContainedItems"/> list if not in yet
/// </summary>
/// <param name="item"></param>
internal void AddContainedItem(CalendarItem item)
{
if (!ContainedItems.Contains(item))
{
ContainedItems.Add(item);
}
}
/// <summary>
/// Sets the value of he <see cref="OverflowEnd"/> property
/// </summary>
/// <param name="overflow">Value of the property</param>
internal void SetOverflowEnd(bool overflow)
{
_overflowEnd = overflow;
}
/// <summary>
/// Sets the value of the <see cref="OverflowEndSelected"/> property
/// </summary>
/// <param name="selected">Value to pass to the property</param>
internal void SetOverflowEndSelected(bool selected)
{
_overlowEndSelected= selected;
}
/// <summary>
/// Sets the value of he <see cref="OverflowStart"/> property
/// </summary>
/// <param name="overflow">Value of the property</param>
internal void SetOverflowStart(bool overflow)
{
_overflowStart = overflow;
}
/// <summary>
/// Sets the value of the <see cref="OverflowStartSelected"/> property
/// </summary>
/// <param name="selected">Value to pass to the property</param>
internal void SetOverflowStartSelected(bool selected)
{
_overflowStartSelected = selected;
}
/// <summary>
/// Updates the value of <see cref="TimeUnits"/> property
/// </summary>
internal void UpdateUnits()
{
int factor = 0;
switch (Calendar.TimeScale)
{
case CalendarTimeScale.SixtyMinutes: factor = 1; break;
case CalendarTimeScale.ThirtyMinutes: factor = 2; break;
case CalendarTimeScale.FifteenMinutes: factor = 4; break;
case CalendarTimeScale.TenMinutes: factor = 6; break;
case CalendarTimeScale.SixMinutes: factor = 10; break;
case CalendarTimeScale.FiveMinutes: factor = 12; break;
default: throw new NotImplementedException("TimeScale not supported");
}
_timeUnits = new CalendarTimeScaleUnit[24 * factor];
int hourSum = 0;
int minSum = 0;
for (int i = 0; i < _timeUnits.Length; i++)
{
_timeUnits[i] = new CalendarTimeScaleUnit(this, i, hourSum, minSum);
minSum += 60 / factor;
if (minSum >= 60)
{
minSum = 0;
hourSum++;
}
}
UpdateHighlights();
}
/// <summary>
/// Updates the highlights of the units
/// </summary>
internal void UpdateHighlights()
{
if (TimeUnits == null)
return;
for (int i = 0; i < TimeUnits.Length; i++)
{
TimeUnits[i].SetHighlighted(TimeUnits[i].CheckHighlighted());
}
}
#endregion
}
}

View File

@@ -0,0 +1,106 @@
/*
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>
/// Represents the top area of a day, where multiday and all day items are stored
/// </summary>
public class CalendarDayTop
: CalendarSelectableElement
{
#region Events
#endregion
#region Fields
private CalendarDay _day;
private List<CalendarItem> _passingItems;
#endregion
#region Properties
/// <summary>
/// Gets the date.
/// </summary>
public override DateTime Date
{
get
{
return new DateTime(Day.Date.Year, Day.Date.Month, Day.Date.Day);
}
}
/// <summary>
/// Gets the Day of this DayTop
/// </summary>
public CalendarDay Day
{
get { return _day; }
}
/// <summary>
/// Gets the list of items passing on this daytop
/// </summary>
public List<CalendarItem> PassingItems
{
get { return _passingItems; }
}
#endregion
/// <summary>
/// Creates a new DayTop for the specified day
/// </summary>
/// <param name="day"></param>
public CalendarDayTop(CalendarDay day)
: base(day.Calendar)
{
_day = day;
_passingItems = new List<CalendarItem>();
}
#region Public Methods
#endregion
#region Private Methods
/// <summary>
/// Adds the passing item.
/// </summary>
/// <param name="item">The item.</param>
internal void AddPassingItem(CalendarItem item)
{
if (!PassingItems.Contains(item))
{
PassingItems.Add(item);
}
}
#endregion
}
}

View File

@@ -0,0 +1,132 @@
/*
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>
/// Represents a range of time that is highlighted as work-time
/// </summary>
public class CalendarHighlightRange
{
#region Events
#endregion
#region Fields
private Calendar _calendar;
private DayOfWeek _dayOfWeek;
private TimeSpan _startTime;
private TimeSpan _endTime;
#endregion
#region Properties
/// <summary>
/// Gets the calendar that this range is assigned to. (If any)
/// </summary>
public Calendar Calendar
{
get { return _calendar; }
}
/// <summary>
/// Gets or sets the day of the week for this range
/// </summary>
public DayOfWeek DayOfWeek
{
get { return _dayOfWeek; }
set { _dayOfWeek = value; Update(); }
}
/// <summary>
/// Gets or sets the start time of the range
/// </summary>
public TimeSpan StartTime
{
get { return _startTime; }
set { _startTime = value; Update(); }
}
/// <summary>
/// Gets or sets the end time of the range
/// </summary>
public TimeSpan EndTime
{
get { return _endTime; }
set { _endTime = value; Update(); }
}
#endregion
/// <summary>
/// Initializes a new instance of the <see cref="CalendarHighlightRange"/> class.
/// </summary>
public CalendarHighlightRange()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CalendarHighlightRange"/> class.
/// </summary>
/// <param name="day">The day.</param>
/// <param name="startTime">The start time.</param>
/// <param name="endTime">The end time.</param>
public CalendarHighlightRange( DayOfWeek day, TimeSpan startTime, TimeSpan endTime )
: this()
{
_dayOfWeek = day;
_startTime = startTime;
_endTime = endTime;
}
#region Public Methods
#endregion
#region Private Methods
/// <summary>
/// Tells the calendar to update the highligts
/// </summary>
private void Update()
{
if (Calendar != null)
{
Calendar.UpdateHighlights();
}
}
/// <summary>
/// Sets the value of the <see cref="Calendar"/> property
/// </summary>
/// <param name="calendar">Calendar that this range belongs to</param>
internal void SetCalendar(Calendar calendar)
{
_calendar = calendar;
}
#endregion
}
}

View File

@@ -0,0 +1,891 @@
/*
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.Drawing.Drawing2D;
namespace WindowsFormsCalendar
{
/// <summary>
/// Represents an item of the calendar with a date and timespan
/// </summary>
/// <remarks>
/// <para>CalendarItem provides a graphical representation of tasks within a date range.</para>
/// </remarks>
public class CalendarItem
: CalendarSelectableElement
{
#region Static
/// <summary>
/// Compares the bounds.
/// </summary>
/// <param name="r1">The r1.</param>
/// <param name="r2">The r2.</param>
/// <returns></returns>
private static int CompareBounds( Rectangle r1, Rectangle r2 )
{
return r1.Top.CompareTo( r2.Top );
}
#endregion
#region Events
#endregion
#region Fields
private Rectangle[] _additionalBounds;
private Color _backgroundColor;
private Color _backgroundColorLighter;
private Color _borderColor;
private DateTime _startDate;
private DateTime _endDate;
private Color _foreColor;
private bool _locked;
private TimeSpan _duration;
private Image _image;
private CalendarItemImageAlign _imageAlign;
private bool _isDragging;
private bool _isEditing;
private bool _isResizingStartDate;
private bool _isResizingEndDate;
private bool _isOnView;
private int _minuteStartTop;
private int _minuteEndTop;
private HatchStyle _pattern;
private Color _patternColor;
private List<CalendarTimeScaleUnit> _unitsPassing;
private List<CalendarDayTop> _topsPassing;
private object _tag;
private string _text;
private Font _font;
#endregion
#region Properties
/// <summary>
/// Gets or sets an array of rectangles containing bounds additional to Bounds property.
/// </summary>
/// <remarks>
/// Items may contain additional bounds because of several graphical occourences, mostly when <see cref="Calendar"/> in
/// <see cref="CalendarDaysMode.Short"/> mode, due to the duration of the item; e.g. when an all day item lasts several weeks,
/// one rectangle for week must be drawn to indicate the presence of the item.
/// </remarks>
public virtual Rectangle[] AditionalBounds
{
get { return _additionalBounds; }
set { _additionalBounds = value; }
}
/// <summary>
/// Gets or sets the a background color for the object. If Color.Empty, renderer default's will be used.
/// </summary>
public Color BackgroundColor
{
get { return _backgroundColor; }
set { _backgroundColor = value; }
}
/// <summary>
/// Gets or sets the lighter background color of the item
/// </summary>
public Color BackgroundColorLighter
{
get { return _backgroundColorLighter; }
set { _backgroundColorLighter = value; }
}
/// <summary>
/// Gets or sets the bordercolor of the item. If Color.Empty, renderer default's will be used.
/// </summary>
public Color BorderColor
{
get { return _borderColor; }
set { _borderColor = value; }
}
/// <summary>
/// Gets the StartDate of the item. Implemented
/// </summary>
public override DateTime Date
{
get
{
return StartDate;
}
}
/// <summary>
/// Gets the day on the <see cref="Calendar"/> where this item ends
/// </summary>
/// <remarks>
/// This day is not necesarily the day corresponding to the day on <see cref="EndDate"/>,
/// since this date can be out of the range of the current view.
/// <para>If Item is not on view date range this property will return null.</para>
/// </remarks>
public CalendarDay DayEnd
{
get
{
if( !IsOnViewDateRange )
{
return null;
}
else if( IsOpenEnd )
{
return Calendar.Days[Calendar.Days.Length - 1];
}
else
{
return Calendar.FindDay( EndDate );
}
}
}
/// <summary>
/// Gets the day on the <see cref="Calendar"/> where this item starts
/// </summary>
/// <remarks>
/// This day is not necesarily the day corresponding to the day on <see cref="StartDate"/>,
/// since start date can be out of the range of the current view.
/// <para>If Item is not on view date range this property will return null.</para>
/// </remarks>
public CalendarDay DayStart
{
get
{
if( !IsOnViewDateRange )
{
return null;
}
else if( IsOpenStart )
{
return Calendar.Days[0];
}
else
{
return Calendar.FindDay( StartDate );
}
}
}
/// <summary>
/// Gets the duration of the item
/// </summary>
public TimeSpan Duration
{
get
{
if( _duration.TotalMinutes == 0 )
{
_duration = EndDate.Subtract( StartDate );
}
return _duration;
}
}
/// <summary>
/// Gets or sets the end time of the item
/// </summary>
public DateTime EndDate
{
get { return _endDate; }
set
{
_endDate = value;
_duration = new TimeSpan( 0, 0, 0 );
ClearPassings();
}
}
/// <summary>
/// Gets the text of the end date
/// </summary>
public virtual string EndDateText
{
get
{
string date = string.Empty;
string time = string.Empty;
if( IsOpenEnd )
{
date = EndDate.ToString( Calendar.ItemsDateFormat );
}
if( ShowEndTime && !EndDate.TimeOfDay.Equals( new TimeSpan( 23, 59, 59 ) ) )
{
time = EndDate.ToString( Calendar.ItemsTimeFormat );
}
return string.Format( "{0} {1}", date, time ).Trim();
}
}
/// <summary>
/// Gets or sets the forecolor of the item. If Color.Empty, renderer default's will be used.
/// </summary>
public Color ForeColor
{
get { return _foreColor; }
set
{
_foreColor = value;
}
}
/// <summary>
/// Gets or sets an image for the item
/// </summary>
public Image Image
{
get { return _image; }
set { _image = value; }
}
/// <summary>
/// Gets or sets the alignment of the image relative to the text
/// </summary>
public CalendarItemImageAlign ImageAlign
{
get { return _imageAlign; }
set { _imageAlign = value; }
}
/// <summary>
/// Gets a value indicating if the item is being dragged
/// </summary>
public bool IsDragging
{
get { return _isDragging; }
}
/// <summary>
/// Gets a value indicating if the item is currently being edited by the user
/// </summary>
public bool IsEditing
{
get { return _isEditing; }
}
/// <summary>
/// Gets a value indicating if the item goes on the DayTop area of the <see cref="CalendarDay"/>
/// </summary>
public bool IsOnDayTop
{
get
{
return StartDate.Day != EndDate.AddSeconds( 1 ).Day;
}
}
/// <summary>
/// Gets a value indicating if the item is currently on view.
/// </summary>
/// <remarks>
/// The item may not be on view because of scrolling
/// </remarks>
public bool IsOnView
{
get { return _isOnView; }
}
/// <summary>
/// Gets a value indicating if the item is on the range specified by <see cref="Calendar.ViewStart"/> and <see cref="Calendar.ViewEnd"/>
/// </summary>
public bool IsOnViewDateRange
{
get
{
//Checks for an intersection of item's dates against calendar dates
DateTime fd = Calendar.Days[0].Date;
DateTime ld = Calendar.Days[Calendar.Days.Length - 1].Date.Add( new TimeSpan( 23, 59, 59 ) );
DateTime sd = StartDate;
DateTime ed = EndDate;
return sd < ld && fd < ed;
}
}
/// <summary>
/// Gets a value indicating if the item's <see cref="StartDate"/> is before the <see cref="Calendar.ViewStart"/> date.
/// </summary>
public bool IsOpenStart
{
get
{
return StartDate.CompareTo( Calendar.Days[0].Date ) < 0;
}
}
/// <summary>
/// Gets a value indicating if the item's <see cref="EndDate"/> is aftter the <see cref="Calendar.ViewEnd"/> date.
/// </summary>
public bool IsOpenEnd
{
get
{
return EndDate.CompareTo( Calendar.Days[Calendar.Days.Length - 1].Date.Add( new TimeSpan( 23, 59, 59 ) ) ) > 0;
}
}
/// <summary>
/// Gets a value indicating if item is being resized by the <see cref="StartDate"/>
/// </summary>
public bool IsResizingStartDate
{
get { return _isResizingStartDate; }
}
/// <summary>
/// Gets a value indicating if item is being resized by the <see cref="EndDate"/>
/// </summary>
public bool IsResizingEndDate
{
get { return _isResizingEndDate; }
}
/// <summary>
/// Gets a value indicating if this item is locked.
/// </summary>
/// <remarks>
/// When an item is locked, the user can't drag it or change it's text
/// </remarks>
public bool Locked
{
get { return _locked; }
set { _locked = value; }
}
/// <summary>
/// Gets the top correspoinding to the ending minute
/// </summary>
public int MinuteEndTop
{
get { return _minuteEndTop; }
}
/// <summary>
/// Gets the top corresponding to the starting minute
/// </summary>
public int MinuteStartTop
{
get { return _minuteStartTop; }
}
/// <summary>
/// Gets or sets the units that this item passes by
/// </summary>
internal List<CalendarTimeScaleUnit> UnitsPassing
{
get { return _unitsPassing; }
set { _unitsPassing = value; }
}
/// <summary>
/// Gets or sets the pattern style to use in the background of item.
/// </summary>
public HatchStyle Pattern
{
get { return _pattern; }
set { _pattern = value; }
}
/// <summary>
/// Gets or sets the pattern's color
/// </summary>
public Color PatternColor
{
get { return _patternColor; }
set { _patternColor = value; }
}
/// <summary>
/// Gets the list of DayTops that this item passes thru
/// </summary>
internal List<CalendarDayTop> TopsPassing
{
get { return _topsPassing; }
}
/// <summary>
/// Gets a value indicating if the item should show the time of the <see cref="StartDate"/>
/// </summary>
public bool ShowStartTime
{
get
{
return IsOpenStart || ( ( this.IsOnDayTop || Calendar.DaysMode == CalendarDaysMode.Short ) && !StartDate.TimeOfDay.Equals( new TimeSpan( 0, 0, 0 ) ) );
}
}
/// <summary>
/// Gets a value indicating if the item should show the time of the <see cref="EndDate"/>
/// </summary>
public virtual bool ShowEndTime
{
get
{
return ( IsOpenEnd ||
( ( this.IsOnDayTop || Calendar.DaysMode == CalendarDaysMode.Short ) && !EndDate.TimeOfDay.Equals( new TimeSpan( 23, 59, 59 ) ) ) ) &&
!( Calendar.DaysMode == CalendarDaysMode.Short && StartDate.Date == EndDate.Date );
}
}
/// <summary>
/// Gets the text of the start date
/// </summary>
public virtual string StartDateText
{
get
{
string date = string.Empty;
string time = string.Empty;
if( IsOpenStart )
{
date = StartDate.ToString( Calendar.ItemsDateFormat );
}
if( ShowStartTime && !StartDate.TimeOfDay.Equals( new TimeSpan( 0, 0, 0 ) ) )
{
time = StartDate.ToString( Calendar.ItemsTimeFormat );
}
return string.Format( "{0} {1}", date, time ).Trim();
}
}
/// <summary>
/// Gets or sets the start time of the item
/// </summary>
public virtual DateTime StartDate
{
get { return _startDate; }
set
{
_startDate = value;
_duration = new TimeSpan( 0, 0, 0 );
ClearPassings();
}
}
/// <summary>
/// Gets or sets a tag object for the item
/// </summary>
public object Tag
{
get { return _tag; }
set { _tag = value; }
}
/// <summary>
/// Gets or sets the text of the item
/// </summary>
public virtual string Text
{
get { return _text; }
set { _text = value; }
}
/// <summary>
/// Gets or sets the font.
/// </summary>
/// <value>
/// The font.
/// </value>
public Font Font
{
get { return _font; }
set { _font = value; }
}
#endregion
/// <summary>
/// Initializes a new instance of the <see cref="CalendarItem"/> class.
/// </summary>
/// <param name="calendar"></param>
public CalendarItem( Calendar calendar )
: base( calendar )
{
_unitsPassing = new List<CalendarTimeScaleUnit>();
_topsPassing = new List<CalendarDayTop>();
_backgroundColor = Color.Empty;
_borderColor = Color.Empty;
_foreColor = Color.Empty;
_backgroundColorLighter = Color.Empty;
_imageAlign = CalendarItemImageAlign.West;
_font = calendar.ItemsFont;
_backgroundColor = calendar.ItemsBackgroundColor;
_foreColor = calendar.ItemsForeColor;
}
/// <summary>
/// Initializes a new instance of the <see cref="CalendarItem"/> class.
/// </summary>
/// <param name="calendar">The calendar.</param>
/// <param name="startDate">The start date.</param>
/// <param name="endDate">The end date.</param>
/// <param name="text">The text.</param>
public CalendarItem( Calendar calendar, DateTime startDate, DateTime endDate, string text )
: this( calendar )
{
StartDate = startDate;
EndDate = endDate;
Text = text;
}
/// <summary>
/// Initializes a new instance of the <see cref="CalendarItem"/> class.
/// </summary>
/// <param name="calendar">The calendar.</param>
/// <param name="startDate">The start date.</param>
/// <param name="duration">The duration.</param>
/// <param name="text">The text.</param>
public CalendarItem( Calendar calendar, DateTime startDate, TimeSpan duration, string text )
: this( calendar, startDate, startDate.Add( duration ), text )
{ }
#region Public Methods
/// <summary>
/// Applies color to background, border, and forecolor, from the specified color.
/// </summary>
/// <param name="color">The color.</param>
public void ApplyColor( Color color )
{
BackgroundColor = color;
BackgroundColorLighter = Color.FromArgb(
color.R + ( 255 - color.R ) / 2 + ( 255 - color.R ) / 3,
color.G + ( 255 - color.G ) / 2 + ( 255 - color.G ) / 3,
color.B + ( 255 - color.B ) / 2 + ( 255 - color.B ) / 3 );
BorderColor = Color.FromArgb(
Convert.ToInt32( Convert.ToSingle( color.R ) * .8f ),
Convert.ToInt32( Convert.ToSingle( color.G ) * .8f ),
Convert.ToInt32( Convert.ToSingle( color.B ) * .8f ) );
int avg = ( color.R + color.G + color.B ) / 3;
if( avg > 255 / 2 )
{
ForeColor = Color.Black;
}
else
{
ForeColor = Color.White;
}
}
/// <summary>
/// Gets all the bounds related to the item.
/// </summary>
/// <returns></returns>
/// <remarks>
/// Items that are broken on two or more weeks may have more than one rectangle bounds.
/// </remarks>
public IEnumerable<Rectangle> GetAllBounds()
{
List<Rectangle> r = new List<Rectangle>( AditionalBounds == null ? new Rectangle[] { } : AditionalBounds );
r.Add( Bounds );
r.Sort( CompareBounds );
return r;
}
/// <summary>
/// Removes all specific coloring for the item.
/// </summary>
public void RemoveColors()
{
BackgroundColor = Color.Empty;
ForeColor = Color.Empty;
BorderColor = Color.Empty;
}
/// <summary>
/// Gets a value indicating if the specified point is in a resize zone of <see cref="StartDate"/>
/// </summary>
/// <param name="point">The point.</param>
/// <returns></returns>
public bool ResizeStartDateZone( Point point )
{
int margin = 4;
List<Rectangle> rects = new List<Rectangle>( GetAllBounds() );
Rectangle first = rects[0];
Rectangle last = rects[rects.Count - 1];
if( IsOnDayTop || Calendar.DaysMode == CalendarDaysMode.Short )
{
return Rectangle.FromLTRB( first.Left, first.Top, first.Left + margin, first.Bottom ).Contains( point );
}
else
{
return Rectangle.FromLTRB( first.Left, first.Top, first.Right, first.Top + margin ).Contains( point );
}
}
/// <summary>
/// Gets a value indicating if the specified point is in a resize zone of <see cref="EndDate"/>
/// </summary>
/// <param name="point">The point.</param>
/// <returns></returns>
public bool ResizeEndDateZone( Point point )
{
int margin = 4;
List<Rectangle> rects = new List<Rectangle>( GetAllBounds() );
Rectangle first = rects[0];
Rectangle last = rects[rects.Count - 1];
if( IsOnDayTop || Calendar.DaysMode == CalendarDaysMode.Short )
{
return Rectangle.FromLTRB( last.Right - margin, last.Top, last.Right, last.Bottom ).Contains( point );
}
else
{
return Rectangle.FromLTRB( last.Left, last.Bottom - margin, last.Right, last.Bottom ).Contains( point );
}
}
/// <summary>
/// Sets the bounds of the item
/// </summary>
/// <param name="rectangle">The rectangle.</param>
public new void SetBounds( Rectangle rectangle )
{
base.SetBounds( rectangle );
}
/// <summary>
/// Indicates if the time of the item intersects with the provided time
/// </summary>
/// <param name="startTime">The start time.</param>
/// <param name="endTime">The end time.</param>
/// <returns></returns>
public bool IntersectsWith( TimeSpan startTime, TimeSpan endTime )
{
Rectangle r1 = Rectangle.FromLTRB( 0, Convert.ToInt32( StartDate.TimeOfDay.TotalMinutes ), 5, Convert.ToInt32( EndDate.TimeOfDay.TotalMinutes ) );
Rectangle r2 = Rectangle.FromLTRB( 0, Convert.ToInt32( startTime.TotalMinutes ), 5, Convert.ToInt32( endTime.TotalMinutes - 1 ) );
return r1.IntersectsWith( r2 );
}
/// <summary>
/// Returns a <see cref="System.String"/> that represents this instance.
/// </summary>
/// <returns>
/// A <see cref="System.String"/> that represents this instance.
/// </returns>
public override string ToString()
{
return string.Format( "{0} - {1}", StartDate.ToShortTimeString(), EndDate.ToShortTimeString() );
}
#endregion
#region Private Methods
/// <summary>
/// Adds bounds for the item
/// </summary>
/// <param name="r"></param>
internal void AddBounds( Rectangle r )
{
if( r.IsEmpty ) throw new ArgumentException( "r can't be empty" );
if( Bounds.IsEmpty )
{
SetBounds( r );
}
else
{
List<Rectangle> rs = new List<Rectangle>( AditionalBounds == null ? new Rectangle[] { } : AditionalBounds );
rs.Add( r );
AditionalBounds = rs.ToArray();
}
}
/// <summary>
/// Adds the specified unit as a passing unit
/// </summary>
/// <param name="calendarTimeScaleUnit"></param>
internal void AddUnitPassing( CalendarTimeScaleUnit calendarTimeScaleUnit )
{
if( !UnitsPassing.Contains( calendarTimeScaleUnit ) )
{
UnitsPassing.Add( calendarTimeScaleUnit );
}
}
/// <summary>
/// Adds the specified <see cref="CalendarDayTop"/> as a passing one
/// </summary>
/// <param name="top"></param>
internal void AddTopPassing( CalendarDayTop top )
{
if( !TopsPassing.Contains( top ) )
{
TopsPassing.Add( top );
}
}
/// <summary>
/// Clears the item's existance off passing units and tops
/// </summary>
internal void ClearPassings()
{
foreach( CalendarTimeScaleUnit unit in UnitsPassing )
{
unit.ClearItemExistance( this );
}
UnitsPassing.Clear();
TopsPassing.Clear();
}
/// <summary>
/// Clears all bounds of the item
/// </summary>
internal void ClearBounds()
{
SetBounds( Rectangle.Empty );
AditionalBounds = new Rectangle[] { };
SetMinuteStartTop( 0 );
SetMinuteEndTop( 0 );
}
/// <summary>
/// It pushes the left and the right to the center of the item
/// to visually indicate start and end time
/// </summary>
internal void FirstAndLastRectangleGapping()
{
if( !IsOpenStart )
SetBounds( Rectangle.FromLTRB( Bounds.Left + Calendar.Renderer.ItemsPadding,
Bounds.Top, Bounds.Right, Bounds.Bottom ) );
if( !IsOpenEnd )
{
if( AditionalBounds != null && AditionalBounds.Length > 0 )
{
Rectangle r = AditionalBounds[AditionalBounds.Length - 1];
AditionalBounds[AditionalBounds.Length - 1] = Rectangle.FromLTRB(
r.Left, r.Top, r.Right - Calendar.Renderer.ItemsPadding, r.Bottom );
}
else
{
Rectangle r = Bounds;
SetBounds( Rectangle.FromLTRB(
r.Left, r.Top, r.Right - Calendar.Renderer.ItemsPadding, r.Bottom ) );
}
}
}
/// <summary>
/// Sets the value of the IsDragging property
/// </summary>
/// <param name="dragging">Value indicating if the item is currently being dragged</param>
internal void SetIsDragging( bool dragging )
{
_isDragging = dragging;
}
/// <summary>
/// Sets the value of the <see cref="IsEditing"/> property
/// </summary>
/// <param name="editing">Value indicating if user is currently being editing</param>
internal void SetIsEditing( bool editing )
{
_isEditing = editing;
}
/// <summary>
/// Sets the value of the <see cref="IsOnView"/> property
/// </summary>
/// <param name="onView">Indicates if the item is currently on view</param>
internal void SetIsOnView( bool onView )
{
_isOnView = onView;
}
/// <summary>
/// Sets the value of the <see cref="IsResizingStartDate"/> property
/// </summary>
/// <param name="resizing"></param>
internal void SetIsResizingStartDate( bool resizing )
{
_isResizingStartDate = resizing;
}
/// <summary>
/// Sets the value of the <see cref="IsResizingEndDate"/> property
/// </summary>
/// <param name="resizing"></param>
internal void SetIsResizingEndDate( bool resizing )
{
_isResizingEndDate = resizing;
}
/// <summary>
/// Sets the value of the <see cref="MinuteStartTop"/> property
/// </summary>
/// <param name="top"></param>
internal void SetMinuteStartTop( int top )
{
_minuteStartTop = top;
}
/// <summary>
/// Sets the value of the <see cref="MinuteEndTop"/> property
/// </summary>
/// <param name="top"></param>
internal void SetMinuteEndTop( int top )
{
_minuteEndTop = top;
}
#endregion
}
}

View File

@@ -0,0 +1,176 @@
/*
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>
/// A collection of calendar items
/// </summary>
public class CalendarItemCollection
: List<CalendarItem>
{
#region Events
#endregion
#region Fields
private Calendar _calendar;
#endregion
#region Properties
/// <summary>
/// Gets the calendar.
/// </summary>
public Calendar Calendar
{
get { return _calendar; }
}
#endregion
/// <summary>
/// Initializes a new instance of the <see cref="CalendarItemCollection"/> class.
/// </summary>
/// <param name="c">The c.</param>
internal CalendarItemCollection( Calendar c )
{
_calendar = c;
}
#region Public Methods
/// <summary>
/// Adds an item to the end of the list
/// </summary>
/// <param name="item">The object to be added to the end of the collection. The value can be null for reference types.</param>
public new void Add( CalendarItem item )
{
base.Add( item ); CollectionChanged();
}
/// <summary>
/// Adds the items of the specified collection to the end of the list.
/// </summary>
/// <param name="items">The items whose elements should be added to the end of the collection. The collection itself cannont be null, but it can contain elements that are null.</param>
public new void AddRange( IEnumerable<CalendarItem> items )
{
base.AddRange( items ); CollectionChanged();
}
/// <summary>
/// Removes all elements from the collection.
/// </summary>
public new void Clear()
{
base.Clear(); CollectionChanged();
}
/// <summary>
/// Inserts an item into the collection at the specified index.
/// </summary>
/// <param name="index">The zero-based index at which item should be inserted.</param>
/// <param name="item">The object to insert. The value can be null for reference types.</param>
public new void Insert( int index, CalendarItem item )
{
base.Insert( index, item ); CollectionChanged();
}
/// <summary>
/// Inserts the items of a collection into this collection at the specified index.
/// </summary>
/// <param name="index">The zero-based index at which the new elements should be inserted.</param>
/// <param name="items"></param>
public new void InsertRange( int index, IEnumerable<CalendarItem> items )
{
base.InsertRange( index, items ); CollectionChanged();
}
/// <summary>
/// Removes the first occurrence of a specific object from the collection.
/// </summary>
/// <param name="item">The item to remove from the collection. The value can be null for reference types.</param>
/// <returns><c>true</c> if item is successfully removed; otherwise, <c>false</c>. This method also returns false if item was not found in the collection.</returns>
public new bool Remove( CalendarItem item )
{
bool result = base.Remove( item );
CollectionChanged();
return result;
}
/// <summary>
/// Removes the item at the specified index of the collection
/// </summary>
/// <param name="index">The zero-based index of the item to remove.</param>
/// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="index"/> is less than 0.
/// -or-
/// <paramref name="index"/> is equal to or greater than <see cref="P:System.Collections.Generic.List`1.Count"/>.
/// </exception>
public new void RemoveAt( int index )
{
base.RemoveAt( index ); CollectionChanged();
}
/// <summary>
/// Removes the all the items that match the conditions defined by the specified predicate.
/// </summary>
/// <param name="match">The Predicate delegate that defines the conditions of the items to remove.</param>
/// <returns>The number of items removed from the collection.</returns>
public new int RemoveAll( Predicate<CalendarItem> match )
{
int result = base.RemoveAll( match );
CollectionChanged();
return result;
}
/// <summary>
/// Removes a range of elements from the collection
/// </summary>
/// <param name="index">The zero-based starting index of the range of items to remove.</param>
/// <param name="count">The number of items to remove</param>
public new void RemoveRange( int index, int count )
{
base.RemoveRange( index, count ); CollectionChanged();
}
#endregion
#region Private Methods
/// <summary>
/// Handles what to do when this collection changes
/// </summary>
private void CollectionChanged()
{
Calendar.Renderer.PerformItemsLayout();
Calendar.Invalidate();
}
#endregion
}
}

View File

@@ -0,0 +1,130 @@
/*
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>
/// Implements a basic <see cref="ICalendarSelectableElement"/>
/// </summary>
public abstract class CalendarSelectableElement
: ICalendarSelectableElement
{
#region Fields
private Calendar _calendar;
private Rectangle _bounds;
private DateTime _date;
private bool _selected;
#endregion
/// <summary>
/// Initializes a new instance of the <see cref="CalendarSelectableElement"/> class.
/// </summary>
/// <param name="calendar">The calendar.</param>
public CalendarSelectableElement(Calendar calendar)
{
if (calendar == null) throw new ArgumentNullException("calendar");
_calendar = calendar;
}
#region ICalendarSelectableElement Members
/// <summary>
/// Gets the calendar
/// </summary>
public virtual DateTime Date
{
get { return _date; }
}
/// <summary>
/// Gets the Calendar this element belongs to
/// </summary>
public virtual Calendar Calendar
{
get { return _calendar; }
}
/// <summary>
/// Gets the Bounds of the element on the <see cref="Calendar"/> window
/// </summary>
public virtual Rectangle Bounds
{
get { return _bounds; }
}
/// <summary>
/// Gets a value indicating if the element is currently selected
/// </summary>
public virtual bool Selected
{
get
{
return _selected;
}
}
/// <summary>
/// Compares this element with other using date as comparer
/// </summary>
/// <param name="element"></param>
/// <returns></returns>
public virtual int CompareTo(ICalendarSelectableElement element)
{
return this.Date.CompareTo(element.Date);
}
#endregion
#region Internal Methods
/// <summary>
/// Sets the value of the <see cref="Bounds"/> property
/// </summary>
/// <param name="bounds">Bounds of the element</param>
internal virtual void SetBounds(Rectangle bounds)
{
_bounds = bounds;
}
/// <summary>
/// Sets the value of the <see cref="Selected"/> property
/// </summary>
/// <param name="selected">Value indicating if the element is currently selected</param>
internal virtual void SetSelected(bool selected)
{
_selected = selected;
//Calendar.Invalidate(Bounds);
}
#endregion
}
}

View File

@@ -0,0 +1,252 @@
/*
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>
/// Represents a selectable timescale unit on a <see cref="CalendarDay"/>
/// </summary>
public class CalendarTimeScaleUnit
: CalendarSelectableElement
{
#region Events
#endregion
#region Fields
private DateTime _date;
private CalendarDay _day;
private bool _highlighted;
private int _hours;
private int _index;
private int _minutes;
private List<CalendarItem> _passingItems;
private bool _visible;
#endregion
#region Properties
/// <summary>
/// Gets the exact date when the unit starts
/// </summary>
public override DateTime Date
{
get
{
if( _date.Equals( DateTime.MinValue ) )
{
_date = new DateTime( Day.Date.Year, Day.Date.Month, Day.Date.Day, Hours, Minutes, 0 );
}
return _date;
}
}
/// <summary>
/// Gets the <see cref="CalendarDay"/> this unit belongs to
/// </summary>
public CalendarDay Day
{
get { return _day; }
}
/// <summary>
/// Gets the duration of the unit.
/// </summary>
public TimeSpan Duration
{
get
{
return new TimeSpan( 0, (int)Calendar.TimeScale, 0 );
}
}
/// <summary>
/// Gets if the unit is highlighted because it fits in some of the calendar's highlight ranges
/// </summary>
public bool Highlighted
{
get { return _highlighted; }
}
/// <summary>
/// Gets the hour when this unit starts
/// </summary>
public int Hours
{
get { return _hours; }
}
/// <summary>
/// Gets the index of the unit relative to the day
/// </summary>
public int Index
{
get { return _index; }
}
/// <summary>
/// Gets the minute when this unit starts
/// </summary>
public int Minutes
{
get { return _minutes; }
set { _minutes = value; }
}
/// <summary>
/// Gets or sets the amount of items that pass over the unit
/// </summary>
internal List<CalendarItem> PassingItems
{
get { return _passingItems; }
set { _passingItems = value; }
}
/// <summary>
/// Gets a value indicating if the unit is currently visible on viewport
/// </summary>
public bool Visible
{
get { return _visible; }
}
#endregion
/// <summary>
/// Creates a new <see cref="CalendarTimeScaleUnit"/>
/// </summary>
/// <param name="day"><see cref="CalendarDay"/> this unit belongs to</param>
/// <param name="index">Index of the unit relative to the container day</param>
/// <param name="hours">Hour of the unit</param>
/// <param name="minutes">Minutes of the unit</param>
internal CalendarTimeScaleUnit( CalendarDay day, int index, int hours, int minutes )
: base( day.Calendar )
{
_day = day;
_index = index;
_hours = hours;
_minutes = minutes;
_passingItems = new List<CalendarItem>();
}
#region Public Methods
/// <summary>
/// Returns a <see cref="System.String"/> that represents this instance.
/// </summary>
/// <returns>
/// A <see cref="System.String"/> that represents this instance.
/// </returns>
public override string ToString()
{
return string.Format( "[{0}] - {1}", Index, Date.ToShortTimeString() );
}
#endregion
#region Private Methods
/// <summary>
/// Gets a value indicating if the unit should be higlighted
/// </summary>
/// <returns></returns>
internal bool CheckHighlighted()
{
for( int i = 0; i < Day.Calendar.HighlightRanges.Length; i++ )
{
CalendarHighlightRange range = Day.Calendar.HighlightRanges[i];
if( range.DayOfWeek != Date.DayOfWeek )
continue;
if( Date.TimeOfDay.CompareTo( range.StartTime ) >= 0
&& Date.TimeOfDay.CompareTo( range.EndTime ) < 0 )
{
return true;
}
}
return false;
}
/// <summary>
/// Sets the value of the <see cref="Highlighted"/> property
/// </summary>
/// <param name="highlighted">Value of the property</param>
internal void SetHighlighted( bool highlighted )
{
_highlighted = highlighted;
}
/// <summary>
/// Sets the value of the <see cref="Visible"/> property
/// </summary>
/// <param name="visible">Value indicating if the unit is currently visible on viewport</param>
internal void SetVisible( bool visible )
{
_visible = visible;
}
#endregion
#region Internal Methods
/// <summary>
/// Adds the passing item.
/// </summary>
/// <param name="item">The item.</param>
internal void AddPassingItem( CalendarItem item )
{
if( !PassingItems.Contains( item ) )
{
PassingItems.Add( item );
Day.AddContainedItem( item );
}
}
/// <summary>
/// Clears existance of item from this unit and it's corresponding day.
/// </summary>
/// <param name="item"></param>
internal void ClearItemExistance( CalendarItem item )
{
if( PassingItems.Contains( item ) )
{
PassingItems.Remove( item );
}
if( Day.ContainedItems.Contains( item ) )
{
Day.ContainedItems.Remove( item );
}
}
#endregion
}
}

View File

@@ -0,0 +1,174 @@
/*
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>
/// Represents a week displayed on the <see cref="Calendar"/>
/// </summary>
public class CalendarWeek
{
#region Events
#endregion
#region Fields
private Rectangle _bounds;
private Calendar _calendar;
private DateTime _firstDay;
#endregion
#region Properties
/// <summary>
/// Gets the bounds of the week
/// </summary>
public Rectangle Bounds
{
get { return _bounds; }
}
/// <summary>
/// Gets the calendar this week belongs to
/// </summary>
public Calendar Calendar
{
get { return _calendar; }
}
/// <summary>
/// Gets the bounds of the week header
/// </summary>
public Rectangle HeaderBounds
{
get
{
return new Rectangle(
Bounds.Left,
Bounds.Top + Calendar.Renderer.DayHeaderHeight,
Calendar.Renderer.WeekHeaderWidth,
Bounds.Height - Calendar.Renderer.DayHeaderHeight );
}
}
/// <summary>
/// Gets the sunday that starts the week
/// </summary>
public DateTime StartDate
{
get { return _firstDay; }
}
#endregion
/// <summary>
/// Initializes a new instance of the <see cref="CalendarWeek"/> class.
/// </summary>
/// <param name="calendar">The calendar.</param>
/// <param name="firstDay">The first day.</param>
internal CalendarWeek(Calendar calendar, DateTime firstDay)
{
_calendar = calendar;
_firstDay = firstDay;
}
#region Public Methods
/// <summary>
/// Gets the short version of week's string representation
/// </summary>
/// <returns></returns>
public string ToStringShort()
{
DateTime saturday = StartDate.AddDays(6);
if (saturday.Month != StartDate.Month)
{
return string.Format("{0} - {1}",
StartDate.ToString("d/M"),
saturday.ToString("d/M")
);
}
else
{
return string.Format("{0} - {1}",
StartDate.Day,
saturday.ToString("d/M")
);
}
}
/// <summary>
/// Gets the large version of string representation
/// </summary>
/// <returns>The week in a string format</returns>
public string ToStringLarge()
{
DateTime saturday = StartDate.AddDays(6);
if (saturday.Month != StartDate.Month)
{
return string.Format("{0} - {1}",
StartDate.ToString("d MMM"),
saturday.ToString("d MMM")
);
}
else
{
return string.Format("{0} - {1}",
StartDate.Day,
saturday.ToString("d MMM")
);
}
}
/// <summary>
/// Returns a <see cref="System.String"/> that represents this instance.
/// </summary>
/// <returns>
/// A <see cref="System.String"/> that represents this instance.
/// </returns>
public override string ToString()
{
return ToStringLarge();
}
#endregion
#region Private Methods
/// <summary>
/// Sets the value of the <see cref="Bounds"/> property
/// </summary>
/// <param name="r"></param>
internal void SetBounds(Rectangle r)
{
_bounds = r;
}
#endregion
}
}

View File

@@ -0,0 +1,41 @@
/*
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>
/// Enumerates the possible modes of the days visualization on the <see cref="Calendar"/>
/// </summary>
public enum CalendarDaysMode
{
/// <summary>
/// A short version of the day is visible without time scale.
/// </summary>
Short,
/// <summary>
/// The day is fully visible with time scale.
/// </summary>
Expanded
}
}

View File

@@ -0,0 +1,51 @@
/*
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>
/// Possible alignment for <see cref="CalendarItem"/> images
/// </summary>
public enum CalendarItemImageAlign
{
/// <summary>
/// Image is drawn at north of text
/// </summary>
North,
/// <summary>
/// Image is drawn at south of text
/// </summary>
South,
/// <summary>
/// Image is drawn at east of text
/// </summary>
East,
/// <summary>
/// Image is drawn at west of text
/// </summary>
West,
}
}

View File

@@ -0,0 +1,52 @@
/*
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.Linq;
using System.Text;
namespace WindowsFormsCalendar
{
/// <summary>
/// Enumeration for the different type of scroll bars
/// </summary>
public enum CalendarScrollBars
{
/// <summary>
/// No scroll bars
/// </summary>
None,
/// <summary>
/// Vertical and Horizontal scrollbars
/// </summary>
Both,
/// <summary>
/// Only vertical scrollbars
/// </summary>
Vertical,
/// <summary>
/// Only horizontal scrollbars
/// </summary>
Horizontal
}
}

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.Linq;
using System.Text;
namespace WindowsFormsCalendar
{
/// <summary>
/// Possible states of the calendar
/// </summary>
public enum CalendarState
{
/// <summary>
/// Nothing happening
/// </summary>
Idle,
/// <summary>
/// User is currently dragging on view to select a time range
/// </summary>
DraggingTimeSelection,
/// <summary>
/// User is currently dragging an item among the view
/// </summary>
DraggingItem,
/// <summary>
/// User is editing an item's Text
/// </summary>
EditingItemText,
/// <summary>
/// User is currently resizing an item
/// </summary>
ResizingItem
}
}

View File

@@ -0,0 +1,42 @@
/*
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.Linq;
using System.Text;
namespace WindowsFormsCalendar
{
/// <summary>
/// An enumeration that represents the time format of the calendar
/// </summary>
public enum CalendarTimeFormat
{
/// <summary>
/// A twelve hour clock
/// </summary>
TwelveHour,
/// <summary>
/// A twenty four hour clock
/// </summary>
TwentyFourHour
}
}

View File

@@ -0,0 +1,61 @@
/*
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>
/// Enumerates possible timescales for <see cref="Calendar"/> control
/// </summary>
public enum CalendarTimeScale
{
/// <summary>
/// Makes calendar show intervals of 60 minutes
/// </summary>
SixtyMinutes = 60,
/// <summary>
/// Makes calendar show intervals of 30 minutes
/// </summary>
ThirtyMinutes = 30,
/// <summary>
/// Makes calendar show intervals of 15 minutes
/// </summary>
FifteenMinutes = 15,
/// <summary>
/// Makes calendar show intervals of 10 minutes
/// </summary>
TenMinutes = 10,
/// <summary>
/// Makes calendar show intervals of 6 minutes
/// </summary>
SixMinutes = 6,
/// <summary>
/// Makes calendar show intervals of 5 minutes
/// </summary>
FiveMinutes = 5
}
}

View File

@@ -0,0 +1,64 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WindowsFormsCalendar
{
/// <summary>
/// Possible corners to pass to the RoundRectangle method
/// </summary>
[Flags()]
public enum Corners
{
/// <summary>
/// No corners
/// </summary>
None = 0,
/// <summary>
/// Northwest corner
/// </summary>
NorthWest = 2,
/// <summary>
/// Northeast corner
/// </summary>
NorthEast = 4,
/// <summary>
/// Southeast corner
/// </summary>
SouthEast = 8,
/// <summary>
/// Southwest corner
/// </summary>
SouthWest = 16,
/// <summary>
/// All corners
/// </summary>
All = NorthWest | NorthEast | SouthEast | SouthWest,
/// <summary>
/// North corner
/// </summary>
North = NorthWest | NorthEast,
/// <summary>
/// South corner
/// </summary>
South = SouthEast | SouthWest,
/// <summary>
/// East Corner
/// </summary>
East = NorthEast | SouthEast,
/// <summary>
/// West corner
/// </summary>
West = NorthWest | SouthWest
}
}

View File

@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WindowsFormsCalendar
{
/// <summary>
/// Represents the different kinds of selection in MonthView
/// </summary>
public enum MonthViewSelection
{
/// <summary>
/// User can select whatever date available to mouse reach
/// </summary>
Manual,
/// <summary>
/// Selection is limited to just one day
/// </summary>
Day,
/// <summary>
/// Selecion is limited to <see cref="DayOfWeek"/> weekly ranges
/// </summary>
WorkWeek,
/// <summary>
/// Selection is limited to a full week
/// </summary>
Week,
/// <summary>
/// Selection is limited to a full month
/// </summary>
Month
}
}

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
{
}
}

View File

@@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program 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.
This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@@ -0,0 +1,45 @@
/*
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>
/// Interface implemented by every selectable element of the calendar
/// </summary>
public interface ICalendarSelectableElement
: ISelectableElement, IComparable<ICalendarSelectableElement>
{
/// <summary>
/// Gets the calendar this element belongs to
/// </summary>
Calendar Calendar { get; }
/// <summary>
/// Gets the calendar
/// </summary>
DateTime Date { get; }
}
}

View File

@@ -0,0 +1,43 @@
/*
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>
/// Represents a clickable element of <see cref="MonthView"/> control
/// </summary>
public interface ISelectableElement
{
/// <summary>
/// Gets the bounds of the element
/// </summary>
Rectangle Bounds { get; }
/// <summary>
/// Gets if the element is currently selected
/// </summary>
bool Selected { get; }
}
}

View File

@@ -0,0 +1,133 @@
/*
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>
/// A class that represents a month view day
/// </summary>
public class MonthViewDay
{
#region Fields
Rectangle _bounds;
private DateTime _date;
private MonthViewMonth _month;
private MonthView _monthView;
#endregion
#region Propserties
/// <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
/// <summary>
/// Initializes a new instance of the <see cref="MonthViewDay"/> class.
/// </summary>
/// <param name="month">The month.</param>
/// <param name="date">The date.</param>
internal MonthViewDay(MonthViewMonth month, DateTime date)
{
_month = month;
_monthView = month.MonthView;
_date = date;
}
#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
}
}

View File

@@ -0,0 +1,31 @@
/*
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
{
public class MonthViewMontEventArgs
{
}
}

View File

@@ -0,0 +1,231 @@
/*
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>
/// Represents a month displayed"/>
/// </summary>
public class MonthViewMonth
{
#region Fields
private DateTime _date;
private Rectangle monthNameBounds;
private Rectangle[] dayNamesBounds;
private MonthViewDay[] days;
private string[] _dayHeaders;
private Size _size = new Size();
private Point _location;
private MonthView _monthview;
#endregion
#region Properties
/// <summary>
/// Gets the bounds.
/// </summary>
public Rectangle Bounds
{
get { return new Rectangle( Location, Size ); }
}
/// <summary>
/// Gets the month view.
/// </summary>
public MonthView MonthView
{
get { return _monthview; }
}
/// <summary>
/// Gets the location.
/// </summary>
public Point Location
{
get { return _location; }
}
/// <summary>
/// Gets the size.
/// </summary>
public Size Size
{
get { return MonthView.MonthSize; }
}
/// <summary>
/// Gets or sets the days.
/// </summary>
/// <value>
/// The days.
/// </value>
public MonthViewDay[] Days
{
get { return days; }
set { days = value; }
}
/// <summary>
/// Gets or sets the day names bounds.
/// </summary>
/// <value>
/// The day names bounds.
/// </value>
public Rectangle[] DayNamesBounds
{
get { return dayNamesBounds; }
set { dayNamesBounds = value; }
}
/// <summary>
/// Gets or sets the day headers.
/// </summary>
/// <value>
/// The day headers.
/// </value>
public string[] DayHeaders
{
get { return _dayHeaders; }
set { _dayHeaders = value; }
}
/// <summary>
/// Gets or sets the month name bounds.
/// </summary>
/// <value>
/// The month name bounds.
/// </value>
public Rectangle MonthNameBounds
{
get { return monthNameBounds; }
set { monthNameBounds = value; }
}
/// <summary>
/// Gets or sets the date of the first day of the month
/// </summary>
public DateTime Date
{
get { return _date; }
}
#endregion
/// <summary>
/// Initializes a new instance of the <see cref="MonthViewMonth"/> class.
/// </summary>
/// <param name="monthView">The month view.</param>
/// <param name="date">The date.</param>
internal MonthViewMonth( MonthView monthView, DateTime date )
{
if( date.Day != 1 )
{
date = new DateTime( date.Year, date.Month, 1 );
}
_monthview = monthView;
_date = date;
int preDays = ( new int[] { 0, 1, 2, 3, 4, 5, 6 } )[(int)date.DayOfWeek] - (int)MonthView.FirstDayOfWeek;
days = new MonthViewDay[6 * 7];
DateTime curDate = date.AddDays( -preDays );
DayHeaders = new string[7];
for( int i = 0; i < days.Length; i++ )
{
days[i] = new MonthViewDay( this, curDate );
if( i < 7 )
{
DayHeaders[i] = curDate.ToString( MonthView.DayNamesFormat ).Substring( 0, MonthView.DayNamesLength );
}
curDate = curDate.AddDays( 1 );
}
}
#region Public Methods
#endregion
#region Private Methods
/// <summary>
/// Sets the value of the <see cref="Location"/> property
/// </summary>
/// <param name="location"></param>
internal void SetLocation( Point location )
{
int startX = location.X;
int startY = location.Y;
int curX = startX;
int curY = startY;
_location = location;
monthNameBounds = new Rectangle( location, new Size( Size.Width, MonthView.DaySize.Height ) );
if( MonthView.DayNamesVisible )
{
dayNamesBounds = new Rectangle[7];
curY = location.Y + MonthView.DaySize.Height;
for( int i = 0; i < dayNamesBounds.Length; i++ )
{
DayNamesBounds[i] = new Rectangle( curX, curY, MonthView.DaySize.Width, MonthView.DaySize.Height );
curX += MonthView.DaySize.Width;
}
}
else
{
dayNamesBounds = new Rectangle[] { };
}
curX = startX;
curY = startY + MonthView.DaySize.Height * 2;
for( int i = 0; i < Days.Length; i++ )
{
Days[i].SetBounds( new Rectangle( new Point( curX, curY ), MonthView.DaySize ) );
curX += MonthView.DaySize.Width;
if( ( i + 1 ) % 7 == 0 )
{
curX = startX;
curY += MonthView.DaySize.Height;
}
}
}
#endregion
}
}

View File

@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WindowsFormsCalendar")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct( "WindowsFormsCalendar" )]
[assembly: AssemblyCopyright("Copyright © 2012 Justin LeCheminant")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("25ba6a13-96fe-4dd9-baae-0656f18fbcd0")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.1.*")]
[assembly: AssemblyFileVersion("1.1.0.0")]

View File

@@ -0,0 +1,15 @@
This is the read me file for the WindowsFormsCalendar project.
This project is a fork of the A Professional Calendar project on codeplex.
The current version is 1.1
1.1 features
- Added Font selection for calendar items
- Added Foreground Color settings for calendar items
- Added Background Color settings for calendar items
- Updated the assembly version information to be correct.
1.0 features
- Moved the project to the 4.0 framework
- Added a clock format selection to the calendar

View File

@@ -0,0 +1,271 @@
/*
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.Drawing.Drawing2D;
namespace WindowsFormsCalendar
{
/// <summary>
/// Renders the professional calendar control
/// </summary>
public class CalendarProfessionalRenderer
: CalendarSystemRenderer
{
#region Fields
/// <summary>
/// HeaderA
/// </summary>
public Color HeaderA = FromHex("#E4ECF6");
/// <summary>
/// HeaderB
/// </summary>
public Color HeaderB = FromHex("#D6E2F1");
/// <summary>
/// HeaderC
/// </summary>
public Color HeaderC = FromHex("#C2D4EB");
/// <summary>
/// HeaderD
/// </summary>
public Color HeaderD = FromHex("#D0DEEF");
/// <summary>
/// TodayA
/// </summary>
public Color TodayA = FromHex("#F8D478");
/// <summary>
/// TodayB
/// </summary>
public Color TodayB = FromHex("#F8D478");
/// <summary>
/// TodayC
/// </summary>
public Color TodayC = FromHex("#F2AA36");
/// <summary>
/// TodayD
/// </summary>
public Color TodayD = FromHex("#F7C966");
#endregion
/// <summary>
/// Initializes a new instance of the <see cref="CalendarProfessionalRenderer"/> class.
/// </summary>
/// <param name="c">The c.</param>
public CalendarProfessionalRenderer(Calendar c)
: base(c)
{
ColorTable.Background = FromHex("#E3EFFF");
ColorTable.DayBackgroundEven = FromHex("#A5BFE1");
ColorTable.DayBackgroundOdd = FromHex("#FFFFFF");
ColorTable.DayBackgroundSelected = FromHex("#E6EDF7");
ColorTable.DayBorder = FromHex("#5D8CC9");
ColorTable.DayHeaderBackground = FromHex("#DFE8F5");
ColorTable.DayHeaderText = Color.Black;
ColorTable.DayHeaderSecondaryText = Color.Black;
ColorTable.DayTopBorder = FromHex("#5D8CC9");
ColorTable.DayTopSelectedBorder = FromHex("#5D8CC9");
ColorTable.DayTopBackground = FromHex("#A5BFE1");
ColorTable.DayTopSelectedBackground = FromHex("#294C7A");
ColorTable.ItemBorder = FromHex("#5D8CC9");
ColorTable.ItemBackground = FromHex("#C0D3EA");
ColorTable.ItemText = Color.Black;
ColorTable.ItemSecondaryText = FromHex("#294C7A");
ColorTable.ItemSelectedBorder = Color.Black;
ColorTable.ItemSelectedBackground = FromHex("#C0D3EA");
ColorTable.ItemSelectedText = Color.Black;
ColorTable.WeekHeaderBackground = FromHex("#DFE8F5");
ColorTable.WeekHeaderBorder = FromHex("#5D8CC9");
ColorTable.WeekHeaderText = FromHex("#5D8CC9");
ColorTable.TodayBorder = FromHex("#EE9311");
ColorTable.TodayTopBackground = FromHex("#EE9311");
ColorTable.TimeScaleLine = FromHex("#6593CF");
ColorTable.TimeScaleHours = FromHex("#6593CF");
ColorTable.TimeScaleMinutes = FromHex("#6593CF");
ColorTable.TimeUnitBackground = FromHex("#E6EDF7");
ColorTable.TimeUnitHighlightedBackground = Color.White;
ColorTable.TimeUnitSelectedBackground = FromHex("#294C7A");
ColorTable.TimeUnitBorderLight = FromHex("#D5E1F1");
ColorTable.TimeUnitBorderDark = FromHex("#A5BFE1");
ColorTable.WeekDayName = FromHex("#6593CF");
SelectedItemBorder = 2f;
ItemRoundness = 5;
}
#region Private Method
/// <summary>
/// Gradients the rect.
/// </summary>
/// <param name="g">The g.</param>
/// <param name="bounds">The bounds.</param>
/// <param name="a">A.</param>
/// <param name="b">The b.</param>
public static void GradientRect(Graphics g, Rectangle bounds, Color a, Color b)
{
using (LinearGradientBrush br = new LinearGradientBrush(bounds, b, a, -90))
{
g.FillRectangle(br, bounds);
}
}
/// <summary>
/// Glossies the rect.
/// </summary>
/// <param name="g">The g.</param>
/// <param name="bounds">The bounds.</param>
/// <param name="a">A.</param>
/// <param name="b">The b.</param>
/// <param name="c">The c.</param>
/// <param name="d">The d.</param>
public static void GlossyRect(Graphics g, Rectangle bounds, Color a, Color b, Color c, Color d)
{
Rectangle top = new Rectangle(bounds.Left, bounds.Top, bounds.Width, bounds.Height / 2);
Rectangle bot = Rectangle.FromLTRB(bounds.Left, top.Bottom, bounds.Right, bounds.Bottom);
GradientRect(g, top, a, b);
GradientRect(g, bot, c, d);
}
/// <summary>
/// Shortcut to one on CalendarColorTable
/// </summary>
/// <param name="color"></param>
/// <returns></returns>
private static Color FromHex(string color)
{
return CalendarColorTable.FromHex(color);
}
#endregion
#region Overrides
/// <summary>
/// Initializes the Calendar
/// </summary>
/// <param name="e"></param>
public override void OnInitialize(CalendarRendererEventArgs e)
{
base.OnInitialize(e);
e.Calendar.Font = SystemFonts.CaptionFont;
}
/// <summary>
/// Raises the <see cref="E:DrawDayHeaderBackground"/> event.
/// </summary>
/// <param name="e">The <see cref="WindowsFormsCalendar.CalendarRendererDayEventArgs"/> instance containing the event data.</param>
public override void OnDrawDayHeaderBackground(CalendarRendererDayEventArgs e)
{
Rectangle r = e.Day.HeaderBounds;
if (e.Day.Date == DateTime.Today)
{
GlossyRect(e.Graphics, e.Day.HeaderBounds, TodayA, TodayB, TodayC, TodayD);
}
else
{
GlossyRect(e.Graphics, e.Day.HeaderBounds, HeaderA, HeaderB, HeaderC, HeaderD);
}
if (e.Calendar.DaysMode == CalendarDaysMode.Short)
{
using (Pen p = new Pen(ColorTable.DayBorder))
{
e.Graphics.DrawLine(p, r.Left, r.Top, r.Right, r.Top);
e.Graphics.DrawLine(p, r.Left, r.Bottom, r.Right, r.Bottom);
}
}
}
/// <summary>
/// Raises the <see cref="E:DrawItemBorder"/> event.
/// </summary>
/// <param name="e">The <see cref="WindowsFormsCalendar.CalendarRendererItemBoundsEventArgs"/> instance containing the event data.</param>
public override void OnDrawItemBorder(CalendarRendererItemBoundsEventArgs e)
{
base.OnDrawItemBorder(e);
using (Pen p = new Pen(Color.FromArgb(150, Color.White)))
{
e.Graphics.DrawLine(p, e.Bounds.Left + ItemRoundness, e.Bounds.Top + 1, e.Bounds.Right - ItemRoundness, e.Bounds.Top + 1);
}
if (e.Item.Selected && !e.Item.IsDragging)
{
bool horizontal = false;
bool vertical = false;
Rectangle r1 = new Rectangle(0, 0, 5, 5);
Rectangle r2 = new Rectangle(0, 0, 5, 5);
horizontal = e.Item.IsOnDayTop;
vertical = !e.Item.IsOnDayTop && e.Calendar.DaysMode == CalendarDaysMode.Expanded;
if (horizontal)
{
r1.X = e.Bounds.Left - 2;
r2.X = e.Bounds.Right - r1.Width + 2;
r1.Y = e.Bounds.Top + (e.Bounds.Height - r1.Height) / 2;
r2.Y = r1.Y;
}
if (vertical)
{
r1.Y = e.Bounds.Top - 2;
r2.Y = e.Bounds.Bottom - r1.Height + 2;
r1.X = e.Bounds.Left + (e.Bounds.Width - r1.Width) / 2;
r2.X = r1.X;
}
if ((horizontal || vertical) && Calendar.AllowItemResize)
{
if (!e.Item.IsOpenStart && e.IsFirst)
{
e.Graphics.FillRectangle(Brushes.White, r1);
e.Graphics.DrawRectangle(Pens.Black, r1);
}
if (!e.Item.IsOpenEnd && e.IsLast)
{
e.Graphics.FillRectangle(Brushes.White, r2);
e.Graphics.DrawRectangle(Pens.Black, r2);
}
}
}
}
#endregion
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,479 @@
/*
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.Drawing.Drawing2D;
namespace WindowsFormsCalendar
{
/// <summary>
/// CalendarRenderer that renders low-intensity calendar for slow computers
/// </summary>
public class CalendarSystemRenderer
: CalendarRenderer
{
#region Fields
private CalendarColorTable _colorTable;
private float _selectedItemBorder;
#endregion
/// <summary>
/// Initializes a new instance of the <see cref="CalendarSystemRenderer"/> class.
/// </summary>
/// <param name="calendar"></param>
public CalendarSystemRenderer( Calendar calendar )
: base( calendar )
{
ColorTable = new CalendarColorTable();
SelectedItemBorder = 1;
}
#region Properties
/// <summary>
/// Gets or sets the <see cref="CalendarColorTable"/> for this renderer
/// </summary>
public CalendarColorTable ColorTable
{
get { return _colorTable; }
set { _colorTable = value; }
}
/// <summary>
/// Gets or sets the size of the border of selected items
/// </summary>
public float SelectedItemBorder
{
get { return _selectedItemBorder; }
set { _selectedItemBorder = value; }
}
#endregion
#region Overrides
/// <summary>
/// Paints the background of the calendar
/// </summary>
/// <param name="e">Paint info</param>
public override void OnDrawBackground( CalendarRendererEventArgs e )
{
e.Graphics.Clear( ColorTable.Background );
}
/// <summary>
/// Paints the specified day on the calendar
/// </summary>
/// <param name="e">Paint info</param>
public override void OnDrawDay( CalendarRendererDayEventArgs e )
{
Rectangle r = e.Day.Bounds;
if( e.Day.Selected )
{
using( Brush b = new SolidBrush( ColorTable.DayBackgroundSelected ) )
{
e.Graphics.FillRectangle( b, r );
}
}
else if( e.Day.Date.Month % 2 == 0 )
{
using( Brush b = new SolidBrush( ColorTable.DayBackgroundEven ) )
{
e.Graphics.FillRectangle( b, r );
}
}
else
{
using( Brush b = new SolidBrush( ColorTable.DayBackgroundOdd ) )
{
e.Graphics.FillRectangle( b, r );
}
}
base.OnDrawDay( e );
}
/// <summary>
/// Paints the border of the specified day
/// </summary>
/// <param name="e"></param>
public override void OnDrawDayBorder( CalendarRendererDayEventArgs e )
{
base.OnDrawDayBorder( e );
Rectangle r = e.Day.Bounds;
bool today = e.Day.Date.Date.Equals( DateTime.Today.Date );
using( Pen p = new Pen( today ? ColorTable.TodayBorder : ColorTable.DayBorder, today ? 2 : 1 ) )
{
if( e.Calendar.DaysMode == CalendarDaysMode.Short )
{
e.Graphics.DrawLine( p, r.Right, r.Top, r.Right, r.Bottom );
e.Graphics.DrawLine( p, r.Left, r.Bottom, r.Right, r.Bottom );
if( e.Day.Date.DayOfWeek == DayOfWeek.Sunday || today )
{
e.Graphics.DrawLine( p, r.Left, r.Top, r.Left, r.Bottom );
}
}
else
{
e.Graphics.DrawRectangle( p, r );
}
}
}
/// <summary>
/// Draws the all day items area
/// </summary>
/// <param name="e">Paint Info</param>
public override void OnDrawDayTop( CalendarRendererDayEventArgs e )
{
bool s = e.Day.DayTop.Selected;
using( Brush b = new SolidBrush( s ? ColorTable.DayTopSelectedBackground : ColorTable.DayTopBackground ) )
{
e.Graphics.FillRectangle( b, e.Day.DayTop.Bounds );
}
using( Pen p = new Pen( s ? ColorTable.DayTopSelectedBorder : ColorTable.DayTopBorder ) )
{
e.Graphics.DrawRectangle( p, e.Day.DayTop.Bounds );
}
base.OnDrawDayTop( e );
}
/// <summary>
/// Paints the background of the specified day's header
/// </summary>
/// <param name="e"></param>
public override void OnDrawDayHeaderBackground( CalendarRendererDayEventArgs e )
{
bool today = e.Day.Date.Date.Equals( DateTime.Today.Date );
using( Brush b = new SolidBrush( today ? ColorTable.TodayTopBackground : ColorTable.DayHeaderBackground ) )
{
e.Graphics.FillRectangle( b, e.Day.HeaderBounds );
}
base.OnDrawDayHeaderBackground( e );
}
/// <summary>
/// Raises the <see cref="E:DrawWeekHeader"/> event.
/// </summary>
/// <param name="e">The <see cref="WindowsFormsCalendar.CalendarRendererBoxEventArgs"/> instance containing the event data.</param>
public override void OnDrawWeekHeader( CalendarRendererBoxEventArgs e )
{
using( Brush b = new SolidBrush( ColorTable.WeekHeaderBackground ) )
{
e.Graphics.FillRectangle( b, e.Bounds );
}
using( Pen p = new Pen( ColorTable.WeekHeaderBorder ) )
{
e.Graphics.DrawRectangle( p, e.Bounds );
}
e.TextColor = ColorTable.WeekHeaderText;
base.OnDrawWeekHeader( e );
}
/// <summary>
/// Draws a time unit of a day
/// </summary>
/// <param name="e"></param>
public override void OnDrawDayTimeUnit( CalendarRendererTimeUnitEventArgs e )
{
base.OnDrawDayTimeUnit( e );
using( SolidBrush b = new SolidBrush( ColorTable.TimeUnitBackground ) )
{
if( e.Unit.Selected )
{
b.Color = ColorTable.TimeUnitSelectedBackground;
}
else if( e.Unit.Highlighted )
{
b.Color = ColorTable.TimeUnitHighlightedBackground;
}
e.Graphics.FillRectangle( b, e.Unit.Bounds );
}
using( Pen p = new Pen( e.Unit.Minutes == 0 ? ColorTable.TimeUnitBorderDark : ColorTable.TimeUnitBorderLight ) )
{
e.Graphics.DrawLine( p, e.Unit.Bounds.Location, new Point( e.Unit.Bounds.Right, e.Unit.Bounds.Top ) );
}
}
/// <summary>
/// Paints the timescale of the calendar
/// </summary>
/// <param name="e">Paint info</param>
public override void OnDrawTimeScale( CalendarRendererEventArgs e )
{
int margin = 5;
int largeX1 = TimeScaleBounds.Left + margin;
int largeX2 = TimeScaleBounds.Right - margin;
int shortX1 = TimeScaleBounds.Left + TimeScaleBounds.Width / 2;
int shortX2 = largeX2;
int top = 0;
Pen p = new Pen( ColorTable.TimeScaleLine );
for( int i = 0; i < e.Calendar.Days[0].TimeUnits.Length; i++ )
{
CalendarTimeScaleUnit unit = e.Calendar.Days[0].TimeUnits[i];
if( !unit.Visible ) continue;
top = unit.Bounds.Top;
if( unit.Minutes == 0 )
{
e.Graphics.DrawLine( p, largeX1, top, largeX2, top );
}
else
{
e.Graphics.DrawLine( p, shortX1, top, shortX2, top );
}
}
if( e.Calendar.DaysMode == CalendarDaysMode.Expanded
&& e.Calendar.Days != null
&& e.Calendar.Days.Length > 0
&& e.Calendar.Days[0].TimeUnits != null
&& e.Calendar.Days[0].TimeUnits.Length > 0
)
{
top = e.Calendar.Days[0].BodyBounds.Top;
//Timescale top line is full
e.Graphics.DrawLine( p, TimeScaleBounds.Left, top, TimeScaleBounds.Right, top );
}
p.Dispose();
base.OnDrawTimeScale( e );
}
/// <summary>
/// Paints an hour of a timescale unit
/// </summary>
/// <param name="e">Paint Info</param>
public override void OnDrawTimeScaleHour( CalendarRendererBoxEventArgs e )
{
e.TextColor = ColorTable.TimeScaleHours;
base.OnDrawTimeScaleHour( e );
}
/// <summary>
/// Paints minutes of a timescale unit
/// </summary>
/// <param name="e">Paint Info</param>
public override void OnDrawTimeScaleMinutes( CalendarRendererBoxEventArgs e )
{
e.TextColor = ColorTable.TimeScaleMinutes;
base.OnDrawTimeScaleMinutes( e );
}
/// <summary>
/// Draws the background of the specified item
/// </summary>
/// <param name="e">Event Info</param>
public override void OnDrawItemBackground( CalendarRendererItemBoundsEventArgs e )
{
base.OnDrawItemBackground( e );
int alpha = 255;
if( e.Item.IsDragging )
{
alpha = 120;
}
else if( e.Calendar.DaysMode == CalendarDaysMode.Short )
{
alpha = 200;
}
Color color1 = Color.White;
Color color2 = e.Item.Selected ? ColorTable.ItemSelectedBackground : ColorTable.ItemBackground;
if( !e.Item.BackgroundColorLighter.IsEmpty )
{
color1 = e.Item.BackgroundColorLighter;
}
if( !e.Item.BackgroundColor.IsEmpty )
{
color2 = e.Item.BackgroundColor;
}
ItemFill( e, e.Bounds, Color.FromArgb( alpha, color1 ), Color.FromArgb( alpha, color2 ) );
}
/// <summary>
/// Draws the shadow of the specified item
/// </summary>
/// <param name="e"></param>
public override void OnDrawItemShadow( CalendarRendererItemBoundsEventArgs e )
{
base.OnDrawItemShadow( e );
if( e.Item.IsOnDayTop || e.Calendar.DaysMode == CalendarDaysMode.Short || e.Item.IsDragging )
{
return;
}
Rectangle r = e.Bounds;
r.Offset( ItemShadowPadding, ItemShadowPadding );
using( SolidBrush b = new SolidBrush( ColorTable.ItemShadow ) )
{
ItemFill( e, r, ColorTable.ItemShadow, ColorTable.ItemShadow );
}
}
/// <summary>
/// Draws the border of the specified item
/// </summary>
/// <param name="e">Event Info</param>
public override void OnDrawItemBorder( CalendarRendererItemBoundsEventArgs e )
{
base.OnDrawItemBorder( e );
Color a = e.Item.BorderColor.IsEmpty ? ColorTable.ItemBorder : e.Item.BorderColor;
Color b = e.Item.Selected && !e.Item.IsDragging ? ColorTable.ItemSelectedBorder : a;
Color c = Color.FromArgb( e.Item.IsDragging ? 120 : 255, b );
ItemBorder( e, e.Bounds, c, e.Item.Selected && !e.Item.IsDragging ? SelectedItemBorder : 1f );
}
/// <summary>
/// Draws the starttime of the item if applicable
/// </summary>
/// <param name="e">Event data</param>
public override void OnDrawItemStartTime( CalendarRendererBoxEventArgs e )
{
if( e.TextColor.IsEmpty )
{
e.TextColor = ColorTable.ItemSecondaryText;
}
base.OnDrawItemStartTime( e );
}
/// <summary>
/// Draws the end time of the item if applicable
/// </summary>
/// <param name="e">Event data</param>
public override void OnDrawItemEndTime( CalendarRendererBoxEventArgs e )
{
if( e.TextColor.IsEmpty )
{
e.TextColor = ColorTable.ItemSecondaryText;
}
base.OnDrawItemEndTime( e );
}
/// <summary>
/// Draws the text of an item
/// </summary>
/// <param name="e"></param>
public override void OnDrawItemText( CalendarRendererBoxEventArgs e )
{
CalendarItem item = e.Tag as CalendarItem;
if( item != null )
{
if( item.IsDragging )
{
e.TextColor = Color.FromArgb( 120, e.TextColor );
}
}
base.OnDrawItemText( e );
}
/// <summary>
/// Raises the <see cref="E:DrawWeekHeaders"/> event.
/// </summary>
/// <param name="e">The <see cref="WindowsFormsCalendar.CalendarRendererEventArgs"/> instance containing the event data.</param>
public override void OnDrawWeekHeaders( CalendarRendererEventArgs e )
{
base.OnDrawWeekHeaders( e );
}
/// <summary>
/// Raises the <see cref="E:DrawDayNameHeader"/> event.
/// </summary>
/// <param name="e">The <see cref="WindowsFormsCalendar.CalendarRendererBoxEventArgs"/> instance containing the event data.</param>
public override void OnDrawDayNameHeader( CalendarRendererBoxEventArgs e )
{
e.TextColor = ColorTable.WeekDayName;
base.OnDrawDayNameHeader( e );
using( Pen p = new Pen( ColorTable.WeekDayName ) )
{
e.Graphics.DrawLine( p, e.Bounds.Right, e.Bounds.Top, e.Bounds.Right, e.Bounds.Bottom );
}
}
/// <summary>
/// Draws the overflow to end of specified day
/// </summary>
/// <param name="e"></param>
public override void OnDrawDayOverflowEnd( CalendarRendererDayEventArgs e )
{
using( GraphicsPath path = new GraphicsPath() )
{
int top = e.Day.OverflowEndBounds.Top + e.Day.OverflowEndBounds.Height / 2;
path.AddPolygon( new Point[] {
new Point(e.Day.OverflowEndBounds.Left, top),
new Point(e.Day.OverflowEndBounds.Right, top),
new Point(e.Day.OverflowEndBounds.Left + e.Day.OverflowEndBounds.Width / 2, e.Day.OverflowEndBounds.Bottom),
} );
using( Brush b = new SolidBrush( e.Day.OverflowEndSelected ? ColorTable.DayOverflowSelectedBackground : ColorTable.DayOverflowBackground ) )
{
e.Graphics.FillPath( b, path );
}
using( Pen p = new Pen( ColorTable.DayOverflowBorder ) )
{
e.Graphics.DrawPath( p, path );
}
}
}
#endregion
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,68 @@
/*
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>
/// A text box control used in the calendar
/// </summary>
public class CalendarTextBox
: TextBox
{
#region Fields
private Calendar _calendar;
#endregion
#region Properties
/// <summary>
/// Gets the calendar where this control lives
/// </summary>
public Calendar Calendar
{
get { return _calendar; }
}
#endregion
/// <summary>
/// Creates a new <see cref="CalendarTextBox"/> for the specified <see cref="Calendar"/>
/// </summary>
/// <param name="calendar">Calendar where this control lives</param>
public CalendarTextBox( Calendar calendar )
{
_calendar = calendar;
this.Font = _calendar.ItemsFont;
this.ForeColor = _calendar.ItemsForeColor;
this.BackColor = _calendar.ItemsBackgroundColor;
}
#region Methods
#endregion
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{25649F08-3046-4891-ADB8-7EA787B57063}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>WindowsFormsCalendar</RootNamespace>
<AssemblyName>WindowsFormsCalendar</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>2.0</OldToolsVersion>
<UpgradeBackupLocation />
<TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\WindowsFormsCalendar.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CalendarColorTable.cs" />
<Compile Include="Enums\Corners.cs" />
<Compile Include="Enums\MonthViewSelection.cs" />
<Compile Include="EventArgs\CalendarDayEventArgs.cs" />
<Compile Include="CalendarDayTop.cs">
</Compile>
<Compile Include="CalendarHighlightRange.cs" />
<Compile Include="EventArgs\CalendarItemCancelEventArgs.cs" />
<Compile Include="EventArgs\CalendarItemEventArgs.cs" />
<Compile Include="Enums\CalendarItemImageAlign.cs" />
<Compile Include="EventArgs\CalendarLoadEventArgs.cs" />
<Compile Include="Renderers\CalendarProfessionalRenderer.cs">
</Compile>
<Compile Include="Renderers\CalendarRenderer.cs" />
<Compile Include="UserControls\Calendar.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="CalendarDay.cs" />
<Compile Include="Enums\CalendarDaysMode.cs" />
<Compile Include="CalendarItem.cs" />
<Compile Include="CalendarItemCollection.cs" />
<Compile Include="EventArgs\CalendarRendererDayEventArgs.cs">
</Compile>
<Compile Include="EventArgs\CalendarRendererEventArgs.cs" />
<Compile Include="EventArgs\CalendarRendererBoxEventArgs.cs">
</Compile>
<Compile Include="EventArgs\CalendarRendererItemBoundsEventArgs.cs">
</Compile>
<Compile Include="EventArgs\CalendarRendererItemEventArgs.cs" />
<Compile Include="EventArgs\CalendarRendererTimeUnitEventArgs.cs">
</Compile>
<Compile Include="CalendarSelectableElement.cs" />
<Compile Include="Renderers\CalendarSystemRenderer.cs" />
<Compile Include="UserControls\CalendarTextBox.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Enums\CalendarTimeFormat.cs" />
<Compile Include="Enums\CalendarTimeScale.cs" />
<Compile Include="CalendarTimeScaleUnit.cs" />
<Compile Include="CalendarWeek.cs" />
<Compile Include="Enums\CalendarState.cs" />
<Compile Include="Enums\CalendarScrollBars.cs" />
<Compile Include="ICalendarSelectableElement.cs" />
<Compile Include="ISelectableElement.cs" />
<Compile Include="EventArgs\MonthViewBoxEventArgs.cs" />
<Compile Include="MonthViewDay.cs" />
<Compile Include="EventArgs\MonthViewMontEventArgs.cs" />
<Compile Include="MonthViewMonth.cs" />
<Compile Include="UserControls\MonthView.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Binary file not shown.