Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- ItemChangedEventArgs.cs
- WebMessageBodyStyleHelper.cs
- TextParentUndoUnit.cs
- MarginsConverter.cs
- IProducerConsumerCollection.cs
- SvcMapFile.cs
- TransformerConfigurationWizardBase.cs
- DataViewManagerListItemTypeDescriptor.cs
- Int16Storage.cs
- TypeNameParser.cs
- XmlSchemaInfo.cs
- NavigateEvent.cs
- TextEndOfParagraph.cs
- DropShadowBitmapEffect.cs
- ItemCheckEvent.cs
- FileRegion.cs
- SQLDecimal.cs
- VisemeEventArgs.cs
- DeviceContexts.cs
- SQLStringStorage.cs
- CodeParameterDeclarationExpression.cs
- GetPageNumberCompletedEventArgs.cs
- MembershipUser.cs
- ExecutedRoutedEventArgs.cs
- DifferencingCollection.cs
- ShapeTypeface.cs
- DiscoveryDocumentSearchPattern.cs
- UnauthorizedWebPart.cs
- ExceptionUtil.cs
- IssuedSecurityTokenParameters.cs
- DebugManager.cs
- AsyncPostBackErrorEventArgs.cs
- SemanticResultValue.cs
- DataViewSetting.cs
- MethodExpr.cs
- TagMapInfo.cs
- ValidationEventArgs.cs
- SqlDataSourceCache.cs
- CellQuery.cs
- IUnknownConstantAttribute.cs
- PagedDataSource.cs
- Point3DIndependentAnimationStorage.cs
- QuotedPrintableStream.cs
- PrtTicket_Base.cs
- Size3D.cs
- StorageAssociationSetMapping.cs
- DetailsViewPagerRow.cs
- MsmqIntegrationProcessProtocolHandler.cs
- QuaternionRotation3D.cs
- initElementDictionary.cs
- XmlUtil.cs
- ServiceOperationViewControl.cs
- DynamicActivityTypeDescriptor.cs
- ListViewCancelEventArgs.cs
- DeferredBinaryDeserializerExtension.cs
- StringDictionary.cs
- AnnotationAuthorChangedEventArgs.cs
- ClrProviderManifest.cs
- GridViewRowEventArgs.cs
- DataContext.cs
- BinaryNode.cs
- FontCacheUtil.cs
- CapiHashAlgorithm.cs
- EncodingTable.cs
- InfoCardArgumentException.cs
- MobileResource.cs
- ResourcePool.cs
- PackUriHelper.cs
- mda.cs
- CompiledQuery.cs
- DataGridViewUtilities.cs
- HuffmanTree.cs
- ComNativeDescriptor.cs
- XmlReflectionImporter.cs
- DiscoveryReference.cs
- PopupEventArgs.cs
- HelpFileFileNameEditor.cs
- ApplyTemplatesAction.cs
- OperatingSystem.cs
- DataGridLinkButton.cs
- ListBoxDesigner.cs
- ObservableCollection.cs
- TaskExceptionHolder.cs
- SymbolMethod.cs
- CorrelationManager.cs
- Atom10ItemFormatter.cs
- XPathDocumentNavigator.cs
- storepermission.cs
- CrossAppDomainChannel.cs
- UnsafeNativeMethods.cs
- WebRequestModulesSection.cs
- DynamicRenderer.cs
- SmtpNtlmAuthenticationModule.cs
- TagPrefixAttribute.cs
- Rect3DConverter.cs
- ControlTemplate.cs
- UnmanagedMemoryStreamWrapper.cs
- InvalidProgramException.cs
- UserPersonalizationStateInfo.cs
- SelectedCellsCollection.cs