Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- NameValuePair.cs
- WebEventTraceProvider.cs
- CodeExpressionCollection.cs
- ScaleTransform3D.cs
- WorkflowViewService.cs
- FrameworkElementAutomationPeer.cs
- ISessionStateStore.cs
- Parsers.cs
- CompilationPass2TaskInternal.cs
- ConfigXmlText.cs
- ObjectDataSourceWizardForm.cs
- StringWriter.cs
- ContractAdapter.cs
- QilInvokeEarlyBound.cs
- HostProtectionPermission.cs
- QilInvokeLateBound.cs
- Byte.cs
- JournalEntry.cs
- LoginView.cs
- ThemeInfoAttribute.cs
- ActivityDesignerLayoutSerializers.cs
- ResourceType.cs
- TextServicesContext.cs
- VirtualDirectoryMappingCollection.cs
- DataServiceContext.cs
- arc.cs
- CatalogZoneAutoFormat.cs
- ResourceProviderFactory.cs
- ItemType.cs
- CodeExpressionStatement.cs
- WMIInterop.cs
- TextOptionsInternal.cs
- ForwardPositionQuery.cs
- ValidationUtility.cs
- SqlServices.cs
- CacheDict.cs
- HotSpotCollection.cs
- Cursors.cs
- SafeWaitHandle.cs
- StreamReader.cs
- TCEAdapterGenerator.cs
- ToolStripContentPanelRenderEventArgs.cs
- CookielessData.cs
- SourceInterpreter.cs
- AutoSizeComboBox.cs
- IntSecurity.cs
- DataSourceConverter.cs
- AspNetRouteServiceHttpHandler.cs
- ButtonBaseDesigner.cs
- WizardPanel.cs
- PopupEventArgs.cs
- GridViewUpdateEventArgs.cs
- TemplateControl.cs
- WebExceptionStatus.cs
- PackageRelationship.cs
- CheckBox.cs
- SqlServer2KCompatibilityAnnotation.cs
- XmlSchemaValidator.cs
- MergeEnumerator.cs
- CryptoApi.cs
- RelatedPropertyManager.cs
- Application.cs
- ProfilePropertyNameValidator.cs
- Int32Rect.cs
- PrintController.cs
- BufferedGraphics.cs
- ConfigXmlAttribute.cs
- ConfigurationPropertyAttribute.cs
- MergablePropertyAttribute.cs
- ExpressionPrinter.cs
- EditCommandColumn.cs
- MutexSecurity.cs
- TrustSection.cs
- ProfileSection.cs
- ProfileInfo.cs
- AppDomainFactory.cs
- NotificationContext.cs
- ThreadSafeMessageFilterTable.cs
- TraceRecord.cs
- RandomNumberGenerator.cs
- OleDbDataAdapter.cs
- ChildDocumentBlock.cs
- ProvidePropertyAttribute.cs
- PrintPreviewControl.cs
- ProfileInfo.cs
- TypeBuilder.cs
- MsmqDecodeHelper.cs
- TypedMessageConverter.cs
- SamlAdvice.cs
- BevelBitmapEffect.cs
- ToolStripItem.cs
- TemplateAction.cs
- _DomainName.cs
- FindCriteriaCD1.cs
- WinInet.cs
- ObjectMaterializedEventArgs.cs
- sqlstateclientmanager.cs
- ConnectionConsumerAttribute.cs
- ArgumentException.cs
- BitmapEffectInputData.cs