Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / Input / MouseButtonEventArgs.cs / 1305600 / 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
- HuffmanTree.cs
- OracleLob.cs
- ImageAnimator.cs
- CircleHotSpot.cs
- _ProxyChain.cs
- RichTextBoxConstants.cs
- FormParameter.cs
- CollectionChangeEventArgs.cs
- Aggregates.cs
- CompilerScopeManager.cs
- shaper.cs
- DelegatingTypeDescriptionProvider.cs
- Queue.cs
- BitmapVisualManager.cs
- WindowsClientCredential.cs
- MailDefinition.cs
- ProgressBar.cs
- OleDbError.cs
- ClaimTypeRequirement.cs
- WebPartMinimizeVerb.cs
- XPathNodeHelper.cs
- EditingCoordinator.cs
- Point3DCollectionConverter.cs
- safelink.cs
- ClipboardData.cs
- DataGridCell.cs
- mediaclock.cs
- ConfigXmlSignificantWhitespace.cs
- AssemblySettingAttributes.cs
- ColumnMapProcessor.cs
- InputLangChangeRequestEvent.cs
- IsolatedStorageException.cs
- EmptyCollection.cs
- BaseContextMenu.cs
- Int16Animation.cs
- MatchNoneMessageFilter.cs
- UrlAuthFailureHandler.cs
- AddInEnvironment.cs
- HandleRef.cs
- TimeManager.cs
- URI.cs
- TemplatePagerField.cs
- XPathNodePointer.cs
- RowUpdatingEventArgs.cs
- TrustSection.cs
- SystemParameters.cs
- Transform.cs
- PreservationFileWriter.cs
- ZipPackagePart.cs
- SByteConverter.cs
- DrawingGroup.cs
- SchemaMapping.cs
- StringComparer.cs
- DataGridViewTextBoxEditingControl.cs
- XmlSchemaSimpleContentRestriction.cs
- MILUtilities.cs
- HandleCollector.cs
- OleStrCAMarshaler.cs
- SplitterDesigner.cs
- CodeArrayCreateExpression.cs
- SafeTimerHandle.cs
- FunctionQuery.cs
- MsmqTransportReceiveParameters.cs
- FileUpload.cs
- ResXResourceSet.cs
- ProcessModelInfo.cs
- DesignColumn.cs
- SqlWebEventProvider.cs
- DefaultValueConverter.cs
- HashUtility.cs
- SpecularMaterial.cs
- KeyTime.cs
- Crc32.cs
- ToolBar.cs
- SqlDataSourceCommandEventArgs.cs
- BindingContext.cs
- TraceSection.cs
- ValidationEventArgs.cs
- ToolStripRendererSwitcher.cs
- WindowsFormsHelpers.cs
- IList.cs
- XomlCompilerHelpers.cs
- DBConnectionString.cs
- PixelFormats.cs
- CommandManager.cs
- GifBitmapEncoder.cs
- TextEditorDragDrop.cs
- PolicyException.cs
- xsdvalidator.cs
- StaticSiteMapProvider.cs
- TreeViewImageKeyConverter.cs
- FlowStep.cs
- ObjectViewEntityCollectionData.cs
- FilteredAttributeCollection.cs
- DBParameter.cs
- RoleManagerModule.cs
- WebBrowser.cs
- WebPartAuthorizationEventArgs.cs
- FacetChecker.cs
- StateRuntime.cs