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
- ProcessThreadDesigner.cs
- BufferAllocator.cs
- SqlProcedureAttribute.cs
- DES.cs
- BrowserDefinitionCollection.cs
- ToolStripStatusLabel.cs
- TextBlockAutomationPeer.cs
- XmlAttributeCache.cs
- PopupRoot.cs
- ManipulationCompletedEventArgs.cs
- WebPartUtil.cs
- ProgressBar.cs
- SqlDataSourceCommandEventArgs.cs
- VisualBrush.cs
- TransportSecurityBindingElement.cs
- BindingGroup.cs
- HttpFileCollectionWrapper.cs
- RenderDataDrawingContext.cs
- CompositeCollectionView.cs
- UnicastIPAddressInformationCollection.cs
- TextFormattingConverter.cs
- XmlSchemaAnnotation.cs
- InputScope.cs
- TableLayoutSettings.cs
- SecurityAlgorithmSuite.cs
- DiscoveryClientDuplexChannel.cs
- TextRangeSerialization.cs
- ObjectStateFormatter.cs
- PageClientProxyGenerator.cs
- BitmapEffectState.cs
- DataGridViewRowsRemovedEventArgs.cs
- DataGridViewTextBoxEditingControl.cs
- DataBoundControlAdapter.cs
- UshortList2.cs
- EntryPointNotFoundException.cs
- BitmapMetadata.cs
- LocalizationParserHooks.cs
- OdbcStatementHandle.cs
- SqlCacheDependencyDatabase.cs
- SystemIPGlobalStatistics.cs
- ExtensionQuery.cs
- QilBinary.cs
- XmlSchemaObject.cs
- Durable.cs
- GridLengthConverter.cs
- PropertyDescriptor.cs
- ThrowOnMultipleAssignment.cs
- DataGridItemCollection.cs
- ToolStripArrowRenderEventArgs.cs
- coordinatorfactory.cs
- CatalogPart.cs
- SqlCachedBuffer.cs
- DataGridViewCellStyle.cs
- ScriptingWebServicesSectionGroup.cs
- FtpWebRequest.cs
- RelatedImageListAttribute.cs
- CfgArc.cs
- TypefaceMap.cs
- OleServicesContext.cs
- SizeF.cs
- IDictionary.cs
- SecureStringHasher.cs
- FormCollection.cs
- TextMessageEncodingBindingElement.cs
- AtomicFile.cs
- RepeatButtonAutomationPeer.cs
- CombinedGeometry.cs
- ProfileSection.cs
- RelatedPropertyManager.cs
- AssemblyAssociatedContentFileAttribute.cs
- DataGridViewRow.cs
- ModuleBuilder.cs
- RuntimeArgumentHandle.cs
- UserPreferenceChangedEventArgs.cs
- RequestCache.cs
- ConcatQueryOperator.cs
- AxisAngleRotation3D.cs
- ResolveNameEventArgs.cs
- SortKey.cs
- PageAsyncTask.cs
- DecimalAnimationUsingKeyFrames.cs
- XpsImageSerializationService.cs
- ParentQuery.cs
- XNodeValidator.cs
- ComPlusInstanceProvider.cs
- InkSerializer.cs
- FileDialog.cs
- ThemeableAttribute.cs
- GrammarBuilderRuleRef.cs
- CodeDOMProvider.cs
- MatrixTransform.cs
- EditorPart.cs
- ContextMenu.cs
- ViewRendering.cs
- PrimitiveSchema.cs
- ResourceLoader.cs
- DetailsViewDeleteEventArgs.cs
- ServiceDescriptionImporter.cs
- HttpRuntime.cs
- AdornerHitTestResult.cs