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
- IISUnsafeMethods.cs
- DesignerActionMethodItem.cs
- sqlinternaltransaction.cs
- TraceHelpers.cs
- AttachedAnnotation.cs
- BindValidator.cs
- SimpleFieldTemplateFactory.cs
- RSAOAEPKeyExchangeFormatter.cs
- RawUIStateInputReport.cs
- TextDecorationCollectionConverter.cs
- Screen.cs
- ChameleonKey.cs
- UdpChannelFactory.cs
- XmlSchemaImporter.cs
- RandomNumberGenerator.cs
- XmlSchemaSimpleContent.cs
- MemberMaps.cs
- MessageLoggingElement.cs
- CodeAssignStatement.cs
- InvokePatternIdentifiers.cs
- SynchronizedDispatch.cs
- TableDetailsCollection.cs
- NumberFormatter.cs
- TypedOperationInfo.cs
- DesignTimeXamlWriter.cs
- XmlRawWriterWrapper.cs
- DataGridState.cs
- QilScopedVisitor.cs
- PrefixQName.cs
- SqlDataSourceConfigureSortForm.cs
- _SingleItemRequestCache.cs
- RuleRefElement.cs
- WebBrowserContainer.cs
- BookmarkResumptionRecord.cs
- SystemIPInterfaceStatistics.cs
- PointConverter.cs
- RadioButtonStandardAdapter.cs
- JsonStringDataContract.cs
- AssociationSetEnd.cs
- webproxy.cs
- RequestStatusBarUpdateEventArgs.cs
- SqlDataSourceSelectingEventArgs.cs
- FixedSOMImage.cs
- SqlUtils.cs
- MSG.cs
- ViewLoader.cs
- DesignTimeTemplateParser.cs
- DbReferenceCollection.cs
- HitTestWithGeometryDrawingContextWalker.cs
- ArglessEventHandlerProxy.cs
- DataGridSortCommandEventArgs.cs
- SQlBooleanStorage.cs
- CultureInfoConverter.cs
- EntityFrameworkVersions.cs
- InvokeProviderWrapper.cs
- ApplicationHost.cs
- CellTreeNodeVisitors.cs
- CellConstantDomain.cs
- HttpValueCollection.cs
- SrgsDocument.cs
- GroupBox.cs
- ContainerParaClient.cs
- dbenumerator.cs
- SapiInterop.cs
- DataGridRowHeader.cs
- FocusTracker.cs
- ComplexType.cs
- SspiSafeHandles.cs
- WCFServiceClientProxyGenerator.cs
- EnumValAlphaComparer.cs
- QilInvoke.cs
- RoleBoolean.cs
- InProcStateClientManager.cs
- ToolStripSplitButton.cs
- DocumentApplicationState.cs
- cryptoapiTransform.cs
- RequestCachePolicy.cs
- TranslateTransform.cs
- IdleTimeoutMonitor.cs
- OciHandle.cs
- SqlFlattener.cs
- UserInitiatedRoutedEventPermission.cs
- TextEffectCollection.cs
- SqlDataSourceCache.cs
- DataGridViewTopRowAccessibleObject.cs
- OdbcCommandBuilder.cs
- TextTreeTextBlock.cs
- FontResourceCache.cs
- NativeMethods.cs
- XmlSchemaAttributeGroup.cs
- Events.cs
- SerialReceived.cs
- XmlILStorageConverter.cs
- DependencyPropertyKey.cs
- UrlPropertyAttribute.cs
- ConnectionsZone.cs
- CalendarDayButton.cs
- ManipulationVelocities.cs
- StartFileNameEditor.cs
- DataSourceXmlSubItemAttribute.cs