Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / WinForms / Managed / System / WinForms / SelectionRange.cs / 1 / 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
- XPathDocumentNavigator.cs
- Queue.cs
- ReadOnlyCollectionBase.cs
- Line.cs
- Literal.cs
- AnimatedTypeHelpers.cs
- _ConnectionGroup.cs
- FormsAuthenticationEventArgs.cs
- HttpException.cs
- SqlServer2KCompatibilityAnnotation.cs
- TextReader.cs
- WindowInteropHelper.cs
- Win32.cs
- ResXResourceWriter.cs
- NotSupportedException.cs
- CommonDialog.cs
- Rectangle.cs
- HttpPostServerProtocol.cs
- XmlEncodedRawTextWriter.cs
- Buffer.cs
- ArraySegment.cs
- SubordinateTransaction.cs
- FontInfo.cs
- PersonalizableTypeEntry.cs
- SqlExpander.cs
- RouteCollection.cs
- MessageQueuePermission.cs
- HttpWebResponse.cs
- AsymmetricKeyExchangeDeformatter.cs
- SBCSCodePageEncoding.cs
- COM2TypeInfoProcessor.cs
- DocumentsTrace.cs
- ToolStripPanelRow.cs
- SecurityTraceRecordHelper.cs
- InvalidPipelineStoreException.cs
- XPathQilFactory.cs
- ProxyWebPartConnectionCollection.cs
- SecurityPolicySection.cs
- storepermission.cs
- DataGridViewTopRowAccessibleObject.cs
- ImageIndexConverter.cs
- WebScriptServiceHost.cs
- Calendar.cs
- TrackingSection.cs
- WebPartTransformerAttribute.cs
- ControlCollection.cs
- SimpleColumnProvider.cs
- JournalEntry.cs
- COM2IDispatchConverter.cs
- ScrollableControl.cs
- DynamicMethod.cs
- QualifiedCellIdBoolean.cs
- JapaneseCalendar.cs
- WebPartMenu.cs
- CheckableControlBaseAdapter.cs
- WebBrowser.cs
- NumberEdit.cs
- MethodCallConverter.cs
- CodeVariableReferenceExpression.cs
- TextAutomationPeer.cs
- CalendarBlackoutDatesCollection.cs
- PropertyInfoSet.cs
- ListViewHitTestInfo.cs
- NotCondition.cs
- GridViewColumnCollection.cs
- CodeTypeReference.cs
- SerializationInfo.cs
- ProfileProvider.cs
- validation.cs
- GroupItem.cs
- PropertyDescriptorCollection.cs
- SQLResource.cs
- PartialCachingAttribute.cs
- WebCategoryAttribute.cs
- FillRuleValidation.cs
- XmlEntity.cs
- FixedStringLookup.cs
- HandleRef.cs
- OracleCommandSet.cs
- Automation.cs
- ProtocolsConfigurationEntry.cs
- BindingEntityInfo.cs
- DesignerProperties.cs
- shaper.cs
- BulletChrome.cs
- ZipIOLocalFileBlock.cs
- RequestResizeEvent.cs
- XPathNode.cs
- DictionarySectionHandler.cs
- SymbolMethod.cs
- BitmapFrameEncode.cs
- RowToParametersTransformer.cs
- TreeNodeStyleCollection.cs
- SQLChars.cs
- VScrollBar.cs
- BaseAutoFormat.cs
- SoapAttributeOverrides.cs
- AccessorTable.cs
- Transform3D.cs
- DbConnectionPoolCounters.cs