Code:
/ 4.0 / 4.0 / 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. //------------------------------------------------------------------------------ // // 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
- DbConnectionPoolIdentity.cs
- CryptoHelper.cs
- RegexWriter.cs
- XmlCharacterData.cs
- ComplexPropertyEntry.cs
- HtmlTextArea.cs
- AutomationPeer.cs
- SchemaObjectWriter.cs
- DataGridView.cs
- WebPartUtil.cs
- Effect.cs
- HebrewNumber.cs
- FlowLayoutSettings.cs
- Int32CollectionConverter.cs
- ConstructorNeedsTagAttribute.cs
- Rss20FeedFormatter.cs
- SystemInfo.cs
- ZipFileInfo.cs
- Root.cs
- Int16Storage.cs
- RMPublishingDialog.cs
- HandlerMappingMemo.cs
- ConstraintCollection.cs
- QilInvokeLateBound.cs
- NativeRecognizer.cs
- ValueSerializerAttribute.cs
- ColumnCollection.cs
- ResolveCriteriaApril2005.cs
- PackWebResponse.cs
- Rule.cs
- EndpointPerformanceCounters.cs
- ModelUIElement3D.cs
- SqlStream.cs
- DragStartedEventArgs.cs
- MediaElement.cs
- ArgumentOutOfRangeException.cs
- RoutedEventValueSerializer.cs
- WsdlInspector.cs
- RequestCacheValidator.cs
- WebPartDisplayModeCollection.cs
- CoreSwitches.cs
- GlyphRun.cs
- ZipFileInfoCollection.cs
- BaseDataList.cs
- BinaryConverter.cs
- RequestStatusBarUpdateEventArgs.cs
- SoapCodeExporter.cs
- TransformConverter.cs
- ToolboxItemCollection.cs
- Rect3D.cs
- GridPattern.cs
- UInt16.cs
- MimeWriter.cs
- Point4D.cs
- EnvironmentPermission.cs
- DataTableNewRowEvent.cs
- CorrelationValidator.cs
- ButtonStandardAdapter.cs
- WebPartConnectionsCancelVerb.cs
- CollectionViewGroup.cs
- WinEventHandler.cs
- XmlNodeReader.cs
- UnknownExceptionActionHelper.cs
- Schema.cs
- XmlComment.cs
- ActivationServices.cs
- StreamUpdate.cs
- XmlCharCheckingWriter.cs
- SqlCaseSimplifier.cs
- HMACSHA256.cs
- AsyncPostBackTrigger.cs
- XmlNodeChangedEventManager.cs
- RegistryKey.cs
- CodeMemberField.cs
- FormViewUpdatedEventArgs.cs
- COM2ColorConverter.cs
- TextSegment.cs
- TypedColumnHandler.cs
- ConfigurationValues.cs
- BamlReader.cs
- SmiEventSink_DeferedProcessing.cs
- PackageRelationshipSelector.cs
- regiisutil.cs
- HttpWriter.cs
- PatternMatcher.cs
- DbDataRecord.cs
- ViewBox.cs
- SchemaImporter.cs
- _DomainName.cs
- PageContentCollection.cs
- WebPartZone.cs
- TypeSystem.cs
- CheckBoxBaseAdapter.cs
- _HelperAsyncResults.cs
- Win32Native.cs
- PackUriHelper.cs
- ConsoleTraceListener.cs
- SystemIPInterfaceStatistics.cs
- ClientBase.cs
- BoundField.cs