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
- ParserContext.cs
- BindingExpressionBase.cs
- ObjectKeyFrameCollection.cs
- ScrollItemPatternIdentifiers.cs
- ErrorsHelper.cs
- _ListenerRequestStream.cs
- LogExtent.cs
- AssociationSet.cs
- ProcessInputEventArgs.cs
- PointCollection.cs
- XmlMemberMapping.cs
- DesignerActionList.cs
- KeySpline.cs
- HttpContext.cs
- ListParagraph.cs
- XmlBindingWorker.cs
- FolderLevelBuildProvider.cs
- ProtocolsConfigurationHandler.cs
- OAVariantLib.cs
- ImageCreator.cs
- ScriptReferenceBase.cs
- ProcessProtocolHandler.cs
- precedingquery.cs
- SymLanguageType.cs
- SoapExtension.cs
- CryptoApi.cs
- VisualState.cs
- CatalogPart.cs
- DataGridViewCellLinkedList.cs
- ImageSourceTypeConverter.cs
- Vector3DIndependentAnimationStorage.cs
- LinkButton.cs
- XmlReturnReader.cs
- SqlServices.cs
- RegexWriter.cs
- SiteMapDataSourceView.cs
- XPathNodeList.cs
- Activator.cs
- ObjectStateFormatter.cs
- DoubleMinMaxAggregationOperator.cs
- WindowsSlider.cs
- TreeViewBindingsEditor.cs
- WorkflowClientDeliverMessageWrapper.cs
- ObjectParameter.cs
- CustomTrackingQuery.cs
- RowBinding.cs
- DataSysAttribute.cs
- JournalNavigationScope.cs
- ScaleTransform.cs
- NetTcpSectionData.cs
- ServiceDocumentFormatter.cs
- ComponentCollection.cs
- BorderSidesEditor.cs
- invalidudtexception.cs
- CorePropertiesFilter.cs
- ParameterModifier.cs
- FileIOPermission.cs
- SqlDataSourceConfigureSelectPanel.cs
- RegexStringValidatorAttribute.cs
- IconHelper.cs
- initElementDictionary.cs
- TreeBuilder.cs
- CompilationPass2TaskInternal.cs
- Message.cs
- EditorPart.cs
- WebAdminConfigurationHelper.cs
- HttpVersion.cs
- LassoSelectionBehavior.cs
- ParagraphResult.cs
- XmlSchemaComplexType.cs
- StorageAssociationSetMapping.cs
- MemberInfoSerializationHolder.cs
- TextEditorTyping.cs
- LongValidatorAttribute.cs
- BitmapSourceSafeMILHandle.cs
- WindowsRegion.cs
- PanelDesigner.cs
- ColumnMapProcessor.cs
- DynamicILGenerator.cs
- WsatServiceAddress.cs
- DataTableMappingCollection.cs
- StrokeNodeData.cs
- TargetPerspective.cs
- NativeCppClassAttribute.cs
- TriggerBase.cs
- ConfigurationLocationCollection.cs
- ToolboxItemAttribute.cs
- DiscoveryMessageSequenceGenerator.cs
- InvalidEnumArgumentException.cs
- InitiatorServiceModelSecurityTokenRequirement.cs
- TypeReference.cs
- FrameAutomationPeer.cs
- PageCanvasSize.cs
- MethodBuilderInstantiation.cs
- ValueProviderWrapper.cs
- JumpPath.cs
- MenuItemStyleCollection.cs
- ExtenderHelpers.cs
- BrowserDefinition.cs
- XmlObjectSerializerContext.cs