Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / WinForms / Managed / System / WinForms / SelectionRange.cs / 1305376 / SelectionRange.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Windows.Forms {
using System.Runtime.Serialization.Formatters;
using System.Diagnostics;
using System;
using System.Globalization;
using System.Drawing;
using System.Windows.Forms;
using System.ComponentModel;
using System.IO;
using Microsoft.Win32;
///
///
/// This is a class that represents the date selection range of a MonthCalendar control.
///
[
TypeConverterAttribute(typeof(SelectionRangeConverter))
]
public sealed class SelectionRange {
///
///
/// The lower limit of the selection range.
///
private DateTime start = DateTime.MinValue.Date;
///
///
/// The upper limit of the selection range.
///
private DateTime end = DateTime.MaxValue.Date;
///
///
/// Create a new SelectionRange object with the range [null, null].
///
public SelectionRange() {
}
///
///
/// Create a new SelectionRange object with the given range.
///
public SelectionRange(DateTime lower, DateTime upper) {
//NOTE: simcooke: we explicitly DO NOT want to throw an exception here - just silently
// swap them around. This is because the win32 control can return non-
// normalized ranges.
// We use lower.Date and upper.Date to remove any time component
//
if (lower < upper) {
start = lower.Date;
end = upper.Date;
}
else {
start = upper.Date;
end = lower.Date;
}
}
///
///
/// Create a new SelectionRange object given an existing SelectionRange object.
///
public SelectionRange(SelectionRange range) {
this.start = range.start;
this.end = range.end;
}
///
///
/// Returns the ending time of this range.
///
public DateTime End {
get {
return end;
}
set {
end = value.Date;
}
}
///
///
/// Starting time of this range
///
public DateTime Start {
get {
return start;
}
set {
start = value.Date;
}
}
///
///
/// Returns a string representation for this control.
///
///
public override string ToString() {
return "SelectionRange: Start: " + start.ToString() + ", End: " + end.ToString();
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Track.cs
- CallId.cs
- ParserStack.cs
- TiffBitmapDecoder.cs
- WebExceptionStatus.cs
- EntityCommandExecutionException.cs
- XmlToDatasetMap.cs
- ResourceProperty.cs
- MarkupCompilePass1.cs
- FunctionDetailsReader.cs
- CrossAppDomainChannel.cs
- XmlNamespaceManager.cs
- QilIterator.cs
- AppDomainInstanceProvider.cs
- XmlNodeList.cs
- TimeZone.cs
- StorageSetMapping.cs
- TextEndOfParagraph.cs
- HtmlInputText.cs
- StreamAsIStream.cs
- TableSectionStyle.cs
- AppSettingsReader.cs
- ClassicBorderDecorator.cs
- AnnotationHighlightLayer.cs
- SafeTimerHandle.cs
- RootBrowserWindowAutomationPeer.cs
- LinkedList.cs
- SchemaObjectWriter.cs
- ListView.cs
- TypeValidationEventArgs.cs
- ActivityExecutor.cs
- LostFocusEventManager.cs
- VirtualizedContainerService.cs
- UInt32Storage.cs
- MdiWindowListItemConverter.cs
- AssemblyResourceLoader.cs
- ButtonChrome.cs
- ScriptingJsonSerializationSection.cs
- ICspAsymmetricAlgorithm.cs
- WebPartConnectionCollection.cs
- BulletedList.cs
- Error.cs
- TemplateLookupAction.cs
- UriSectionData.cs
- FormatterServicesNoSerializableCheck.cs
- Soap12ProtocolReflector.cs
- WindowsSecurityTokenAuthenticator.cs
- AssemblyBuilderData.cs
- isolationinterop.cs
- OrderedDictionaryStateHelper.cs
- DocumentSequenceHighlightLayer.cs
- DispatcherFrame.cs
- HttpClientCertificate.cs
- AsnEncodedData.cs
- Label.cs
- FormatException.cs
- AppSettingsExpressionBuilder.cs
- cookiecontainer.cs
- SQLSingle.cs
- XamlTreeBuilderBamlRecordWriter.cs
- dataprotectionpermission.cs
- FixedSOMTableCell.cs
- CorePropertiesFilter.cs
- WebBrowserNavigatingEventHandler.cs
- ComponentConverter.cs
- ObjectDataSource.cs
- SerializationObjectManager.cs
- FormatSettings.cs
- FatalException.cs
- Restrictions.cs
- XmlCodeExporter.cs
- LinqDataSourceDeleteEventArgs.cs
- StdValidatorsAndConverters.cs
- AnchoredBlock.cs
- externdll.cs
- CodeTypeMemberCollection.cs
- SettingsAttributeDictionary.cs
- DataRecord.cs
- HostAdapter.cs
- XmlElementAttributes.cs
- WaitForChangedResult.cs
- ActionFrame.cs
- MessageEncodingBindingElementImporter.cs
- DBCommand.cs
- FormatterConverter.cs
- WebConfigurationHostFileChange.cs
- MemberDomainMap.cs
- SmtpNtlmAuthenticationModule.cs
- ForEachAction.cs
- ToolStripPanelRow.cs
- TypeElement.cs
- ResourcePart.cs
- Point4D.cs
- DummyDataSource.cs
- CompatibleIComparer.cs
- ConnectionPointGlyph.cs
- FixedPageAutomationPeer.cs
- DefaultTraceListener.cs
- DictionaryTraceRecord.cs
- FloaterBaseParagraph.cs