Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / 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. // Copyright (c) Microsoft Corporation. All rights reserved./// 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
- PieceNameHelper.cs
- _ProxyRegBlob.cs
- OracleBinary.cs
- MsmqTransportBindingElement.cs
- UmAlQuraCalendar.cs
- Drawing.cs
- ScalarOps.cs
- Stack.cs
- TypeDescriptionProvider.cs
- CustomPopupPlacement.cs
- XmlIgnoreAttribute.cs
- CharStorage.cs
- InvalidDataException.cs
- VirtualizedContainerService.cs
- UnionExpr.cs
- LoginUtil.cs
- WebPartDescription.cs
- SessionEndingCancelEventArgs.cs
- TemplateControlCodeDomTreeGenerator.cs
- MediaContext.cs
- FlowDocument.cs
- BmpBitmapDecoder.cs
- LocatorManager.cs
- Visual3D.cs
- DeploymentSection.cs
- DBAsyncResult.cs
- AutoGeneratedFieldProperties.cs
- RoutedCommand.cs
- NamespaceEmitter.cs
- FileReservationCollection.cs
- EventBindingService.cs
- TypeGeneratedEventArgs.cs
- HashMembershipCondition.cs
- ZipIOLocalFileHeader.cs
- OptimizerPatterns.cs
- SqlNodeTypeOperators.cs
- WebPartVerbsEventArgs.cs
- FontClient.cs
- GridSplitter.cs
- DeviceContext.cs
- WebServiceData.cs
- FigureParaClient.cs
- XPathNodeList.cs
- SafeProcessHandle.cs
- HttpHandlerAction.cs
- CellCreator.cs
- Double.cs
- MobileControlsSectionHandler.cs
- FormParameter.cs
- XmlSerializationGeneratedCode.cs
- CategoryNameCollection.cs
- SettingsBindableAttribute.cs
- RootBrowserWindowAutomationPeer.cs
- SmtpNtlmAuthenticationModule.cs
- NavigatorOutput.cs
- RequestResizeEvent.cs
- EdmEntityTypeAttribute.cs
- _AutoWebProxyScriptEngine.cs
- NameValueCollection.cs
- DataBindEngine.cs
- Size3D.cs
- SqlMethodTransformer.cs
- SerializerProvider.cs
- SourceChangedEventArgs.cs
- DeclarationUpdate.cs
- ComplexType.cs
- RequestQueryProcessor.cs
- InputProviderSite.cs
- SettingsProperty.cs
- SudsWriter.cs
- VisemeEventArgs.cs
- IdentityReference.cs
- ToolStripProgressBar.cs
- KerberosSecurityTokenAuthenticator.cs
- EdmRelationshipRoleAttribute.cs
- CodeSnippetStatement.cs
- DataGridViewComboBoxColumn.cs
- FamilyMap.cs
- HotSpot.cs
- ListViewTableCell.cs
- ByeOperationAsyncResult.cs
- ExtendedPropertyDescriptor.cs
- DynamicRenderer.cs
- KeySpline.cs
- FontFaceLayoutInfo.cs
- RepeaterItem.cs
- DynamicUpdateCommand.cs
- xsdvalidator.cs
- CharacterBufferReference.cs
- BitVec.cs
- Policy.cs
- ByteKeyFrameCollection.cs
- JobStaple.cs
- TransformerTypeCollection.cs
- FormViewPagerRow.cs
- MetadataItemSerializer.cs
- UrlPropertyAttribute.cs
- HttpCachePolicyElement.cs
- SelectionProcessor.cs
- QilCloneVisitor.cs