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
- MasterPageParser.cs
- InstanceKeyNotReadyException.cs
- WebPartEventArgs.cs
- CryptoConfig.cs
- PublishLicense.cs
- GridViewRowCollection.cs
- RenameRuleObjectDialog.Designer.cs
- UserControl.cs
- IntegerFacetDescriptionElement.cs
- _ListenerResponseStream.cs
- UriExt.cs
- IApplicationTrustManager.cs
- ApplicationServicesHostFactory.cs
- AuthenticateEventArgs.cs
- SystemException.cs
- RIPEMD160Managed.cs
- SeparatorAutomationPeer.cs
- CqlErrorHelper.cs
- XmlWriterTraceListener.cs
- Itemizer.cs
- UIPermission.cs
- ValuePattern.cs
- MachinePropertyVariants.cs
- InternalControlCollection.cs
- SamlAttributeStatement.cs
- FontCollection.cs
- _NetworkingPerfCounters.cs
- DragAssistanceManager.cs
- NameScope.cs
- PropertyChangeTracker.cs
- ContextMenu.cs
- CustomLineCap.cs
- CodeAccessPermission.cs
- GlyphElement.cs
- TimeSpanValidator.cs
- ParameterInfo.cs
- LineBreakRecord.cs
- ContentType.cs
- InkCanvasAutomationPeer.cs
- DataTablePropertyDescriptor.cs
- TextViewBase.cs
- BindingBase.cs
- UriTemplateClientFormatter.cs
- RtType.cs
- HMACSHA1.cs
- SqlFunctionAttribute.cs
- MethodCallTranslator.cs
- CommandField.cs
- OpCellTreeNode.cs
- ConcatQueryOperator.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- EpmTargetTree.cs
- DataBoundControlAdapter.cs
- WebPartCancelEventArgs.cs
- InnerItemCollectionView.cs
- safePerfProviderHandle.cs
- SqlServices.cs
- EntityExpressionVisitor.cs
- CharKeyFrameCollection.cs
- GlobalItem.cs
- MarshalByValueComponent.cs
- WebAdminConfigurationHelper.cs
- AppDomainAttributes.cs
- PenThreadWorker.cs
- RadioButtonPopupAdapter.cs
- ResourcePermissionBaseEntry.cs
- TemplateInstanceAttribute.cs
- DownloadProgressEventArgs.cs
- HashHelper.cs
- RangeValueProviderWrapper.cs
- StringConverter.cs
- TaskFileService.cs
- ComplexPropertyEntry.cs
- BamlLocalizer.cs
- JsonQNameDataContract.cs
- BCryptSafeHandles.cs
- TimeManager.cs
- Function.cs
- PngBitmapDecoder.cs
- StructuredTypeInfo.cs
- MapPathBasedVirtualPathProvider.cs
- CreatingCookieEventArgs.cs
- HttpStaticObjectsCollectionWrapper.cs
- ActivitySurrogateSelector.cs
- TextEditorCharacters.cs
- ClientClassGenerator.cs
- SmiContextFactory.cs
- FillBehavior.cs
- OpenTypeMethods.cs
- TheQuery.cs
- TextBlock.cs
- SymLanguageType.cs
- PageContentCollection.cs
- CheckoutException.cs
- RenderingBiasValidation.cs
- ListBox.cs
- ToolStripSettings.cs
- CustomServiceCredentials.cs
- AssemblyCache.cs
- BackStopAuthenticationModule.cs