Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Core / CSharp / System / Windows / Input / Stylus / StylusPointPropertyInfo.cs / 1 / StylusPointPropertyInfo.cs
//------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------- using System; using System.Windows; using System.Windows.Input; using System.Windows.Media; using System.Collections.Generic; using System.Diagnostics; using System.ComponentModel; using MS.Utility; using SR = MS.Internal.PresentationCore.SR; using SRID = MS.Internal.PresentationCore.SRID; namespace System.Windows.Input { ////// StylusPointPropertyInfo /// public class StylusPointPropertyInfo : StylusPointProperty { ////// Instance data /// private int _min; private int _max; private float _resolution; private StylusPointPropertyUnit _unit; ////// For a given StylusPointProperty, instantiates a StylusPointPropertyInfo with default values /// /// public StylusPointPropertyInfo(StylusPointProperty stylusPointProperty) : base (stylusPointProperty) //base checks for null { StylusPointPropertyInfo info = StylusPointPropertyInfoDefaults.GetStylusPointPropertyInfoDefault(stylusPointProperty); _min = info.Minimum; _max = info.Maximum; _resolution = info.Resolution; _unit = info.Unit; } ////// StylusPointProperty /// /// /// minimum /// maximum /// unit /// resolution public StylusPointPropertyInfo(StylusPointProperty stylusPointProperty, int minimum, int maximum, StylusPointPropertyUnit unit, float resolution) : base(stylusPointProperty) //base checks for null { // validate unit if (!StylusPointPropertyUnitHelper.IsDefined(unit)) { throw new InvalidEnumArgumentException("StylusPointPropertyUnit", (int)unit, typeof(StylusPointPropertyUnit)); } // validate min/max if (maximum < minimum) { throw new ArgumentException(SR.Get(SRID.Stylus_InvalidMax), "maximum"); } // validate resolution if (resolution < 0.0f) { throw new ArgumentException(SR.Get(SRID.InvalidStylusPointPropertyInfoResolution), "resolution"); } _min = minimum; _max = maximum; _resolution = resolution; _unit = unit; } ////// Minimum /// public int Minimum { get { return _min; } } ////// Maximum /// public int Maximum { get { return _max; } } ////// Resolution /// public float Resolution { get { return _resolution; } } ////// Unit /// public StylusPointPropertyUnit Unit { get { return _unit; } } ////// Internal helper method for comparing compat for two StylusPointPropertyInfos /// internal static bool AreCompatible(StylusPointPropertyInfo stylusPointPropertyInfo1, StylusPointPropertyInfo stylusPointPropertyInfo2) { if (stylusPointPropertyInfo1 == null || stylusPointPropertyInfo2 == null) { throw new ArgumentNullException("stylusPointPropertyInfo"); } Debug.Assert(( stylusPointPropertyInfo1.Id != StylusPointPropertyIds.X && stylusPointPropertyInfo1.Id != StylusPointPropertyIds.Y && stylusPointPropertyInfo2.Id != StylusPointPropertyIds.X && stylusPointPropertyInfo2.Id != StylusPointPropertyIds.Y), "Why are you checking X, Y for compatibility? They're always compatible"); // // we only take ID and IsButton into account, we don't take metrics into account // return (stylusPointPropertyInfo1.Id == stylusPointPropertyInfo2.Id && stylusPointPropertyInfo1.IsButton == stylusPointPropertyInfo2.IsButton); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------- using System; using System.Windows; using System.Windows.Input; using System.Windows.Media; using System.Collections.Generic; using System.Diagnostics; using System.ComponentModel; using MS.Utility; using SR = MS.Internal.PresentationCore.SR; using SRID = MS.Internal.PresentationCore.SRID; namespace System.Windows.Input { ////// StylusPointPropertyInfo /// public class StylusPointPropertyInfo : StylusPointProperty { ////// Instance data /// private int _min; private int _max; private float _resolution; private StylusPointPropertyUnit _unit; ////// For a given StylusPointProperty, instantiates a StylusPointPropertyInfo with default values /// /// public StylusPointPropertyInfo(StylusPointProperty stylusPointProperty) : base (stylusPointProperty) //base checks for null { StylusPointPropertyInfo info = StylusPointPropertyInfoDefaults.GetStylusPointPropertyInfoDefault(stylusPointProperty); _min = info.Minimum; _max = info.Maximum; _resolution = info.Resolution; _unit = info.Unit; } ////// StylusPointProperty /// /// /// minimum /// maximum /// unit /// resolution public StylusPointPropertyInfo(StylusPointProperty stylusPointProperty, int minimum, int maximum, StylusPointPropertyUnit unit, float resolution) : base(stylusPointProperty) //base checks for null { // validate unit if (!StylusPointPropertyUnitHelper.IsDefined(unit)) { throw new InvalidEnumArgumentException("StylusPointPropertyUnit", (int)unit, typeof(StylusPointPropertyUnit)); } // validate min/max if (maximum < minimum) { throw new ArgumentException(SR.Get(SRID.Stylus_InvalidMax), "maximum"); } // validate resolution if (resolution < 0.0f) { throw new ArgumentException(SR.Get(SRID.InvalidStylusPointPropertyInfoResolution), "resolution"); } _min = minimum; _max = maximum; _resolution = resolution; _unit = unit; } ////// Minimum /// public int Minimum { get { return _min; } } ////// Maximum /// public int Maximum { get { return _max; } } ////// Resolution /// public float Resolution { get { return _resolution; } } ////// Unit /// public StylusPointPropertyUnit Unit { get { return _unit; } } ////// Internal helper method for comparing compat for two StylusPointPropertyInfos /// internal static bool AreCompatible(StylusPointPropertyInfo stylusPointPropertyInfo1, StylusPointPropertyInfo stylusPointPropertyInfo2) { if (stylusPointPropertyInfo1 == null || stylusPointPropertyInfo2 == null) { throw new ArgumentNullException("stylusPointPropertyInfo"); } Debug.Assert(( stylusPointPropertyInfo1.Id != StylusPointPropertyIds.X && stylusPointPropertyInfo1.Id != StylusPointPropertyIds.Y && stylusPointPropertyInfo2.Id != StylusPointPropertyIds.X && stylusPointPropertyInfo2.Id != StylusPointPropertyIds.Y), "Why are you checking X, Y for compatibility? They're always compatible"); // // we only take ID and IsButton into account, we don't take metrics into account // return (stylusPointPropertyInfo1.Id == stylusPointPropertyInfo2.Id && stylusPointPropertyInfo1.IsButton == stylusPointPropertyInfo2.IsButton); } } } // 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
- SqlIdentifier.cs
- ToolStripDropTargetManager.cs
- ParagraphResult.cs
- WebPartDescriptionCollection.cs
- PropertyValidationContext.cs
- GridViewAutomationPeer.cs
- TextEditorSelection.cs
- ProfileParameter.cs
- RowParagraph.cs
- EncodingInfo.cs
- DataServiceResponse.cs
- PreservationFileWriter.cs
- TypeGeneratedEventArgs.cs
- BulletedList.cs
- FragmentQueryKB.cs
- InputScopeConverter.cs
- CapabilitiesState.cs
- RootBrowserWindowAutomationPeer.cs
- SignatureGenerator.cs
- SafeFileMappingHandle.cs
- BasicCellRelation.cs
- BindingSource.cs
- SvcMapFileLoader.cs
- SqlClientMetaDataCollectionNames.cs
- XmlValidatingReaderImpl.cs
- LongMinMaxAggregationOperator.cs
- XmlSchemaObjectTable.cs
- WebHttpBindingCollectionElement.cs
- LineMetrics.cs
- Underline.cs
- unitconverter.cs
- EvidenceTypeDescriptor.cs
- CollectionBase.cs
- ListViewItemMouseHoverEvent.cs
- baseshape.cs
- GlyphRun.cs
- TcpProcessProtocolHandler.cs
- RemoteTokenFactory.cs
- AssemblyHash.cs
- IgnoreSectionHandler.cs
- QuaternionAnimation.cs
- SchemaElementDecl.cs
- ReadContentAsBinaryHelper.cs
- MergeFilterQuery.cs
- WebPartVerbsEventArgs.cs
- DESCryptoServiceProvider.cs
- DataList.cs
- SafeCoTaskMem.cs
- UnmanagedMemoryAccessor.cs
- _ListenerRequestStream.cs
- GridViewUpdatedEventArgs.cs
- ScriptingScriptResourceHandlerSection.cs
- CollectionType.cs
- RouteData.cs
- DesignerVerbCollection.cs
- tooltip.cs
- FieldToken.cs
- odbcmetadatacolumnnames.cs
- IdentityNotMappedException.cs
- ToolStripPanelSelectionGlyph.cs
- BadImageFormatException.cs
- ColumnWidthChangingEvent.cs
- CacheDependency.cs
- XPathParser.cs
- DesignerTransactionCloseEvent.cs
- SortedDictionary.cs
- InputLanguageManager.cs
- DbProviderSpecificTypePropertyAttribute.cs
- WebBrowserContainer.cs
- GridItem.cs
- XmlSchemaAnnotated.cs
- FormViewDeleteEventArgs.cs
- XmlSchemaAnnotation.cs
- AnnotationMap.cs
- ValueProviderWrapper.cs
- AuthenticationModuleElementCollection.cs
- ObjectTag.cs
- MediaSystem.cs
- ParameterCollection.cs
- StreamAsIStream.cs
- ImageDesigner.cs
- Visitor.cs
- EventMappingSettingsCollection.cs
- AsyncPostBackTrigger.cs
- EntityDataSourceWrapper.cs
- BindingWorker.cs
- DecoderFallbackWithFailureFlag.cs
- InvalidProgramException.cs
- Base64Encoding.cs
- DtdParser.cs
- ExtendedProtectionPolicy.cs
- ParameterRetriever.cs
- IgnoreFileBuildProvider.cs
- DataBinding.cs
- StylusCaptureWithinProperty.cs
- StoragePropertyMapping.cs
- MetadataFile.cs
- PathGeometry.cs
- HostVisual.cs
- SQLInt64Storage.cs