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
- HtmlInputImage.cs
- CodeAccessSecurityEngine.cs
- StylusPointPropertyInfoDefaults.cs
- MethodAccessException.cs
- PaintEvent.cs
- ExtensionSurface.cs
- DataObjectPastingEventArgs.cs
- TemplateField.cs
- TimeZoneInfo.cs
- clipboard.cs
- AuthenticodeSignatureInformation.cs
- HttpClientChannel.cs
- smtpconnection.cs
- ShaperBuffers.cs
- UidManager.cs
- MarkupWriter.cs
- CompilerScope.cs
- SchemaNames.cs
- PackageDigitalSignature.cs
- CustomAttributeFormatException.cs
- MatchingStyle.cs
- ReadOnlyTernaryTree.cs
- GridViewAutomationPeer.cs
- RectangleGeometry.cs
- UrlMappingsSection.cs
- GeneratedView.cs
- HttpErrorTraceRecord.cs
- DirectoryObjectSecurity.cs
- WSDualHttpSecurityElement.cs
- InvalidDataException.cs
- InstanceDescriptor.cs
- RequiredFieldValidator.cs
- SetStateEventArgs.cs
- ObjectQuery.cs
- PKCS1MaskGenerationMethod.cs
- AttributeAction.cs
- WindowPattern.cs
- StaticExtension.cs
- DataRelation.cs
- AtomMaterializerLog.cs
- QueryOutputWriter.cs
- FormViewRow.cs
- DataBindingList.cs
- GridView.cs
- StylusPointPropertyUnit.cs
- FieldNameLookup.cs
- AudioFileOut.cs
- View.cs
- InkCollectionBehavior.cs
- DateTimeFormatInfo.cs
- HwndSubclass.cs
- TextRenderer.cs
- BindingExpression.cs
- HtmlMobileTextWriter.cs
- ProcessThread.cs
- DatagramAdapter.cs
- securitycriticaldataClass.cs
- XslTransform.cs
- TraceInternal.cs
- FlowDecisionLabelFeature.cs
- PnrpPeerResolverBindingElement.cs
- BamlRecordWriter.cs
- ParseChildrenAsPropertiesAttribute.cs
- SecurityException.cs
- RunInstallerAttribute.cs
- SerializationException.cs
- HostTimeoutsElement.cs
- FullTrustAssembliesSection.cs
- ComponentChangedEvent.cs
- AnnotationMap.cs
- TextServicesCompartment.cs
- BitmapData.cs
- UIElement3DAutomationPeer.cs
- ReflectionUtil.cs
- RequestCache.cs
- InternalBufferOverflowException.cs
- CatalogZoneBase.cs
- OleDbConnectionFactory.cs
- DelegatingTypeDescriptionProvider.cs
- ShaderEffect.cs
- LayoutEditorPart.cs
- DSASignatureDeformatter.cs
- Viewport2DVisual3D.cs
- ImageSource.cs
- ViewPort3D.cs
- CompositeControl.cs
- DesignerLoader.cs
- DataGridViewCellCollection.cs
- DataPager.cs
- InvokePattern.cs
- XmlComment.cs
- OpCodes.cs
- ComboBoxDesigner.cs
- FileChangesMonitor.cs
- OdbcConnectionOpen.cs
- TextRangeEditLists.cs
- securitycriticaldataformultiplegetandset.cs
- PersonalizationStateInfo.cs
- COM2IVsPerPropertyBrowsingHandler.cs
- DecimalMinMaxAggregationOperator.cs