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
- Mappings.cs
- FontUnitConverter.cs
- LocalizationCodeDomSerializer.cs
- CombinedGeometry.cs
- IpcServerChannel.cs
- CopyAction.cs
- NewArray.cs
- DefaultConfirmation.cs
- compensatingcollection.cs
- SynchronizedDispatch.cs
- Accessible.cs
- WeakReferenceList.cs
- UpdatePanel.cs
- ImageButton.cs
- UseLicense.cs
- Trace.cs
- CaseDesigner.xaml.cs
- SqlDelegatedTransaction.cs
- SapiRecoContext.cs
- ItemsPanelTemplate.cs
- TcpSocketManager.cs
- DrawingAttributes.cs
- OleDbRowUpdatingEvent.cs
- PipelineDeploymentState.cs
- HorizontalAlignConverter.cs
- TypeUsage.cs
- TextTreeRootNode.cs
- FormattedText.cs
- StringHelper.cs
- FrugalList.cs
- TableLayoutColumnStyleCollection.cs
- WithParamAction.cs
- XamlGridLengthSerializer.cs
- ListViewUpdatedEventArgs.cs
- TakeOrSkipQueryOperator.cs
- ProgressBarBrushConverter.cs
- MaterializeFromAtom.cs
- SystemIPGlobalStatistics.cs
- ServiceBusyException.cs
- FormCollection.cs
- MetricEntry.cs
- GiveFeedbackEvent.cs
- ToolStripSystemRenderer.cs
- PerfCounters.cs
- CodeAccessSecurityEngine.cs
- ServerValidateEventArgs.cs
- Literal.cs
- NetSectionGroup.cs
- SqlMethodAttribute.cs
- SoapProtocolReflector.cs
- DictionaryCustomTypeDescriptor.cs
- InstancePersistenceException.cs
- Util.cs
- PopupRootAutomationPeer.cs
- SqlCacheDependency.cs
- NamespaceCollection.cs
- _LocalDataStore.cs
- Vector3DAnimation.cs
- AbstractDataSvcMapFileLoader.cs
- HttpModuleActionCollection.cs
- ViewManager.cs
- IIS7ConfigurationLoader.cs
- Dynamic.cs
- ArrayConverter.cs
- StorageTypeMapping.cs
- MarshalByRefObject.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- AbandonedMutexException.cs
- MarshalByValueComponent.cs
- RegexBoyerMoore.cs
- DiagnosticStrings.cs
- SecurityHelper.cs
- TextSelectionHelper.cs
- AnimationClock.cs
- SoapHelper.cs
- CriticalHandle.cs
- RtfFormatStack.cs
- WhitespaceRuleLookup.cs
- SystemBrushes.cs
- NativeRecognizer.cs
- EntryPointNotFoundException.cs
- XmlCharType.cs
- NetworkInterface.cs
- DefaultPrintController.cs
- CellIdBoolean.cs
- ConstructorExpr.cs
- RecognizerBase.cs
- CollectionConverter.cs
- GlyphTypeface.cs
- Guid.cs
- mediaeventargs.cs
- EasingKeyFrames.cs
- RIPEMD160Managed.cs
- ManagedIStream.cs
- KoreanCalendar.cs
- EmptyControlCollection.cs
- XmlWrappingReader.cs
- DoubleAnimationClockResource.cs
- WebConfigurationFileMap.cs
- ResourcesBuildProvider.cs