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
- BitArray.cs
- MembershipSection.cs
- FrameworkName.cs
- _HTTPDateParse.cs
- MailMessageEventArgs.cs
- HtmlWindowCollection.cs
- FrameworkRichTextComposition.cs
- InvokeProviderWrapper.cs
- GridView.cs
- Image.cs
- DefaultIfEmptyQueryOperator.cs
- EntityDataSourceViewSchema.cs
- SapiGrammar.cs
- SHA384Managed.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- LowerCaseStringConverter.cs
- BindingContext.cs
- StaticFileHandler.cs
- ExtendedProperty.cs
- Win32MouseDevice.cs
- HyperlinkAutomationPeer.cs
- SortDescriptionCollection.cs
- TypeBuilder.cs
- ObjectResult.cs
- NullableIntAverageAggregationOperator.cs
- Span.cs
- ControlBuilderAttribute.cs
- InkCanvasSelectionAdorner.cs
- NotifyCollectionChangedEventArgs.cs
- ReaderContextStackData.cs
- SmtpDigestAuthenticationModule.cs
- CodeSnippetTypeMember.cs
- ExecutionScope.cs
- SelectionWordBreaker.cs
- TypeExtension.cs
- Merger.cs
- XmlHierarchyData.cs
- UtilityExtension.cs
- BindingMAnagerBase.cs
- XmlWriterSettings.cs
- HyperLinkStyle.cs
- SemanticResultValue.cs
- ContentIterators.cs
- ConcurrentBag.cs
- TextEditor.cs
- SqlBulkCopyColumnMappingCollection.cs
- Encoder.cs
- XmlSchemaSimpleTypeList.cs
- WebControlAdapter.cs
- Window.cs
- GroupDescription.cs
- HyperLink.cs
- WindowsFont.cs
- ExpressionLink.cs
- MultiplexingDispatchMessageFormatter.cs
- NetDataContractSerializer.cs
- RootBrowserWindow.cs
- OpenFileDialog.cs
- Point3DKeyFrameCollection.cs
- ListItemCollection.cs
- Parallel.cs
- DeclaredTypeElementCollection.cs
- MaterialGroup.cs
- _NestedMultipleAsyncResult.cs
- WsatConfiguration.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- XmlDataSource.cs
- UrlAuthFailedErrorFormatter.cs
- LicenseManager.cs
- FixedFlowMap.cs
- HttpProfileBase.cs
- StandardOleMarshalObject.cs
- EdmRelationshipNavigationPropertyAttribute.cs
- XmlBinaryReader.cs
- PathFigureCollection.cs
- ObjectReferenceStack.cs
- PointLightBase.cs
- ToolStripItemRenderEventArgs.cs
- SQLBytes.cs
- TextStore.cs
- StorageInfo.cs
- TemplateLookupAction.cs
- DataGridRow.cs
- BuildManagerHost.cs
- XmlSchemaException.cs
- PackageProperties.cs
- XDeferredAxisSource.cs
- SEHException.cs
- HandleCollector.cs
- TraceContextEventArgs.cs
- Delay.cs
- ToolStripContainerDesigner.cs
- InlineObject.cs
- ExtensibleClassFactory.cs
- NameValuePair.cs
- HandlerFactoryCache.cs
- NetworkInformationPermission.cs
- Environment.cs
- SqlFacetAttribute.cs
- DataGridTable.cs