Code:
/ DotNET / DotNET / 8.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
- EncodingTable.cs
- ModelItemCollection.cs
- DashStyle.cs
- FixedSOMSemanticBox.cs
- StatusStrip.cs
- ConstNode.cs
- ObjectViewEntityCollectionData.cs
- CaseExpr.cs
- XmlSchemaInferenceException.cs
- ManagedFilter.cs
- Screen.cs
- CalendarDateChangedEventArgs.cs
- DbInsertCommandTree.cs
- ButtonChrome.cs
- NativeMethods.cs
- FormatControl.cs
- HttpFileCollection.cs
- DrawingDrawingContext.cs
- JsonReaderDelegator.cs
- JpegBitmapEncoder.cs
- TagMapCollection.cs
- UIPermission.cs
- TypeResolvingOptions.cs
- UIElementParagraph.cs
- UnknownBitmapEncoder.cs
- __Filters.cs
- precedingquery.cs
- ScrollBar.cs
- BamlRecords.cs
- WebPartVerb.cs
- Button.cs
- TemplateParser.cs
- RTLAwareMessageBox.cs
- SafeFileHandle.cs
- PeerCollaborationPermission.cs
- cookiecollection.cs
- Selector.cs
- TableLayoutRowStyleCollection.cs
- SQLDoubleStorage.cs
- Message.cs
- InfoCard.cs
- XmlSchemaFacet.cs
- ServiceObjectContainer.cs
- Evidence.cs
- WebPartConnectionsCancelVerb.cs
- ButtonChrome.cs
- Rfc2898DeriveBytes.cs
- CellTreeNodeVisitors.cs
- UrlAuthorizationModule.cs
- XsltLibrary.cs
- LookupBindingPropertiesAttribute.cs
- DataControlCommands.cs
- CollectionBuilder.cs
- HwndSubclass.cs
- CapabilitiesPattern.cs
- StrokeCollectionDefaultValueFactory.cs
- TitleStyle.cs
- NewItemsContextMenuStrip.cs
- SharedTcpTransportManager.cs
- ExpressionsCollectionEditor.cs
- XmlStreamStore.cs
- CodeExporter.cs
- DiscreteKeyFrames.cs
- FileFormatException.cs
- TemplatedWizardStep.cs
- ModelPerspective.cs
- XmlAttributeCollection.cs
- SqlGenericUtil.cs
- EventLogSession.cs
- WindowsStatusBar.cs
- SoapDocumentServiceAttribute.cs
- Inflater.cs
- ThreadStateException.cs
- CountAggregationOperator.cs
- AnimationTimeline.cs
- SqlDataRecord.cs
- PageParserFilter.cs
- RowTypePropertyElement.cs
- RouteValueExpressionBuilder.cs
- AstTree.cs
- UIPropertyMetadata.cs
- DBPropSet.cs
- WorkflowShape.cs
- StructuredProperty.cs
- SQLGuidStorage.cs
- BamlBinaryReader.cs
- Types.cs
- SqlDelegatedTransaction.cs
- WebResourceAttribute.cs
- SingleConverter.cs
- SocketInformation.cs
- AdjustableArrowCap.cs
- GroupBoxDesigner.cs
- OptimizedTemplateContent.cs
- ComAdminWrapper.cs
- CellRelation.cs
- WorkflowMarkupSerializationManager.cs
- Activity.cs
- Color.cs
- AutomationPatternInfo.cs