Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Core / System / Windows / Media / textformatting / CharacterHit.cs / 1 / CharacterHit.cs
//---------------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // // Description: The CharacterHit structure represents information about a character hit // within a glyph run - the index of the first character that got hit and the information // about leading or trailing edge. // // See spec at [....]/sites/Avalon/Specs/Glyph%20Run%20hit%20testing%20and%20caret%20placement%20API.htm#CharacterHit // // // History: // 11/30/2004 : [....] - Created // //--------------------------------------------------------------------------- #region Using directives using System; #endregion namespace System.Windows.Media.TextFormatting { ////// The CharacterHit structure represents information about a character hit within a glyph run /// - the index of the first character that got hit and the information about leading or trailing edge. /// public struct CharacterHit : IEquatable{ /// /// Constructs a new CharacterHit structure. /// /// Index of the first character that got hit. /// In case of leading edge this value is 0. /// In case of trailing edge this value is the number of codepoints until the next valid caret position. public CharacterHit(int firstCharacterIndex, int trailingLength) { _firstCharacterIndex = firstCharacterIndex; _trailingLength = trailingLength; } ////// Index of the first character that got hit. /// public int FirstCharacterIndex { get { return _firstCharacterIndex; } } ////// In case of leading edge this value is 0. /// In case of trailing edge this value is the number of codepoints until the next valid caret position. /// public int TrailingLength { get { return _trailingLength; } } ////// Checks whether two character hit objects are equal. /// /// First object to compare. /// Second object to compare. ///Returns true when the values of FirstCharacterIndex and TrailingLength are equal for both objects, /// and false otherwise. public static bool operator==(CharacterHit left, CharacterHit right) { return left._firstCharacterIndex == right._firstCharacterIndex && left._trailingLength == right._trailingLength; } ////// Checks whether two character hit objects are not equal. /// /// First object to compare. /// Second object to compare. ///Returns false when the values of FirstCharacterIndex and TrailingLength are equal for both objects, /// and true otherwise. public static bool operator!=(CharacterHit left, CharacterHit right) { return !(left == right); } ////// Checks whether an object is equal to another character hit object. /// /// CharacterHit object to compare with. ///Returns true when the object is equal to the input object, /// and false otherwise. public bool Equals(CharacterHit obj) { return this == obj; } ////// Checks whether an object is equal to another character hit object. /// /// CharacterHit object to compare with. ///Returns true when the object is equal to the input object, /// and false otherwise. public override bool Equals(object obj) { if (!(obj is CharacterHit)) return false; return this == (CharacterHit)obj; } ////// Compute hash code for this object. /// ///A 32-bit signed integer hash code. public override int GetHashCode() { return _firstCharacterIndex.GetHashCode() ^ _trailingLength.GetHashCode(); } private int _firstCharacterIndex; private int _trailingLength; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ConnectionPoolManager.cs
- NoPersistProperty.cs
- ExpandCollapseProviderWrapper.cs
- CryptoHandle.cs
- StatusBar.cs
- DynamicQueryableWrapper.cs
- compensatingcollection.cs
- PackageStore.cs
- TriggerBase.cs
- WebPartDescription.cs
- DescendantQuery.cs
- ComboBoxItem.cs
- SystemResourceKey.cs
- CodeChecksumPragma.cs
- PopupControlService.cs
- GridViewItemAutomationPeer.cs
- MenuItemBindingCollection.cs
- ReadOnlyDictionary.cs
- SqlVisitor.cs
- ConnectionManagementElementCollection.cs
- SchemaImporterExtensionElementCollection.cs
- PipeStream.cs
- DataServiceKeyAttribute.cs
- BaseCodePageEncoding.cs
- ImageCodecInfoPrivate.cs
- ProjectionPlan.cs
- InfoCardTraceRecord.cs
- _CookieModule.cs
- GroupBoxRenderer.cs
- ConnectionStringSettingsCollection.cs
- GACIdentityPermission.cs
- ToggleProviderWrapper.cs
- StrongNameKeyPair.cs
- WebPartMovingEventArgs.cs
- LoginDesignerUtil.cs
- MultipartIdentifier.cs
- RuntimeWrappedException.cs
- ThreadInterruptedException.cs
- GenericTypeParameterBuilder.cs
- FragmentQuery.cs
- TextEditorCharacters.cs
- DocumentSchemaValidator.cs
- StylusPlugin.cs
- StrokeSerializer.cs
- TextRangeEditTables.cs
- EditorPartChrome.cs
- RoleService.cs
- PropertyFilterAttribute.cs
- SQLSingleStorage.cs
- ToolboxItemLoader.cs
- XmlNavigatorFilter.cs
- CompositeScriptReferenceEventArgs.cs
- MouseCaptureWithinProperty.cs
- StringDictionary.cs
- FactoryMaker.cs
- ConnectionManagementElement.cs
- StringFreezingAttribute.cs
- InputLanguageSource.cs
- MessageDecoder.cs
- ToolboxItem.cs
- RandomNumberGenerator.cs
- LambdaCompiler.Address.cs
- AsyncOperationManager.cs
- FrameSecurityDescriptor.cs
- HMACMD5.cs
- MetadataItemSerializer.cs
- NameSpaceEvent.cs
- ToolBarButtonClickEvent.cs
- DecimalAnimationBase.cs
- MinMaxParagraphWidth.cs
- SelectedGridItemChangedEvent.cs
- IndependentAnimationStorage.cs
- ListBindingHelper.cs
- SystemWebSectionGroup.cs
- GridViewItemAutomationPeer.cs
- HttpCookiesSection.cs
- DeleteMemberBinder.cs
- MatrixKeyFrameCollection.cs
- WebHttpSecurity.cs
- RegexCompilationInfo.cs
- DataRowChangeEvent.cs
- DPCustomTypeDescriptor.cs
- QueryCursorEventArgs.cs
- ExpressionBindings.cs
- DeferredReference.cs
- Selector.cs
- SchemaCollectionPreprocessor.cs
- CodeDirectoryCompiler.cs
- ToolboxItemAttribute.cs
- DesignerTransactionCloseEvent.cs
- newinstructionaction.cs
- SmtpAuthenticationManager.cs
- UDPClient.cs
- InternalMappingException.cs
- ProtocolViolationException.cs
- Stream.cs
- SettingsBindableAttribute.cs
- RuleEngine.cs
- UInt32Converter.cs
- Operand.cs