Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Core / CSharp / System / Windows / Input / MouseButtonEventArgs.cs / 1 / MouseButtonEventArgs.cs
using System; namespace System.Windows.Input { ////// The MouseButtonEventArgs describes the state of a Mouse button. /// public class MouseButtonEventArgs : MouseEventArgs { ////// Initializes a new instance of the MouseButtonEventArgs class. /// /// /// The logical Mouse device associated with this event. /// /// /// The time when the input occured. /// /// /// The mouse button whose state is being described. /// public MouseButtonEventArgs(MouseDevice mouse, int timestamp, MouseButton button) : base(mouse, timestamp) { MouseButtonUtilities.Validate(button); _button = button; _count = 1; } ////// Initializes a new instance of the MouseButtonEventArgs class. /// /// /// The logical Mouse device associated with this event. /// /// /// The time when the input occured. /// /// /// The Mouse button whose state is being described. /// /// /// The stylus device that was involved with this event. /// public MouseButtonEventArgs(MouseDevice mouse, int timestamp, MouseButton button, StylusDevice stylusDevice) : base(mouse, timestamp, stylusDevice) { MouseButtonUtilities.Validate(button); _button = button; _count = 1; } ////// Read-only access to the button being described. /// public MouseButton ChangedButton { get {return _button;} } ////// Read-only access to the button state. /// public MouseButtonState ButtonState { get { MouseButtonState state = MouseButtonState.Released; switch(_button) { case MouseButton.Left: state = this.MouseDevice.LeftButton; break; case MouseButton.Right: state = this.MouseDevice.RightButton; break; case MouseButton.Middle: state = this.MouseDevice.MiddleButton; break; case MouseButton.XButton1: state = this.MouseDevice.XButton1; break; case MouseButton.XButton2: state = this.MouseDevice.XButton2; break; } return state; } } ////// Read access to the button click count. /// public int ClickCount { get {return _count;} internal set { _count = value;} } ////// The mechanism used to call the type-specific handler on the /// target. /// /// /// The generic handler to call in a type-specific way. /// /// /// The target to call the handler on. /// protected override void InvokeEventHandler(Delegate genericHandler, object genericTarget) { MouseButtonEventHandler handler = (MouseButtonEventHandler) genericHandler; handler(genericTarget, this); } private MouseButton _button; private int _count; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. using System; namespace System.Windows.Input { ////// The MouseButtonEventArgs describes the state of a Mouse button. /// public class MouseButtonEventArgs : MouseEventArgs { ////// Initializes a new instance of the MouseButtonEventArgs class. /// /// /// The logical Mouse device associated with this event. /// /// /// The time when the input occured. /// /// /// The mouse button whose state is being described. /// public MouseButtonEventArgs(MouseDevice mouse, int timestamp, MouseButton button) : base(mouse, timestamp) { MouseButtonUtilities.Validate(button); _button = button; _count = 1; } ////// Initializes a new instance of the MouseButtonEventArgs class. /// /// /// The logical Mouse device associated with this event. /// /// /// The time when the input occured. /// /// /// The Mouse button whose state is being described. /// /// /// The stylus device that was involved with this event. /// public MouseButtonEventArgs(MouseDevice mouse, int timestamp, MouseButton button, StylusDevice stylusDevice) : base(mouse, timestamp, stylusDevice) { MouseButtonUtilities.Validate(button); _button = button; _count = 1; } ////// Read-only access to the button being described. /// public MouseButton ChangedButton { get {return _button;} } ////// Read-only access to the button state. /// public MouseButtonState ButtonState { get { MouseButtonState state = MouseButtonState.Released; switch(_button) { case MouseButton.Left: state = this.MouseDevice.LeftButton; break; case MouseButton.Right: state = this.MouseDevice.RightButton; break; case MouseButton.Middle: state = this.MouseDevice.MiddleButton; break; case MouseButton.XButton1: state = this.MouseDevice.XButton1; break; case MouseButton.XButton2: state = this.MouseDevice.XButton2; break; } return state; } } ////// Read access to the button click count. /// public int ClickCount { get {return _count;} internal set { _count = value;} } ////// The mechanism used to call the type-specific handler on the /// target. /// /// /// The generic handler to call in a type-specific way. /// /// /// The target to call the handler on. /// protected override void InvokeEventHandler(Delegate genericHandler, object genericTarget) { MouseButtonEventHandler handler = (MouseButtonEventHandler) genericHandler; handler(genericTarget, this); } private MouseButton _button; private int _count; } } // 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
- ManifestSignedXml.cs
- ContractInstanceProvider.cs
- GridViewRowCollection.cs
- ProxyWebPartManager.cs
- ArcSegment.cs
- MetadataItemCollectionFactory.cs
- ExpressionBuilderCollection.cs
- Soap.cs
- ResourcePool.cs
- OneOfScalarConst.cs
- FileLoadException.cs
- Listen.cs
- RtfToXamlLexer.cs
- _KerberosClient.cs
- Util.cs
- LiteralControl.cs
- NameNode.cs
- MobileControlDesigner.cs
- RotateTransform3D.cs
- ClrPerspective.cs
- SimpleTypeResolver.cs
- NativeActivity.cs
- SecurityDescriptor.cs
- GuidTagList.cs
- CodeChecksumPragma.cs
- XmlStringTable.cs
- XPathDocumentBuilder.cs
- RoutedEventArgs.cs
- ViewGenerator.cs
- DiscoveryClientRequestChannel.cs
- ComponentEditorForm.cs
- TreeBuilderXamlTranslator.cs
- SourceElementsCollection.cs
- TableRow.cs
- DesignerCommandSet.cs
- ImageAttributes.cs
- UnsafePeerToPeerMethods.cs
- ProviderConnectionPoint.cs
- XappLauncher.cs
- WmlValidatorAdapter.cs
- Parameter.cs
- counter.cs
- AppDomainUnloadedException.cs
- LinqDataSourceUpdateEventArgs.cs
- ThreadPool.cs
- CollectionChangedEventManager.cs
- TemplateControlBuildProvider.cs
- EntityTypeEmitter.cs
- UnsafeCollabNativeMethods.cs
- RelationshipEndMember.cs
- SqlParameterCollection.cs
- PropertyAccessVisitor.cs
- DesignerCalendarAdapter.cs
- LoadWorkflowByInstanceKeyCommand.cs
- UnsafeNativeMethods.cs
- PathTooLongException.cs
- CodeCatchClauseCollection.cs
- Qualifier.cs
- BufferedGraphicsContext.cs
- AuthenticationSchemesHelper.cs
- ApplicationBuildProvider.cs
- HashLookup.cs
- FileDialog_Vista_Interop.cs
- ContainerSelectorGlyph.cs
- BitmapFrameDecode.cs
- BinHexDecoder.cs
- ObjectItemConventionAssemblyLoader.cs
- SharedConnectionInfo.cs
- ScopelessEnumAttribute.cs
- TransactionTraceIdentifier.cs
- ContactManager.cs
- StandardOleMarshalObject.cs
- DesignerListAdapter.cs
- DockPatternIdentifiers.cs
- ProcessModuleCollection.cs
- GenerateHelper.cs
- BasicCellRelation.cs
- DropTarget.cs
- Int64Storage.cs
- JournalEntry.cs
- ImageMetadata.cs
- DataGridViewCellStyle.cs
- HttpListenerResponse.cs
- Geometry.cs
- DocumentCollection.cs
- DetailsViewCommandEventArgs.cs
- StateItem.cs
- TemplateControl.cs
- ContentTextAutomationPeer.cs
- DataGridViewTextBoxEditingControl.cs
- ScrollChrome.cs
- WorkflowServiceAttributesTypeConverter.cs
- ActivityPropertyReference.cs
- TouchesCapturedWithinProperty.cs
- MethodSignatureGenerator.cs
- CodeRemoveEventStatement.cs
- PropertyIdentifier.cs
- HostingPreferredMapPath.cs
- TemplateControlCodeDomTreeGenerator.cs
- SoapAttributeOverrides.cs