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

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- AddInAdapter.cs
- ScaleTransform3D.cs
- DataGridCaption.cs
- DropDownButton.cs
- EventSetter.cs
- DeviceContexts.cs
- Timer.cs
- PersonalizableTypeEntry.cs
- HttpCacheVary.cs
- WebControlAdapter.cs
- DBDataPermission.cs
- InternalBufferOverflowException.cs
- XPathAncestorIterator.cs
- FontStyleConverter.cs
- SystemInformation.cs
- MarkupProperty.cs
- NameValueFileSectionHandler.cs
- WebBrowserHelper.cs
- HttpCookiesSection.cs
- ProgressBarRenderer.cs
- ValidationError.cs
- AmbientProperties.cs
- ObjectDataSourceDisposingEventArgs.cs
- LicenseContext.cs
- HtmlInputSubmit.cs
- WebPartPersonalization.cs
- FtpRequestCacheValidator.cs
- PerformanceCounterPermissionAttribute.cs
- IdentityHolder.cs
- DataRelationCollection.cs
- EntityReference.cs
- Monitor.cs
- WsdlInspector.cs
- IsolatedStorageException.cs
- PrintPreviewGraphics.cs
- HtmlValidationSummaryAdapter.cs
- HtmlInputCheckBox.cs
- _BufferOffsetSize.cs
- JsonWriter.cs
- RequestNavigateEventArgs.cs
- XamlSerializerUtil.cs
- CodeTypeDeclarationCollection.cs
- Model3DCollection.cs
- DataGridViewColumnEventArgs.cs
- RequestNavigateEventArgs.cs
- ClientReliableChannelBinder.cs
- ControlUtil.cs
- TrackingProvider.cs
- SystemIPGlobalStatistics.cs
- MetaModel.cs
- ImportOptions.cs
- DataGridViewColumnConverter.cs
- HttpsChannelListener.cs
- XPathDocument.cs
- EdmMember.cs
- SecureUICommand.cs
- Pts.cs
- PenThreadPool.cs
- AppSettingsExpressionBuilder.cs
- RelationshipType.cs
- Pen.cs
- SqlTransaction.cs
- HashMembershipCondition.cs
- CheckBox.cs
- TemplateBaseAction.cs
- MetadataSource.cs
- EmptyImpersonationContext.cs
- AutomationPatternInfo.cs
- MetadataWorkspace.cs
- DetailsViewRow.cs
- CompositeDuplexBindingElementImporter.cs
- BufferBuilder.cs
- SQLMoney.cs
- GeneralTransform3D.cs
- InternalBase.cs
- VsPropertyGrid.cs
- DriveNotFoundException.cs
- SystemIcons.cs
- SchemaComplexType.cs
- XmlMemberMapping.cs
- ReadOnlyObservableCollection.cs
- Helpers.cs
- Transform.cs
- DataTableCollection.cs
- ConfigurationLocationCollection.cs
- DataListCommandEventArgs.cs
- WindowPattern.cs
- CookieProtection.cs
- ConfigurationStrings.cs
- DataGridViewComboBoxEditingControl.cs
- ScrollBar.cs
- QilPatternVisitor.cs
- Binding.cs
- ButtonAutomationPeer.cs
- WebPartConnectionsConfigureVerb.cs
- cache.cs
- XmlMapping.cs
- TextAutomationPeer.cs
- CustomWebEventKey.cs
- ImagingCache.cs