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 / 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
- ChameleonKey.cs
- XmlSchemaDatatype.cs
- COM2Enum.cs
- GlobalizationAssembly.cs
- IERequestCache.cs
- webproxy.cs
- LookupBindingPropertiesAttribute.cs
- ThemeableAttribute.cs
- CustomLineCap.cs
- Debug.cs
- HttpConfigurationSystem.cs
- ControlCollection.cs
- MediaPlayer.cs
- MouseCaptureWithinProperty.cs
- ListSourceHelper.cs
- HwndKeyboardInputProvider.cs
- ImageButton.cs
- ProcessMessagesAsyncResult.cs
- CodeObjectCreateExpression.cs
- PagePropertiesChangingEventArgs.cs
- Image.cs
- LinkButton.cs
- StreamingContext.cs
- NetworkInformationException.cs
- WebPartConnectionCollection.cs
- ReadOnlyCollectionBase.cs
- DecoratedNameAttribute.cs
- RetriableClipboard.cs
- CompilerResults.cs
- TransactionTable.cs
- CacheEntry.cs
- ByteKeyFrameCollection.cs
- TemplateNodeContextMenu.cs
- XmlAttributeCollection.cs
- Knowncolors.cs
- AudioFileOut.cs
- HwndHostAutomationPeer.cs
- connectionpool.cs
- ArgIterator.cs
- fixedPageContentExtractor.cs
- ConfigurationSectionGroup.cs
- DataServiceResponse.cs
- DataControlFieldCollection.cs
- FocusManager.cs
- ArcSegment.cs
- HttpProcessUtility.cs
- InternalResources.cs
- ValidatorCollection.cs
- TextElement.cs
- InputMethodStateTypeInfo.cs
- __Error.cs
- UnionCqlBlock.cs
- MimeParameters.cs
- SourceSwitch.cs
- GregorianCalendar.cs
- SuppressIldasmAttribute.cs
- UserPersonalizationStateInfo.cs
- ColorTransformHelper.cs
- CustomAttributeFormatException.cs
- CodeIndexerExpression.cs
- XmlSchemaComplexContentExtension.cs
- FunctionQuery.cs
- DependencyPropertyDescriptor.cs
- ToolBarButton.cs
- SqlCacheDependencySection.cs
- TextCharacters.cs
- SchemaNames.cs
- StaticFileHandler.cs
- Popup.cs
- safex509handles.cs
- SchemaNamespaceManager.cs
- SystemInformation.cs
- PreProcessInputEventArgs.cs
- OdbcFactory.cs
- RSAOAEPKeyExchangeDeformatter.cs
- BufferedStream.cs
- Grammar.cs
- RoutedEventArgs.cs
- SqlTrackingService.cs
- TaskFileService.cs
- SchemaEntity.cs
- ColorMap.cs
- GridEntry.cs
- GenericQueueSurrogate.cs
- InfoCardRSAOAEPKeyExchangeFormatter.cs
- _UncName.cs
- ConnectionsZoneAutoFormat.cs
- DockProviderWrapper.cs
- ConfigurationValue.cs
- TextElementAutomationPeer.cs
- InstalledVoice.cs
- HttpChannelListener.cs
- HwndSourceParameters.cs
- WebPartUserCapability.cs
- LifetimeServices.cs
- BufferedOutputStream.cs
- XappLauncher.cs
- ExpressionBindingCollection.cs
- PersonalizableAttribute.cs
- IIS7WorkerRequest.cs