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
- ExecutionScope.cs
- CollectionType.cs
- Int64AnimationBase.cs
- XmlSchemaType.cs
- HuffCodec.cs
- ImpersonationContext.cs
- panel.cs
- DynamicUpdateCommand.cs
- BitmapEffectGroup.cs
- MappingException.cs
- CombinedTcpChannel.cs
- SHA384.cs
- MultilineStringEditor.cs
- MsmqTransportBindingElement.cs
- webclient.cs
- RequestCacheValidator.cs
- HtmlTextBoxAdapter.cs
- CodeExporter.cs
- ResourceWriter.cs
- XsdBuildProvider.cs
- CapabilitiesSection.cs
- TableRowCollection.cs
- Memoizer.cs
- MgmtConfigurationRecord.cs
- Font.cs
- MsmqInputMessagePool.cs
- DoubleMinMaxAggregationOperator.cs
- DecimalSumAggregationOperator.cs
- ControlAdapter.cs
- HostProtectionPermission.cs
- BindValidator.cs
- LineSegment.cs
- ApplicationInterop.cs
- CryptoConfig.cs
- Int32CAMarshaler.cs
- CorrelationTokenInvalidatedHandler.cs
- AutomationElementIdentifiers.cs
- GeneralTransform3DGroup.cs
- ProfilePropertySettingsCollection.cs
- X509Extension.cs
- KeyMatchBuilder.cs
- COM2FontConverter.cs
- GlobalizationSection.cs
- ClrPerspective.cs
- DataServiceClientException.cs
- DetailsViewModeEventArgs.cs
- ImageButton.cs
- DisposableCollectionWrapper.cs
- DecoderReplacementFallback.cs
- TripleDES.cs
- DataGridViewColumnCollectionEditor.cs
- SignatureConfirmations.cs
- InputLangChangeRequestEvent.cs
- TileModeValidation.cs
- ToolStripDesigner.cs
- GotoExpression.cs
- Convert.cs
- AvTraceDetails.cs
- TabPanel.cs
- FontUnit.cs
- XamlFigureLengthSerializer.cs
- ValidationSummaryDesigner.cs
- EventKeyword.cs
- SoapElementAttribute.cs
- ServiceObjectContainer.cs
- ConnectivityStatus.cs
- DebugViewWriter.cs
- KeyGestureValueSerializer.cs
- OleDbStruct.cs
- UIElementParaClient.cs
- XamlInterfaces.cs
- ObjectListComponentEditor.cs
- RuleSettingsCollection.cs
- OfTypeExpression.cs
- QueryPageSettingsEventArgs.cs
- InvokerUtil.cs
- UnlockInstanceAsyncResult.cs
- ChannelSinkStacks.cs
- DataControlPagerLinkButton.cs
- messageonlyhwndwrapper.cs
- MetadataElement.cs
- LinqToSqlWrapper.cs
- PageRequestManager.cs
- HtmlUtf8RawTextWriter.cs
- EvidenceBase.cs
- WebBodyFormatMessageProperty.cs
- ContextProperty.cs
- SecurityKeyUsage.cs
- ThreadSafeList.cs
- StylusSystemGestureEventArgs.cs
- IImplicitResourceProvider.cs
- Viewport2DVisual3D.cs
- NotificationContext.cs
- Hash.cs
- RemotingServices.cs
- ParseElement.cs
- GenericParameterDataContract.cs
- ToolStripPanelCell.cs
- LateBoundBitmapDecoder.cs
- SubMenuStyleCollection.cs