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
- InputMethodStateTypeInfo.cs
- Int32.cs
- TypeInfo.cs
- ALinqExpressionVisitor.cs
- DBSchemaTable.cs
- TemplateNameScope.cs
- LineServicesCallbacks.cs
- InstanceDescriptor.cs
- UnsafeNativeMethods.cs
- ProxyHwnd.cs
- NativeObjectSecurity.cs
- documentsequencetextcontainer.cs
- TextChange.cs
- SqlSupersetValidator.cs
- MessageQueuePermission.cs
- GroupStyle.cs
- OdbcError.cs
- BinaryKeyIdentifierClause.cs
- GeneralTransform3DCollection.cs
- XmlSchemaSubstitutionGroup.cs
- SynchronizingStream.cs
- UrlPath.cs
- XmlBindingWorker.cs
- WorkflowIdleElement.cs
- Environment.cs
- HtmlFormWrapper.cs
- DataColumn.cs
- ScrollBar.cs
- ConfigViewGenerator.cs
- AppliedDeviceFiltersDialog.cs
- ActionFrame.cs
- HttpWriter.cs
- LayoutTable.cs
- Link.cs
- IISUnsafeMethods.cs
- TemplatePropertyEntry.cs
- X509Chain.cs
- NativeMethods.cs
- ProcessHostConfigUtils.cs
- ProfileElement.cs
- WhitespaceSignificantCollectionAttribute.cs
- XmlSchemaCompilationSettings.cs
- WebPartActionVerb.cs
- Setter.cs
- ExpressionEditorAttribute.cs
- InitializationEventAttribute.cs
- BulletedListDesigner.cs
- EntitySqlQueryCacheEntry.cs
- KeySplineConverter.cs
- ResXDataNode.cs
- ExceptionHandler.cs
- ResourceIDHelper.cs
- CharacterMetrics.cs
- ScrollChrome.cs
- SafeUserTokenHandle.cs
- _NativeSSPI.cs
- SafeViewOfFileHandle.cs
- _SecureChannel.cs
- ZipIOLocalFileHeader.cs
- ReadOnlyPermissionSet.cs
- DataGridViewCheckBoxColumn.cs
- BrowserDefinition.cs
- CodeConstructor.cs
- SqlCrossApplyToCrossJoin.cs
- HandlerFactoryWrapper.cs
- TargetControlTypeAttribute.cs
- StartUpEventArgs.cs
- XmlSchemaComplexType.cs
- MobilePage.cs
- ObfuscateAssemblyAttribute.cs
- CodePropertyReferenceExpression.cs
- ComponentSerializationService.cs
- FixedDSBuilder.cs
- DetailsViewUpdatedEventArgs.cs
- OracleParameterBinding.cs
- SpecialNameAttribute.cs
- ClipboardProcessor.cs
- GradientSpreadMethodValidation.cs
- StylusPointPropertyInfo.cs
- ListBase.cs
- COSERVERINFO.cs
- xml.cs
- SymmetricSecurityBindingElement.cs
- WebServiceTypeData.cs
- jithelpers.cs
- DynamicILGenerator.cs
- XmlSchemaImporter.cs
- PageAdapter.cs
- XhtmlTextWriter.cs
- CodeVariableDeclarationStatement.cs
- GB18030Encoding.cs
- MimeBasePart.cs
- RepeatButton.cs
- ValueUtilsSmi.cs
- BackStopAuthenticationModule.cs
- ModelItemCollectionImpl.cs
- TextAutomationPeer.cs
- DragSelectionMessageFilter.cs
- SchemaObjectWriter.cs
- WebPartTracker.cs