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
- ContextTokenTypeConverter.cs
- SystemParameters.cs
- ThaiBuddhistCalendar.cs
- Action.cs
- Run.cs
- Opcode.cs
- SmiEventSink_Default.cs
- _ConnectStream.cs
- ReadOnlyCollectionBase.cs
- QueuePathDialog.cs
- AssignDesigner.xaml.cs
- SynthesizerStateChangedEventArgs.cs
- ComPlusServiceHost.cs
- RouteParametersHelper.cs
- WindowsProgressbar.cs
- WebRequest.cs
- COM2ExtendedUITypeEditor.cs
- RepeatEnumerable.cs
- PixelFormats.cs
- BlurBitmapEffect.cs
- RelationshipType.cs
- DefaultAuthorizationContext.cs
- Function.cs
- XmlSchemaAttributeGroupRef.cs
- ViewRendering.cs
- Knowncolors.cs
- ExpressionTextBox.xaml.cs
- ApplicationException.cs
- Int32CAMarshaler.cs
- Shape.cs
- UrlAuthorizationModule.cs
- DateTimeStorage.cs
- PartialArray.cs
- DerivedKeySecurityTokenStub.cs
- InvalidComObjectException.cs
- hebrewshape.cs
- HwndProxyElementProvider.cs
- PermissionListSet.cs
- DataBindingExpressionBuilder.cs
- RegexRunner.cs
- MenuCommand.cs
- SweepDirectionValidation.cs
- MetadataArtifactLoaderComposite.cs
- RadioButtonRenderer.cs
- TextEffectCollection.cs
- SqlDelegatedTransaction.cs
- MessageDecoder.cs
- XmlCustomFormatter.cs
- GenericTypeParameterConverter.cs
- FixedSOMElement.cs
- DataGridCell.cs
- FileSecurity.cs
- RegexCompiler.cs
- FileUtil.cs
- PropertyGrid.cs
- DbgCompiler.cs
- WriteableOnDemandPackagePart.cs
- ImageButton.cs
- SafeBitVector32.cs
- PeerResolverBindingElement.cs
- InkCanvasInnerCanvas.cs
- FormsAuthenticationConfiguration.cs
- WebPartEditorCancelVerb.cs
- SystemThemeKey.cs
- HScrollProperties.cs
- CompiledXpathExpr.cs
- CompiledIdentityConstraint.cs
- EtwTrace.cs
- exports.cs
- XmlQuerySequence.cs
- AttachedAnnotationChangedEventArgs.cs
- Keywords.cs
- InputManager.cs
- X509Utils.cs
- TransformDescriptor.cs
- HttpResponseBase.cs
- XmlToDatasetMap.cs
- ValidatorCompatibilityHelper.cs
- FontWeight.cs
- WebPartExportVerb.cs
- UnmanagedMarshal.cs
- ImageAutomationPeer.cs
- FileUtil.cs
- TextTrailingWordEllipsis.cs
- TdsParser.cs
- DataGridViewRowConverter.cs
- XmlArrayItemAttribute.cs
- Axis.cs
- ColorDialog.cs
- OLEDB_Util.cs
- _OSSOCK.cs
- ConnectionStringSettings.cs
- CustomValidator.cs
- DataGridViewRowEventArgs.cs
- ProtocolViolationException.cs
- PopOutPanel.cs
- CommentEmitter.cs
- PasswordPropertyTextAttribute.cs
- UriTemplateTrieLocation.cs
- EventLogger.cs