Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- Vector3D.cs
- HostedImpersonationContext.cs
- TextFindEngine.cs
- KeyboardNavigation.cs
- PassportAuthenticationEventArgs.cs
- FormsAuthenticationTicket.cs
- TreeViewDesigner.cs
- _ProxyRegBlob.cs
- PngBitmapEncoder.cs
- ParentUndoUnit.cs
- TextContainerChangedEventArgs.cs
- SID.cs
- AssemblyUtil.cs
- DragEventArgs.cs
- Label.cs
- ProfilePropertySettings.cs
- SQLString.cs
- WebProxyScriptElement.cs
- AttributeEmitter.cs
- VectorAnimationUsingKeyFrames.cs
- ServiceSecurityAuditBehavior.cs
- TextFormatter.cs
- RightsManagementEncryptionTransform.cs
- WorkflowViewManager.cs
- HttpWebRequestElement.cs
- EventPrivateKey.cs
- ImageListStreamer.cs
- ControlBuilderAttribute.cs
- KeySpline.cs
- WindowsScrollBar.cs
- GridViewAutoFormat.cs
- Light.cs
- TypeResolver.cs
- DataFormat.cs
- MsmqReceiveParameters.cs
- Vector3DKeyFrameCollection.cs
- InstanceStoreQueryResult.cs
- WebPartZone.cs
- NonClientArea.cs
- XsltException.cs
- CodeDomLoader.cs
- SoapExtensionTypeElement.cs
- X509WindowsSecurityToken.cs
- UserPreferenceChangingEventArgs.cs
- ByteRangeDownloader.cs
- WindowsSolidBrush.cs
- httpapplicationstate.cs
- TemplatedAdorner.cs
- HttpConfigurationContext.cs
- ComponentDispatcher.cs
- SqlDataSourceCommandEventArgs.cs
- XpsFixedDocumentReaderWriter.cs
- XmlSchemaChoice.cs
- TableRowsCollectionEditor.cs
- ConsumerConnectionPointCollection.cs
- TableLayoutSettings.cs
- LocalizationComments.cs
- ValidatedControlConverter.cs
- TimeSpanConverter.cs
- DesignerTextViewAdapter.cs
- RegexCaptureCollection.cs
- handlecollector.cs
- TableLayout.cs
- _AutoWebProxyScriptWrapper.cs
- TextWriter.cs
- PositiveTimeSpanValidatorAttribute.cs
- Events.cs
- DefaultPropertiesToSend.cs
- SubMenuStyleCollection.cs
- XmlSchemaType.cs
- AuthenticationModulesSection.cs
- Lookup.cs
- XPathMultyIterator.cs
- DiscoveryDocumentLinksPattern.cs
- DataGridViewLinkColumn.cs
- GroupBox.cs
- XmlAnyElementAttribute.cs
- TrailingSpaceComparer.cs
- UIntPtr.cs
- WebBodyFormatMessageProperty.cs
- SystemResourceHost.cs
- SerializationFieldInfo.cs
- InfoCardAsymmetricCrypto.cs
- DataMember.cs
- DataRowComparer.cs
- WmlMobileTextWriter.cs
- FileDialogCustomPlaces.cs
- FrameworkContentElementAutomationPeer.cs
- ELinqQueryState.cs
- WebConvert.cs
- ModuleConfigurationInfo.cs
- OdbcStatementHandle.cs
- StubHelpers.cs
- SqlXml.cs
- ColorInterpolationModeValidation.cs
- ExitEventArgs.cs
- CssStyleCollection.cs
- ReturnValue.cs
- XmlTextWriter.cs
- EntityDataSourceSelectingEventArgs.cs