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
- LicenseContext.cs
- TileBrush.cs
- ApplicationInterop.cs
- RequestQueryProcessor.cs
- Durable.cs
- FormatConvertedBitmap.cs
- FileReservationCollection.cs
- UserControl.cs
- LocationUpdates.cs
- PublisherIdentityPermission.cs
- ReadOnlyHierarchicalDataSource.cs
- ToolStripRenderEventArgs.cs
- DesignerCapabilities.cs
- externdll.cs
- LineInfo.cs
- XNameConverter.cs
- WebScriptMetadataMessage.cs
- PropertyDescriptorGridEntry.cs
- IPPacketInformation.cs
- XmlSchemaComplexContentRestriction.cs
- DNS.cs
- RadioButtonRenderer.cs
- ScriptControlManager.cs
- MenuItem.cs
- NumericUpDownAccelerationCollection.cs
- GridItem.cs
- TextPointer.cs
- DataGridViewDataErrorEventArgs.cs
- FilterableData.cs
- Vector3dCollection.cs
- MessageDecoder.cs
- UserControlCodeDomTreeGenerator.cs
- UInt32Converter.cs
- TextBox.cs
- EnumerableRowCollection.cs
- FrameworkObject.cs
- COM2PropertyDescriptor.cs
- SubMenuStyleCollection.cs
- HttpPostedFileBase.cs
- ControlPropertyNameConverter.cs
- CannotUnloadAppDomainException.cs
- Lasso.cs
- UniqueConstraint.cs
- ContextInformation.cs
- ListViewItemSelectionChangedEvent.cs
- ConstructorNeedsTagAttribute.cs
- StatusBarDrawItemEvent.cs
- ListItemsPage.cs
- ObjectRef.cs
- OracleEncoding.cs
- sqlcontext.cs
- ContentElementAutomationPeer.cs
- RsaKeyIdentifierClause.cs
- Events.cs
- XPathExpr.cs
- ScriptReference.cs
- OracleEncoding.cs
- X509SecurityToken.cs
- MarkedHighlightComponent.cs
- TreeNodeCollection.cs
- DataGridViewTextBoxColumn.cs
- SystemIPAddressInformation.cs
- DesignerDataSourceView.cs
- DispatcherTimer.cs
- connectionpool.cs
- Vars.cs
- EntityUtil.cs
- DynamicPropertyReader.cs
- ResolveNameEventArgs.cs
- ItemsControlAutomationPeer.cs
- WmfPlaceableFileHeader.cs
- MsdtcClusterUtils.cs
- ObjectListFieldCollection.cs
- OracleException.cs
- CellCreator.cs
- TemplateKey.cs
- ModelTreeEnumerator.cs
- ChunkedMemoryStream.cs
- BamlResourceSerializer.cs
- MultiView.cs
- DataGridViewCellFormattingEventArgs.cs
- IdentityReference.cs
- IgnoreSection.cs
- WriteFileContext.cs
- FileAuthorizationModule.cs
- HttpValueCollection.cs
- ColumnHeaderCollectionEditor.cs
- TextEffectCollection.cs
- Visual3D.cs
- TargetException.cs
- NullableFloatMinMaxAggregationOperator.cs
- DataListItem.cs
- FileDialogPermission.cs
- PeerUnsafeNativeCryptMethods.cs
- AsyncCallback.cs
- ObjectItemCollectionAssemblyCacheEntry.cs
- WorkflowRuntimeService.cs
- RequestCacheEntry.cs
- UriExt.cs
- StringValueSerializer.cs