Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / Input / Stylus / StylusPointPropertyInfo.cs / 1305600 / 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("unit", (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("unit", (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
- Quack.cs
- BitmapSizeOptions.cs
- LambdaCompiler.Binary.cs
- GZipDecoder.cs
- ContainerParagraph.cs
- BlobPersonalizationState.cs
- WSSecureConversationFeb2005.cs
- PKCS1MaskGenerationMethod.cs
- SQLBytesStorage.cs
- ExceptionUtil.cs
- TypefaceCollection.cs
- BaseHashHelper.cs
- TranslateTransform3D.cs
- GeneralTransform2DTo3DTo2D.cs
- HttpCacheParams.cs
- SqlParameter.cs
- UserUseLicenseDictionaryLoader.cs
- ClientCultureInfo.cs
- EventItfInfo.cs
- isolationinterop.cs
- SqlUnionizer.cs
- URL.cs
- RootBrowserWindowProxy.cs
- StandardCommands.cs
- DesignerUtils.cs
- XmlRawWriter.cs
- Tuple.cs
- PropertyTabAttribute.cs
- UnsignedPublishLicense.cs
- PaintValueEventArgs.cs
- StylusPoint.cs
- FunctionDescription.cs
- MultiBindingExpression.cs
- SamlAuthorizationDecisionStatement.cs
- EditorZoneBase.cs
- CheckPair.cs
- GetPageCompletedEventArgs.cs
- TemplateInstanceAttribute.cs
- FtpWebRequest.cs
- ServiceModelPerformanceCounters.cs
- Certificate.cs
- InkPresenter.cs
- Selection.cs
- LabelLiteral.cs
- SafeSystemMetrics.cs
- Queue.cs
- ClientSideQueueItem.cs
- ErrorFormatterPage.cs
- WindowsStatic.cs
- sqlmetadatafactory.cs
- GenericQueueSurrogate.cs
- XmlTypeMapping.cs
- mediaeventargs.cs
- OutputCacheSettingsSection.cs
- ThreadExceptionEvent.cs
- IPGlobalProperties.cs
- FormViewDeleteEventArgs.cs
- RowToFieldTransformer.cs
- EntityDataSourceWizardForm.cs
- FileLoadException.cs
- IsolatedStorage.cs
- UInt16Storage.cs
- HttpCapabilitiesSectionHandler.cs
- XmlReaderDelegator.cs
- TemplateNodeContextMenu.cs
- ComboBoxAutomationPeer.cs
- FlowLayoutSettings.cs
- SoapElementAttribute.cs
- OptimizedTemplateContentHelper.cs
- DataGridViewRowHeaderCell.cs
- FtpWebRequest.cs
- ProgressBarRenderer.cs
- TransactionCache.cs
- xmlfixedPageInfo.cs
- RoleServiceManager.cs
- DataGridViewTextBoxCell.cs
- WindowsSolidBrush.cs
- AuthStoreRoleProvider.cs
- log.cs
- PagePropertiesChangingEventArgs.cs
- SystemUdpStatistics.cs
- InstanceDescriptor.cs
- TableRowCollection.cs
- HtmlTitle.cs
- HuffModule.cs
- DependencyObject.cs
- SpellerError.cs
- FontWeight.cs
- RegexInterpreter.cs
- BrowserInteropHelper.cs
- ErrorFormatterPage.cs
- ExceptionWrapper.cs
- PermissionListSet.cs
- ContainerControl.cs
- SimpleType.cs
- HideDisabledControlAdapter.cs
- RegexCaptureCollection.cs
- BitVector32.cs
- Misc.cs
- StaticSiteMapProvider.cs