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
- StringArrayConverter.cs
- IISUnsafeMethods.cs
- FolderBrowserDialogDesigner.cs
- CopyAttributesAction.cs
- EventPrivateKey.cs
- DataReaderContainer.cs
- DynamicResourceExtension.cs
- XmlSchemaObjectCollection.cs
- MappingException.cs
- HandlerFactoryWrapper.cs
- SelectionEditor.cs
- ObjectQuery.cs
- DrawingContextWalker.cs
- ResourcePart.cs
- DataGrid.cs
- AuthenticateEventArgs.cs
- StringToken.cs
- WebPartConnectVerb.cs
- QueryPageSettingsEventArgs.cs
- MatrixTransform.cs
- OleDbConnectionFactory.cs
- NamedPipeConnectionPoolSettings.cs
- Speller.cs
- COM2EnumConverter.cs
- DataGridViewElement.cs
- LinkButton.cs
- CssClassPropertyAttribute.cs
- FontClient.cs
- Substitution.cs
- Types.cs
- WebPartUserCapability.cs
- PerformanceCounterCategory.cs
- BitmapData.cs
- xsdvalidator.cs
- AddInContractAttribute.cs
- ProviderIncompatibleException.cs
- ClickablePoint.cs
- TableItemStyle.cs
- TabRenderer.cs
- HtmlForm.cs
- PromptEventArgs.cs
- SqlDataAdapter.cs
- _AutoWebProxyScriptWrapper.cs
- ZipIOModeEnforcingStream.cs
- DocumentViewerHelper.cs
- DataGridViewTopRowAccessibleObject.cs
- SerializationFieldInfo.cs
- InkCollectionBehavior.cs
- XmlDictionaryString.cs
- SafeProcessHandle.cs
- WmlCalendarAdapter.cs
- BitmapEffectOutputConnector.cs
- MultipartContentParser.cs
- HWStack.cs
- CodeCommentStatement.cs
- ListViewItemEventArgs.cs
- ServerValidateEventArgs.cs
- WebPartConnectVerb.cs
- CompatibleComparer.cs
- ServiceChannelProxy.cs
- CodeExpressionStatement.cs
- DataTableTypeConverter.cs
- X509Certificate2Collection.cs
- EventlogProvider.cs
- _DynamicWinsockMethods.cs
- IndexedString.cs
- GridViewRowCollection.cs
- Domain.cs
- _ShellExpression.cs
- KoreanCalendar.cs
- CodeAttributeArgumentCollection.cs
- dsa.cs
- SqlCacheDependencySection.cs
- CodeAttributeDeclarationCollection.cs
- WebSysDescriptionAttribute.cs
- WebPartConnectionsEventArgs.cs
- HttpListenerPrefixCollection.cs
- MapPathBasedVirtualPathProvider.cs
- SystemColors.cs
- SerialReceived.cs
- Identity.cs
- SoundPlayer.cs
- Lease.cs
- ConstraintCollection.cs
- HtmlEmptyTagControlBuilder.cs
- PrintingPermission.cs
- ListBoxChrome.cs
- HyperLinkField.cs
- ContextMenu.cs
- HtmlControlPersistable.cs
- XmlReflectionMember.cs
- NamespaceQuery.cs
- CopyCodeAction.cs
- SqlNotificationEventArgs.cs
- TerminatorSinks.cs
- ParameterEditorUserControl.cs
- httpserverutility.cs
- ToolStripSplitStackLayout.cs
- ActivityCodeGenerator.cs
- SelectionGlyph.cs