Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Core / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XsdDataContractExporter.cs
- ObjectDataSourceChooseMethodsPanel.cs
- HtmlButton.cs
- WebServiceResponseDesigner.cs
- Transform.cs
- sqlinternaltransaction.cs
- DataGridViewDataConnection.cs
- ButtonBase.cs
- AlphabeticalEnumConverter.cs
- BitVec.cs
- StrokeCollectionConverter.cs
- ToolStripArrowRenderEventArgs.cs
- BindingMemberInfo.cs
- RequestCache.cs
- FileLoadException.cs
- DocumentViewerConstants.cs
- SamlAssertion.cs
- FormViewCommandEventArgs.cs
- RootProjectionNode.cs
- AgileSafeNativeMemoryHandle.cs
- InfoCardTrace.cs
- Pair.cs
- PeerEndPoint.cs
- BamlBinaryWriter.cs
- ChannelCacheSettings.cs
- PropertyChange.cs
- JsonWriter.cs
- SizeAnimationClockResource.cs
- SpnegoTokenProvider.cs
- NamedElement.cs
- UIElementCollection.cs
- XmlSchemaNotation.cs
- CircleHotSpot.cs
- securitycriticaldataClass.cs
- CodeMethodReturnStatement.cs
- XNodeValidator.cs
- DeviceSpecificDialogCachedState.cs
- KoreanCalendar.cs
- AmbiguousMatchException.cs
- ScrollItemProviderWrapper.cs
- DragEvent.cs
- StrokeFIndices.cs
- BindingExpressionBase.cs
- XmlQueryType.cs
- DecoderBestFitFallback.cs
- IsolatedStorageFileStream.cs
- ObjectConverter.cs
- Component.cs
- ZoomPercentageConverter.cs
- SharedUtils.cs
- EventHandlers.cs
- LicFileLicenseProvider.cs
- TypeConverterValueSerializer.cs
- EventRouteFactory.cs
- DependencyPropertyConverter.cs
- DataListCommandEventArgs.cs
- ScaleTransform3D.cs
- RegularExpressionValidator.cs
- BasicHttpBindingElement.cs
- BitmapPalette.cs
- Line.cs
- CodeThrowExceptionStatement.cs
- LinqDataSourceEditData.cs
- ObjectReferenceStack.cs
- WebPartsSection.cs
- ValidationPropertyAttribute.cs
- CalendarDataBindingHandler.cs
- DesignerForm.cs
- autovalidator.cs
- PaperSize.cs
- CommaDelimitedStringAttributeCollectionConverter.cs
- HttpContextServiceHost.cs
- BindValidationContext.cs
- NamespaceEmitter.cs
- EntitySqlQueryCacheKey.cs
- QuaternionIndependentAnimationStorage.cs
- InheritanceContextHelper.cs
- QilGeneratorEnv.cs
- ExceptionWrapper.cs
- FloaterParaClient.cs
- WindowsTab.cs
- XPathAncestorQuery.cs
- OdbcParameter.cs
- FormatterServicesNoSerializableCheck.cs
- ApplicationServiceHelper.cs
- HttpFormatExtensions.cs
- ValidationResults.cs
- ControlParameter.cs
- ZipIORawDataFileBlock.cs
- DefaultTextStoreTextComposition.cs
- WeakReadOnlyCollection.cs
- FlowDocumentPageViewerAutomationPeer.cs
- SecurityPolicySection.cs
- ListBase.cs
- OperationAbortedException.cs
- ProvideValueServiceProvider.cs
- LocalIdCollection.cs
- CellNormalizer.cs
- SafeNativeMethodsMilCoreApi.cs
- WorkflowDebuggerSteppingAttribute.cs