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
- TriggerCollection.cs
- KoreanCalendar.cs
- SrgsGrammarCompiler.cs
- UniqueConstraint.cs
- OutputWindow.cs
- BitmapInitialize.cs
- TransformationRules.cs
- FormsAuthenticationCredentials.cs
- DependencyPropertyValueSerializer.cs
- FilterException.cs
- DataPagerFieldCommandEventArgs.cs
- AccessDataSourceWizardForm.cs
- IndentedWriter.cs
- MsmqProcessProtocolHandler.cs
- CryptoApi.cs
- WpfWebRequestHelper.cs
- QueryAccessibilityHelpEvent.cs
- SupportingTokenBindingElement.cs
- ColorConverter.cs
- OdbcError.cs
- XPathPatternParser.cs
- DataGridCaption.cs
- SchemaHelper.cs
- EdmFunctionAttribute.cs
- DesignerView.cs
- FileChangesMonitor.cs
- RuntimeIdentifierPropertyAttribute.cs
- TreeNodeBindingCollection.cs
- ReverseInheritProperty.cs
- XsdDateTime.cs
- WindowsSlider.cs
- PointAnimationUsingKeyFrames.cs
- PermissionToken.cs
- HotSpot.cs
- ListViewSortEventArgs.cs
- DataSetUtil.cs
- DataControlFieldCollection.cs
- SystemResourceHost.cs
- ComponentSerializationService.cs
- DelegatingHeader.cs
- SqlUDTStorage.cs
- BasicExpressionVisitor.cs
- DriveInfo.cs
- RuleEngine.cs
- PageAdapter.cs
- TemplatePartAttribute.cs
- RtfFormatStack.cs
- InvokeBase.cs
- CursorConverter.cs
- DataGridViewCellStyleConverter.cs
- StrongNameMembershipCondition.cs
- RectangleGeometry.cs
- DBParameter.cs
- NotifyInputEventArgs.cs
- MeshGeometry3D.cs
- DBSchemaRow.cs
- VisualState.cs
- TypeElementCollection.cs
- ThreadNeutralSemaphore.cs
- MultilineStringEditor.cs
- BrowserCapabilitiesCodeGenerator.cs
- ResponseBodyWriter.cs
- HashHelper.cs
- cookieexception.cs
- XmlMemberMapping.cs
- ResolveRequestResponseAsyncResult.cs
- SymLanguageType.cs
- HtmlTableCellCollection.cs
- BinaryWriter.cs
- CustomErrorCollection.cs
- ScrollItemPattern.cs
- ClassicBorderDecorator.cs
- RetrieveVirtualItemEventArgs.cs
- BorderGapMaskConverter.cs
- MgmtResManager.cs
- CompileXomlTask.cs
- PresentationSource.cs
- DesignerHost.cs
- EventProxy.cs
- ColumnHeaderConverter.cs
- ScriptComponentDescriptor.cs
- StatusCommandUI.cs
- dsa.cs
- LoginDesignerUtil.cs
- OdbcHandle.cs
- COM2ComponentEditor.cs
- _OverlappedAsyncResult.cs
- LOSFormatter.cs
- webbrowsersite.cs
- Table.cs
- DeflateStream.cs
- StateDesigner.cs
- DBCommandBuilder.cs
- ButtonColumn.cs
- safesecurityhelperavalon.cs
- LogicalExpr.cs
- JavaScriptObjectDeserializer.cs
- WebSysDefaultValueAttribute.cs
- StickyNoteHelper.cs
- SourceFilter.cs