Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / WinForms / Managed / System / WinForms / PreviewKeyDownEventArgs.cs / 1305376 / 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. /// ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TranslateTransform.cs
- WebConvert.cs
- RuntimeHandles.cs
- TypeBuilderInstantiation.cs
- IsolatedStorageFileStream.cs
- CalendarButton.cs
- SerializableAttribute.cs
- IdentityNotMappedException.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- ObservableDictionary.cs
- ToolStripContainer.cs
- OdbcConnectionHandle.cs
- XPathSelectionIterator.cs
- AmbientLight.cs
- TreeBuilderXamlTranslator.cs
- DataError.cs
- ExpressionHelper.cs
- DetectRunnableInstancesTask.cs
- codemethodreferenceexpression.cs
- ContextMenu.cs
- EntityChangedParams.cs
- _HTTPDateParse.cs
- MailMessageEventArgs.cs
- IOException.cs
- StrongNameKeyPair.cs
- NullReferenceException.cs
- RijndaelManaged.cs
- DirectionalLight.cs
- LocationSectionRecord.cs
- PartialCachingAttribute.cs
- ConfigXmlCDataSection.cs
- RegexNode.cs
- DetailsViewRowCollection.cs
- TextRunCacheImp.cs
- DropShadowEffect.cs
- precedingsibling.cs
- CollectionBuilder.cs
- _ScatterGatherBuffers.cs
- ConfigXmlElement.cs
- Menu.cs
- ParamArrayAttribute.cs
- LogAppendAsyncResult.cs
- XmlILOptimizerVisitor.cs
- Update.cs
- SecurityRuntime.cs
- HtmlElement.cs
- FileClassifier.cs
- PrePrepareMethodAttribute.cs
- GenericEnumerator.cs
- HttpProfileGroupBase.cs
- LayoutDump.cs
- WinFormsUtils.cs
- DNS.cs
- DetailsViewModeEventArgs.cs
- CustomErrorsSection.cs
- BindableAttribute.cs
- AsyncPostBackErrorEventArgs.cs
- EntityContainerRelationshipSet.cs
- ListViewUpdateEventArgs.cs
- MinimizableAttributeTypeConverter.cs
- ProxyWebPartManager.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- SchemaContext.cs
- TextElementAutomationPeer.cs
- AuthenticationModuleElementCollection.cs
- MappingSource.cs
- Font.cs
- WebConfigurationHost.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- OptimalTextSource.cs
- WebBrowser.cs
- CodeFieldReferenceExpression.cs
- FunctionMappingTranslator.cs
- ConfigDefinitionUpdates.cs
- ISAPIRuntime.cs
- TypeRefElement.cs
- XmlTypeMapping.cs
- ObjectListComponentEditor.cs
- ModulesEntry.cs
- DbReferenceCollection.cs
- WebRequestModulesSection.cs
- ParameterRetriever.cs
- SqlCharStream.cs
- AsymmetricKeyExchangeDeformatter.cs
- ProfileProvider.cs
- RoleGroupCollection.cs
- ScrollPatternIdentifiers.cs
- CommonDialog.cs
- HtmlShim.cs
- ExpandedWrapper.cs
- TableCell.cs
- Variant.cs
- RegexWorker.cs
- LifetimeServices.cs
- AnimationClock.cs
- CreateInstanceBinder.cs
- Document.cs
- ItemsControl.cs
- OrderedDictionaryStateHelper.cs
- EventLogPermissionEntry.cs