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
- WebBrowserSiteBase.cs
- IOException.cs
- IntAverageAggregationOperator.cs
- CompoundFileIOPermission.cs
- InheritanceAttribute.cs
- DictionarySurrogate.cs
- BookmarkEventArgs.cs
- ApplicationHost.cs
- TransformedBitmap.cs
- TextComposition.cs
- TagNameToTypeMapper.cs
- DesignerMetadata.cs
- SaveFileDialog.cs
- assertwrapper.cs
- ZipIOCentralDirectoryFileHeader.cs
- XmlWrappingReader.cs
- LoginName.cs
- SplitterCancelEvent.cs
- ExpressionBuilder.cs
- WindowInteropHelper.cs
- RIPEMD160Managed.cs
- MiniAssembly.cs
- ContextBase.cs
- XmlSchemaGroupRef.cs
- IntegerCollectionEditor.cs
- ConfigXmlText.cs
- CodeGenerator.cs
- QueryOptionExpression.cs
- PropertyGridView.cs
- StorageEntitySetMapping.cs
- SqlDependencyListener.cs
- CollectionEditor.cs
- SortedList.cs
- CounterSet.cs
- InputScopeNameConverter.cs
- ThreadSafeList.cs
- HwndTarget.cs
- IODescriptionAttribute.cs
- DataBindEngine.cs
- TemplateKey.cs
- SqlDataSourceConfigureFilterForm.cs
- SqlDataSourceCommandEventArgs.cs
- SmiEventSink_Default.cs
- Convert.cs
- DetailsViewPageEventArgs.cs
- RawStylusInputCustomDataList.cs
- Int32Animation.cs
- LogReservationCollection.cs
- FilteredReadOnlyMetadataCollection.cs
- SystemWebSectionGroup.cs
- SystemIPInterfaceStatistics.cs
- TabControlAutomationPeer.cs
- RijndaelManagedTransform.cs
- StsCommunicationException.cs
- FocusChangedEventArgs.cs
- BitmapMetadataBlob.cs
- WsdlServiceChannelBuilder.cs
- RootProjectionNode.cs
- CompModSwitches.cs
- LogicalExpr.cs
- AnonymousIdentificationSection.cs
- ValueTypeFixupInfo.cs
- Pair.cs
- RawStylusSystemGestureInputReport.cs
- WinEventHandler.cs
- SqlUdtInfo.cs
- FixedSOMFixedBlock.cs
- DataService.cs
- SelectionListDesigner.cs
- SqlDataSourceCommandEventArgs.cs
- SearchExpression.cs
- Model3DCollection.cs
- FrameSecurityDescriptor.cs
- BamlStream.cs
- InfiniteTimeSpanConverter.cs
- BasicExpandProvider.cs
- WebPermission.cs
- ValidationEventArgs.cs
- EditorPart.cs
- EntityDataSourceView.cs
- CodeNamespaceImportCollection.cs
- HintTextConverter.cs
- CatalogZoneAutoFormat.cs
- FileUpload.cs
- FusionWrap.cs
- CodeSubDirectory.cs
- SendReply.cs
- DetailsViewInsertedEventArgs.cs
- _ProxyChain.cs
- DateTimeFormatInfo.cs
- Image.cs
- ConfigXmlComment.cs
- TypeBuilder.cs
- XmlDataDocument.cs
- FrameworkElement.cs
- FamilyTypefaceCollection.cs
- FocusTracker.cs
- WebControl.cs
- ContextQuery.cs
- AttributeQuery.cs