Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / Core / CSharp / System / Windows / Input / MouseButton.cs / 1 / MouseButton.cs
using System; using MS.Internal.PresentationCore; namespace System.Windows.Input { ////// The MouseButton enumeration describes the buttons available on /// the mouse device. /// ////// You must update MouseButtonUtilities.Validate if any changes are made to this type /// public enum MouseButton { ////// The left mouse button. /// Left, ////// The middle mouse button. /// Middle, ////// The right mouse button. /// Right, ////// The fourth mouse button. /// XButton1, ////// The fifth mouse button. /// XButton2 } ////// Utility class for MouseButton /// internal sealed class MouseButtonUtilities { ////// Private placeholder constructor /// ////// There is present to supress the autogeneration of a public one, which /// triggers an FxCop violation, as this is an internal class that is never instantiated /// private MouseButtonUtilities() { } ////// Ensures MouseButton is set to a valid value. /// ////// There is a proscription against using Enum.IsDefined(). (it is slow) /// So we manually validate using a switch statement. /// [FriendAccessAllowed] internal static void Validate(MouseButton button) { switch(button) { case MouseButton.Left: case MouseButton.Middle: case MouseButton.Right: case MouseButton.XButton1: case MouseButton.XButton2: break; default: throw new System.ComponentModel.InvalidEnumArgumentException("button", (int)button, typeof(MouseButton)); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. using System; using MS.Internal.PresentationCore; namespace System.Windows.Input { ////// The MouseButton enumeration describes the buttons available on /// the mouse device. /// ////// You must update MouseButtonUtilities.Validate if any changes are made to this type /// public enum MouseButton { ////// The left mouse button. /// Left, ////// The middle mouse button. /// Middle, ////// The right mouse button. /// Right, ////// The fourth mouse button. /// XButton1, ////// The fifth mouse button. /// XButton2 } ////// Utility class for MouseButton /// internal sealed class MouseButtonUtilities { ////// Private placeholder constructor /// ////// There is present to supress the autogeneration of a public one, which /// triggers an FxCop violation, as this is an internal class that is never instantiated /// private MouseButtonUtilities() { } ////// Ensures MouseButton is set to a valid value. /// ////// There is a proscription against using Enum.IsDefined(). (it is slow) /// So we manually validate using a switch statement. /// [FriendAccessAllowed] internal static void Validate(MouseButton button) { switch(button) { case MouseButton.Left: case MouseButton.Middle: case MouseButton.Right: case MouseButton.XButton1: case MouseButton.XButton2: break; default: throw new System.ComponentModel.InvalidEnumArgumentException("button", (int)button, typeof(MouseButton)); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PDBReader.cs
- DataGridPageChangedEventArgs.cs
- ControlDesigner.cs
- MetadataFile.cs
- ThemeDictionaryExtension.cs
- OperatorExpressions.cs
- UniformGrid.cs
- BlurBitmapEffect.cs
- KeyInfo.cs
- EffectiveValueEntry.cs
- CodeArgumentReferenceExpression.cs
- NativeCompoundFileAPIs.cs
- TaskHelper.cs
- LinqDataSourceContextEventArgs.cs
- SBCSCodePageEncoding.cs
- Int32Animation.cs
- ConnectionPointCookie.cs
- BufferBuilder.cs
- TextContainerChangeEventArgs.cs
- XmlNamespaceManager.cs
- Duration.cs
- DeploymentSectionCache.cs
- UpDownEvent.cs
- DrawListViewSubItemEventArgs.cs
- FixUpCollection.cs
- SmiContext.cs
- LinkClickEvent.cs
- ContextDataSourceView.cs
- ResourceManager.cs
- TemplateField.cs
- PerformanceCounterPermission.cs
- ZoomPercentageConverter.cs
- TreeIterator.cs
- MulticastDelegate.cs
- EnumValAlphaComparer.cs
- BaseDataBoundControl.cs
- AsymmetricAlgorithm.cs
- SingleConverter.cs
- MetadataSerializer.cs
- MimeObjectFactory.cs
- MexTcpBindingCollectionElement.cs
- SupportingTokenProviderSpecification.cs
- oledbmetadatacolumnnames.cs
- EmbeddedMailObjectsCollection.cs
- SiteMapDataSourceView.cs
- TemplateBindingExpressionConverter.cs
- MetadataException.cs
- EventlogProvider.cs
- TransformPatternIdentifiers.cs
- Opcode.cs
- HeaderCollection.cs
- WindowsProgressbar.cs
- X509Certificate2Collection.cs
- XamlInt32CollectionSerializer.cs
- SafeLibraryHandle.cs
- ScaleTransform.cs
- ScriptReference.cs
- IDispatchConstantAttribute.cs
- PersonalizationStateInfo.cs
- StatusStrip.cs
- UnsafeNetInfoNativeMethods.cs
- DateTimePicker.cs
- SmiMetaData.cs
- MarkupExtensionParser.cs
- messageonlyhwndwrapper.cs
- ConfigsHelper.cs
- Literal.cs
- XmlSerializationReader.cs
- DiscoveryEndpointValidator.cs
- PreloadedPackages.cs
- Comparer.cs
- Attributes.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- AutomationPeer.cs
- RequestCachingSection.cs
- WebResourceAttribute.cs
- SmtpMail.cs
- XhtmlBasicControlAdapter.cs
- ToolStripControlHost.cs
- OleDbConnectionFactory.cs
- ExpressionBuilderContext.cs
- TreeIterators.cs
- Atom10FormatterFactory.cs
- CapabilitiesRule.cs
- RoleManagerEventArgs.cs
- BinaryExpression.cs
- ControlBuilder.cs
- Behavior.cs
- ImageField.cs
- PaintValueEventArgs.cs
- SchemaTypeEmitter.cs
- ConnectionManagementElementCollection.cs
- WindowsTreeView.cs
- SelectionProcessor.cs
- LicenseException.cs
- WindowsRegion.cs
- RegionData.cs
- LinkedList.cs
- Win32.cs
- PermissionSet.cs