Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / WinForms / Managed / System / WinForms / PreviewKeyDownEventArgs.cs / 1 / PreviewKeyDownEventArgs.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms { using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System; ////// /// /// public class PreviewKeyDownEventArgs : EventArgs { private readonly Keys _keyData; private bool _isInputKey; ////// Provides data for the PreviewKeyDownEvent /// ////// /// public PreviewKeyDownEventArgs(Keys keyData) { _keyData = keyData; } ///[To be supplied.] ////// /// public bool Alt { get { return (_keyData & Keys.Alt) == Keys.Alt; } } ////// Gets a value indicating whether the ALT key was pressed. /// ////// /// public bool Control { get { return (_keyData & Keys.Control) == Keys.Control; } } ////// Gets a value indicating whether the CTRL key was pressed. /// ////// /// //subhag : changed the behaviour of the KeyCode as per the new requirements. public Keys KeyCode { [ // Keys is discontiguous so we have to use Enum.IsDefined. SuppressMessage("Microsoft.Performance", "CA1803:AvoidCostlyCallsWherePossible") ] get { Keys keyGenerated = _keyData & Keys.KeyCode; // since Keys can be discontiguous, keeping Enum.IsDefined. if (!Enum.IsDefined(typeof(Keys),(int)keyGenerated)) return Keys.None; else return keyGenerated; } } ////// Gets the keyboard code for a ///or /// event. /// /// /// //subhag : added the KeyValue as per the new requirements. public int KeyValue { get { return (int)(_keyData & Keys.KeyCode); } } ////// Gets the keyboard value for a ///or /// event. /// /// /// public Keys KeyData { get { return _keyData; } } ////// Gets the key data for a ///or /// event. /// /// /// public Keys Modifiers { get { return _keyData & Keys.Modifiers; } } ////// Gets the modifier flags for a ///or event. /// This indicates which modifier keys (CTRL, SHIFT, and/or ALT) were pressed. /// /// /// public bool Shift { get { return (_keyData & Keys.Shift) == Keys.Shift; } } public bool IsInputKey { get { return _isInputKey; } set { _isInputKey = value; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ ///// Gets /// a value indicating whether the SHIFT key was pressed. /// ///// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms { using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System; ////// /// /// public class PreviewKeyDownEventArgs : EventArgs { private readonly Keys _keyData; private bool _isInputKey; ////// Provides data for the PreviewKeyDownEvent /// ////// /// public PreviewKeyDownEventArgs(Keys keyData) { _keyData = keyData; } ///[To be supplied.] ////// /// public bool Alt { get { return (_keyData & Keys.Alt) == Keys.Alt; } } ////// Gets a value indicating whether the ALT key was pressed. /// ////// /// public bool Control { get { return (_keyData & Keys.Control) == Keys.Control; } } ////// Gets a value indicating whether the CTRL key was pressed. /// ////// /// //subhag : changed the behaviour of the KeyCode as per the new requirements. public Keys KeyCode { [ // Keys is discontiguous so we have to use Enum.IsDefined. SuppressMessage("Microsoft.Performance", "CA1803:AvoidCostlyCallsWherePossible") ] get { Keys keyGenerated = _keyData & Keys.KeyCode; // since Keys can be discontiguous, keeping Enum.IsDefined. if (!Enum.IsDefined(typeof(Keys),(int)keyGenerated)) return Keys.None; else return keyGenerated; } } ////// Gets the keyboard code for a ///or /// event. /// /// /// //subhag : added the KeyValue as per the new requirements. public int KeyValue { get { return (int)(_keyData & Keys.KeyCode); } } ////// Gets the keyboard value for a ///or /// event. /// /// /// public Keys KeyData { get { return _keyData; } } ////// Gets the key data for a ///or /// event. /// /// /// public Keys Modifiers { get { return _keyData & Keys.Modifiers; } } ////// Gets the modifier flags for a ///or event. /// This indicates which modifier keys (CTRL, SHIFT, and/or ALT) were pressed. /// /// /// public bool Shift { get { return (_keyData & Keys.Shift) == Keys.Shift; } } public bool IsInputKey { get { return _isInputKey; } set { _isInputKey = value; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007./// Gets /// a value indicating whether the SHIFT key was pressed. /// ///
Link Menu
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ActivityTypeCodeDomSerializer.cs
- DataGridViewColumnCollection.cs
- WebPartAuthorizationEventArgs.cs
- ByteStreamGeometryContext.cs
- AQNBuilder.cs
- UnrecognizedAssertionsBindingElement.cs
- SqlTriggerAttribute.cs
- Stack.cs
- PropertyChangingEventArgs.cs
- Floater.cs
- TransformGroup.cs
- SymmetricSecurityProtocol.cs
- SoapAttributeOverrides.cs
- PlatformNotSupportedException.cs
- TableRowGroup.cs
- PageParser.cs
- ToolboxItem.cs
- Regex.cs
- DbgUtil.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- WebPartTransformerCollection.cs
- DbUpdateCommandTree.cs
- GenericAuthenticationEventArgs.cs
- Binding.cs
- StatusBarDrawItemEvent.cs
- LabelDesigner.cs
- DataViewSettingCollection.cs
- ClientFormsAuthenticationCredentials.cs
- ConfigurationPropertyCollection.cs
- ResolveMatchesMessage11.cs
- SqlRecordBuffer.cs
- XmlElementElementCollection.cs
- SoapFaultCodes.cs
- SafeTokenHandle.cs
- PackUriHelper.cs
- MenuEventArgs.cs
- NetworkAddressChange.cs
- DocumentSequence.cs
- XmlSchemaInferenceException.cs
- NativeActivityFaultContext.cs
- PreProcessor.cs
- Control.cs
- CodeCommentStatementCollection.cs
- IisTraceWebEventProvider.cs
- ConfigXmlReader.cs
- SectionRecord.cs
- BindMarkupExtensionSerializer.cs
- VariableAction.cs
- EntityViewGenerator.cs
- Listbox.cs
- Delegate.cs
- CatalogPartChrome.cs
- MapPathBasedVirtualPathProvider.cs
- ObjectPersistData.cs
- SourceInterpreter.cs
- TextBlock.cs
- CustomAssemblyResolver.cs
- InvalidPropValue.cs
- ItemsChangedEventArgs.cs
- Unit.cs
- CatalogZoneBase.cs
- CodeDelegateCreateExpression.cs
- parserscommon.cs
- CollectionView.cs
- ColorTransformHelper.cs
- PersonalizablePropertyEntry.cs
- CharacterBufferReference.cs
- Emitter.cs
- mediapermission.cs
- TemplateContent.cs
- WinCategoryAttribute.cs
- PersonalizablePropertyEntry.cs
- AuthenticationException.cs
- ISFTagAndGuidCache.cs
- ProtocolException.cs
- ParameterModifier.cs
- PowerModeChangedEventArgs.cs
- arabicshape.cs
- RefType.cs
- BitmapImage.cs
- ContentPresenter.cs
- TabletCollection.cs
- ConfigurationErrorsException.cs
- AsynchronousChannelMergeEnumerator.cs
- WebZone.cs
- MessageSmuggler.cs
- VirtualStackFrame.cs
- EngineSite.cs
- HMACSHA256.cs
- CheckedPointers.cs
- ListViewItem.cs
- ProcessRequestArgs.cs
- UTF8Encoding.cs
- ToolStripItemTextRenderEventArgs.cs
- CmsInterop.cs
- ConstructorNeedsTagAttribute.cs
- ProxyWebPartManagerDesigner.cs
- HMACSHA256.cs
- NaturalLanguageHyphenator.cs
- ResourceSet.cs