Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / Input / MouseButton.cs / 1305600 / 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
- RegexWriter.cs
- JapaneseCalendar.cs
- ExpressionTextBoxAutomationPeer.cs
- EncryptedKeyHashIdentifierClause.cs
- BinHexDecoder.cs
- DiscoveryClientDocuments.cs
- ThreadExceptionDialog.cs
- WebPartConnectionsCancelEventArgs.cs
- unsafenativemethodsother.cs
- DBConnection.cs
- FileUtil.cs
- TextModifier.cs
- HMAC.cs
- ChannelServices.cs
- ScrollViewer.cs
- DefaultEventAttribute.cs
- DataSetFieldSchema.cs
- WSDualHttpSecurityElement.cs
- ZipIOEndOfCentralDirectoryBlock.cs
- EnvironmentPermission.cs
- Message.cs
- DispatcherOperation.cs
- DataListItemCollection.cs
- BamlVersionHeader.cs
- TextAnchor.cs
- XPathAncestorQuery.cs
- RemoteX509Token.cs
- RectAnimationBase.cs
- AutomationElementIdentifiers.cs
- DeclarativeCatalogPart.cs
- XmlBinaryReader.cs
- ToolStripItem.cs
- Identifier.cs
- Track.cs
- GiveFeedbackEvent.cs
- GeneralTransform3DGroup.cs
- NullableIntMinMaxAggregationOperator.cs
- Size3D.cs
- NameValueCollection.cs
- TableLayout.cs
- ChannelListenerBase.cs
- DeploymentSection.cs
- SettingsSavedEventArgs.cs
- EntityProxyFactory.cs
- DataRowCollection.cs
- StateValidator.cs
- HitTestResult.cs
- CodeDirectiveCollection.cs
- GlyphingCache.cs
- ToolStripRendererSwitcher.cs
- TemplateLookupAction.cs
- MetadataPropertyAttribute.cs
- ContextStaticAttribute.cs
- XmlSchemaSubstitutionGroup.cs
- ShadowGlyph.cs
- ThreadPool.cs
- HostedTcpTransportManager.cs
- WebZone.cs
- _CommandStream.cs
- JsonUriDataContract.cs
- filewebresponse.cs
- EditingCommands.cs
- Hex.cs
- TypeHelpers.cs
- MeshGeometry3D.cs
- DbMetaDataColumnNames.cs
- XmlDocumentType.cs
- DataControlFieldCollection.cs
- ResXResourceWriter.cs
- ServiceParser.cs
- Decimal.cs
- DiscoveryRequestHandler.cs
- XsltQilFactory.cs
- SQLDouble.cs
- WindowsScrollBarBits.cs
- SuppressIldasmAttribute.cs
- ConnectionPoolManager.cs
- PropertyToken.cs
- HttpListenerContext.cs
- BatchParser.cs
- TagNameToTypeMapper.cs
- FilterQuery.cs
- ScrollViewerAutomationPeer.cs
- MultiDataTrigger.cs
- HashJoinQueryOperatorEnumerator.cs
- BinHexDecoder.cs
- XmlProcessingInstruction.cs
- QualificationDataItem.cs
- ConnectionStringSettingsCollection.cs
- ListBindingConverter.cs
- XmlResolver.cs
- ConfigPathUtility.cs
- TextPointer.cs
- ColorContext.cs
- XamlReaderHelper.cs
- EntityTypeEmitter.cs
- ResourceContainer.cs
- ExpressionReplacer.cs
- OptimalBreakSession.cs
- NativeMethods.cs