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
- WithStatement.cs
- RegionInfo.cs
- SymmetricAlgorithm.cs
- DataGridViewCell.cs
- CodeGroup.cs
- TextBreakpoint.cs
- PathFigureCollectionConverter.cs
- ScopeElement.cs
- UnaryExpression.cs
- TextTrailingWordEllipsis.cs
- FloaterParagraph.cs
- DocumentViewerAutomationPeer.cs
- FileChangesMonitor.cs
- DataTemplateKey.cs
- ResourceManager.cs
- DurableMessageDispatchInspector.cs
- NonVisualControlAttribute.cs
- WebRequestModuleElement.cs
- SourceLineInfo.cs
- metadatamappinghashervisitor.cs
- DataExchangeServiceBinder.cs
- XPathChildIterator.cs
- DataGridViewCheckBoxCell.cs
- SystemIPv6InterfaceProperties.cs
- XslVisitor.cs
- DataErrorValidationRule.cs
- DataSet.cs
- TypeConverterValueSerializer.cs
- IisTraceWebEventProvider.cs
- MenuItemStyleCollection.cs
- PerformanceCounterLib.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- InputLangChangeEvent.cs
- ConfigXmlText.cs
- _ScatterGatherBuffers.cs
- SourceFileInfo.cs
- CodeCompiler.cs
- XmlAttribute.cs
- TextControl.cs
- RealizationDrawingContextWalker.cs
- xmlformatgeneratorstatics.cs
- TextContainerHelper.cs
- StorageAssociationTypeMapping.cs
- RenderDataDrawingContext.cs
- RadioButton.cs
- basenumberconverter.cs
- TextElement.cs
- IDQuery.cs
- ListItemCollection.cs
- ColumnClickEvent.cs
- AvTraceDetails.cs
- ParameterToken.cs
- EntityObject.cs
- Bidi.cs
- StylusButtonEventArgs.cs
- RealizedColumnsBlock.cs
- MissingSatelliteAssemblyException.cs
- Keyboard.cs
- EventMappingSettings.cs
- CqlParser.cs
- EmbeddedMailObjectsCollection.cs
- MsmqChannelFactory.cs
- UInt16.cs
- HttpPostedFile.cs
- UdpSocket.cs
- smtppermission.cs
- Activator.cs
- DeploymentSection.cs
- SelectionRangeConverter.cs
- NetworkCredential.cs
- RequestResizeEvent.cs
- PathFigure.cs
- PenLineCapValidation.cs
- FileChangesMonitor.cs
- SequentialWorkflowRootDesigner.cs
- Preprocessor.cs
- TransformCryptoHandle.cs
- ImageCodecInfoPrivate.cs
- ValidationSummary.cs
- OdbcEnvironmentHandle.cs
- TextRangeEditTables.cs
- TextSpan.cs
- DocumentOrderQuery.cs
- RelatedImageListAttribute.cs
- BitmapSource.cs
- ArraySubsetEnumerator.cs
- BindingListCollectionView.cs
- RegexFCD.cs
- StringCollectionEditor.cs
- SchemaDeclBase.cs
- DBSqlParserTable.cs
- SpAudioStreamWrapper.cs
- CollectionBuilder.cs
- ActivationArguments.cs
- SQLSingleStorage.cs
- WsatTransactionInfo.cs
- ImpersonationContext.cs
- ColorKeyFrameCollection.cs
- IgnoreFileBuildProvider.cs
- TabItemWrapperAutomationPeer.cs