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
- ObjectItemCollection.cs
- SafeNativeMethods.cs
- UserMapPath.cs
- SecurityHelper.cs
- AQNBuilder.cs
- ClientOperation.cs
- AutomationProperty.cs
- Int64KeyFrameCollection.cs
- OdbcCommand.cs
- ProtocolsConfigurationHandler.cs
- SchemaDeclBase.cs
- Environment.cs
- AudioFileOut.cs
- MarshalByRefObject.cs
- PEFileEvidenceFactory.cs
- entitydatasourceentitysetnameconverter.cs
- Range.cs
- ConfigurationLocationCollection.cs
- AutomationElementIdentifiers.cs
- ToolStripHighContrastRenderer.cs
- NativeWindow.cs
- ViewCellRelation.cs
- XmlSerializationWriter.cs
- EmptyEnumerator.cs
- ToolStripTextBox.cs
- DataTableNameHandler.cs
- EncoderParameter.cs
- Stylesheet.cs
- FixedPage.cs
- ReadWriteControlDesigner.cs
- XmlAnyAttributeAttribute.cs
- CustomAttributeBuilder.cs
- SectionVisual.cs
- BinaryObjectInfo.cs
- HttpCachePolicyElement.cs
- DrawingGroup.cs
- TransactedBatchContext.cs
- SmtpAuthenticationManager.cs
- AmbientEnvironment.cs
- ValidationErrorEventArgs.cs
- RoutedCommand.cs
- Thread.cs
- TemplateControlBuildProvider.cs
- SourceSwitch.cs
- CircleEase.cs
- TypeCacheManager.cs
- GeneralTransformCollection.cs
- TextBoxView.cs
- ImageAutomationPeer.cs
- CodeExporter.cs
- DistributedTransactionPermission.cs
- IteratorAsyncResult.cs
- TreePrinter.cs
- HighContrastHelper.cs
- RuntimeEnvironment.cs
- CalendarAutoFormatDialog.cs
- MulticastNotSupportedException.cs
- FixedSOMTextRun.cs
- UnionQueryOperator.cs
- SessionState.cs
- AdCreatedEventArgs.cs
- DataGridViewImageColumn.cs
- TimelineGroup.cs
- _Connection.cs
- VisualStyleRenderer.cs
- RightsManagementPermission.cs
- InheritablePropertyChangeInfo.cs
- FixUp.cs
- KerberosTicketHashIdentifierClause.cs
- TdsParserHelperClasses.cs
- EventKeyword.cs
- TransactionOptions.cs
- ContentElement.cs
- EmissiveMaterial.cs
- PasswordRecovery.cs
- ExpressionUtilities.cs
- DataExpression.cs
- BrowserCapabilitiesFactoryBase.cs
- odbcmetadatacolumnnames.cs
- RowBinding.cs
- UnionCqlBlock.cs
- FlagsAttribute.cs
- RootBuilder.cs
- EncoderParameter.cs
- UnicastIPAddressInformationCollection.cs
- CommonDialog.cs
- ConfigXmlDocument.cs
- ClientRoleProvider.cs
- TextEditorParagraphs.cs
- DiscoveryClientProtocol.cs
- DockingAttribute.cs
- Fonts.cs
- ObjectHelper.cs
- InputManager.cs
- ObjectViewEntityCollectionData.cs
- Grammar.cs
- ExpressionTable.cs
- ColorTransformHelper.cs
- PackWebResponse.cs
- InitializerFacet.cs