Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / Input / MouseButton.cs / 1305600 / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PagedDataSource.cs
- HttpDictionary.cs
- WmiEventSink.cs
- DataServiceStreamResponse.cs
- XmlSchemaElement.cs
- PriorityBinding.cs
- ApplicationException.cs
- Int16AnimationBase.cs
- Root.cs
- DependencySource.cs
- ViewManagerAttribute.cs
- ButtonChrome.cs
- RegistryPermission.cs
- CookieParameter.cs
- TargetInvocationException.cs
- EdmFunctionAttribute.cs
- MailSettingsSection.cs
- COM2PictureConverter.cs
- ICollection.cs
- NullableIntSumAggregationOperator.cs
- AssociationSetMetadata.cs
- GlobalAllocSafeHandle.cs
- MouseActionValueSerializer.cs
- dbdatarecord.cs
- NativeMethods.cs
- TreeBuilderBamlTranslator.cs
- XmlDictionaryWriter.cs
- EventLogPermissionEntryCollection.cs
- MenuCommand.cs
- TransactionWaitAsyncResult.cs
- MimeFormImporter.cs
- ExpressionEditor.cs
- DateTime.cs
- LingerOption.cs
- HandoffBehavior.cs
- IntSecurity.cs
- ClockGroup.cs
- ViewKeyConstraint.cs
- SiteMapDataSource.cs
- AudioException.cs
- TextStore.cs
- RijndaelManagedTransform.cs
- WriterOutput.cs
- ColumnWidthChangedEvent.cs
- GregorianCalendarHelper.cs
- MouseGesture.cs
- As.cs
- SystemIPGlobalProperties.cs
- SchemaMapping.cs
- RelatedCurrencyManager.cs
- AndMessageFilter.cs
- DesignerVerb.cs
- CodeNamespaceCollection.cs
- SQLInt16Storage.cs
- SelectorAutomationPeer.cs
- ErrorFormatterPage.cs
- InternalBase.cs
- ListBindingHelper.cs
- Stack.cs
- AtomServiceDocumentSerializer.cs
- RemoteWebConfigurationHost.cs
- bidPrivateBase.cs
- HttpModulesSection.cs
- SafeNativeMethods.cs
- Globals.cs
- PreviewKeyDownEventArgs.cs
- AsymmetricKeyExchangeFormatter.cs
- ShutDownListener.cs
- EntitySqlException.cs
- Int16Converter.cs
- WebPartZoneCollection.cs
- ComProxy.cs
- WebServiceErrorEvent.cs
- EventLogPermissionEntry.cs
- AlphaSortedEnumConverter.cs
- WsatRegistrationHeader.cs
- HtmlInputHidden.cs
- MenuItemStyle.cs
- Clock.cs
- GridEntry.cs
- BufferCache.cs
- WindowsRichEditRange.cs
- EventPropertyMap.cs
- EventWaitHandleSecurity.cs
- GridViewColumn.cs
- XmlDictionaryReaderQuotas.cs
- CapiHashAlgorithm.cs
- XmlSchemaSimpleContent.cs
- SessionParameter.cs
- Tablet.cs
- _ScatterGatherBuffers.cs
- DataListItem.cs
- PrimitiveSchema.cs
- StrongNameIdentityPermission.cs
- Model3D.cs
- CodeAccessSecurityEngine.cs
- TypeSchema.cs
- ReferenceCountedObject.cs
- PageScaling.cs
- Grammar.cs