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
- SqlDataSourceView.cs
- BoundField.cs
- ConfigurationValidatorAttribute.cs
- PassportIdentity.cs
- PeerCollaborationPermission.cs
- GeneralTransform2DTo3D.cs
- TextServicesContext.cs
- AssociativeAggregationOperator.cs
- InternalControlCollection.cs
- WebPartConnectVerb.cs
- ServicesExceptionNotHandledEventArgs.cs
- InsufficientMemoryException.cs
- SqlDataSourceSelectingEventArgs.cs
- SchemaRegistration.cs
- EmptyElement.cs
- UshortList2.cs
- HelpInfo.cs
- RsaSecurityToken.cs
- KnownTypesHelper.cs
- ScrollChrome.cs
- SoapEnumAttribute.cs
- sqlpipe.cs
- HtmlTableCell.cs
- ImageMap.cs
- SendingRequestEventArgs.cs
- LeafCellTreeNode.cs
- DataShape.cs
- ProviderCommandInfoUtils.cs
- RowSpanVector.cs
- ScriptResourceAttribute.cs
- PropertyValueChangedEvent.cs
- BasePropertyDescriptor.cs
- NavigationPropertyEmitter.cs
- FileLogRecord.cs
- ExternalFile.cs
- HttpValueCollection.cs
- StylusPointPropertyInfo.cs
- HttpCookiesSection.cs
- SettingsPropertyValueCollection.cs
- remotingproxy.cs
- COM2PropertyBuilderUITypeEditor.cs
- OpenFileDialog.cs
- GatewayDefinition.cs
- AstTree.cs
- PointCollectionValueSerializer.cs
- UnsafeNativeMethodsCLR.cs
- ZipArchive.cs
- InvokeBase.cs
- PathParser.cs
- DoubleLinkList.cs
- Claim.cs
- WindowsUserNameSecurityTokenAuthenticator.cs
- EmulateRecognizeCompletedEventArgs.cs
- DrawingAttributeSerializer.cs
- NotifyParentPropertyAttribute.cs
- ConfigurationStrings.cs
- SqlConnectionPoolGroupProviderInfo.cs
- CodeDelegateCreateExpression.cs
- DataBoundControl.cs
- ResetableIterator.cs
- OleDbParameterCollection.cs
- BrowserInteropHelper.cs
- DataGridColumn.cs
- ParseNumbers.cs
- CodeCatchClause.cs
- WebPartMovingEventArgs.cs
- Span.cs
- ProcessHost.cs
- MembershipSection.cs
- mactripleDES.cs
- StringArrayConverter.cs
- TrustSection.cs
- NameObjectCollectionBase.cs
- GetReadStreamResult.cs
- ArraySegment.cs
- CodeEventReferenceExpression.cs
- AttachInfo.cs
- MetafileHeader.cs
- XmlMemberMapping.cs
- InputScopeConverter.cs
- CompilationSection.cs
- WebPartDisplayModeCancelEventArgs.cs
- SelectionEditingBehavior.cs
- WebReferencesBuildProvider.cs
- XmlArrayItemAttributes.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- PointCollectionValueSerializer.cs
- VirtualDirectoryMappingCollection.cs
- DateTimePicker.cs
- GeneralTransformGroup.cs
- DBDataPermissionAttribute.cs
- TableCellAutomationPeer.cs
- Soap12ServerProtocol.cs
- MailAddress.cs
- StateWorkerRequest.cs
- DataControlFieldHeaderCell.cs
- RoleGroup.cs
- SerializerProvider.cs
- Pen.cs
- ComponentDispatcher.cs