Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Core / System / Windows / FontStyle.cs / 1 / FontStyle.cs
//---------------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // Description: FontStyle structure. // // History: // 01/25/2005 [....] - Converted FontStyle from enum to a value type and moved it to a separate file. // //--------------------------------------------------------------------------- using System; using System.ComponentModel; using System.Diagnostics; namespace System.Windows { ////// FontStyle structure describes the style of a font face, such as Normal, Italic or Oblique. /// [TypeConverter(typeof(FontStyleConverter))] [Localizability(LocalizationCategory.None)] public struct FontStyle : IFormattable { internal FontStyle(int style) { Debug.Assert(0 <= style && style <= 2); _style = style; } ////// Checks whether two font weight objects are equal. /// /// First object to compare. /// Second object to compare. ///Returns true when the font weight values are equal for both objects, /// and false otherwise. public static bool operator ==(FontStyle left, FontStyle right) { return left._style == right._style; } ////// Checks whether two font weight objects are not equal. /// /// First object to compare. /// Second object to compare. ///Returns false when the font weight values are equal for both objects, /// and true otherwise. public static bool operator !=(FontStyle left, FontStyle right) { return !(left == right); } ////// Checks whether the object is equal to another FontStyle object. /// /// FontStyle object to compare with. ///Returns true when the object is equal to the input object, /// and false otherwise. public bool Equals(FontStyle obj) { return this == obj; } ////// Checks whether an object is equal to another character hit object. /// /// FontStyle 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 FontStyle)) return false; return this == (FontStyle)obj; } ////// Compute hash code for this object. /// ///A 32-bit signed integer hash code. public override int GetHashCode() { return _style; } ////// Creates a string representation of this object based on the current culture. /// ////// A string representation of this object. /// public override string ToString() { // Delegate to the internal method which implements all ToString calls. return ConvertToString(null, null); } ////// Creates a string representation of this object based on the format string /// and IFormatProvider passed in. /// If the provider is null, the CurrentCulture is used. /// See the documentation for IFormattable for more information. /// ////// A string representation of this object. /// string IFormattable.ToString(string format, IFormatProvider provider) { // Delegate to the internal method which implements all ToString calls. return ConvertToString(format, provider); } ////// This method is used only in type converter for construction via reflection. /// ///THe value of _style member. internal int GetStyleForInternalConstruction() { Debug.Assert(0 <= _style && _style <= 2); return _style; } ////// Creates a string representation of this object based on the format string /// and IFormatProvider passed in. /// If the provider is null, the CurrentCulture is used. /// See the documentation for IFormattable for more information. /// ////// A string representation of this object. /// private string ConvertToString(string format, IFormatProvider provider) { if (_style == 0) return "Normal"; if (_style == 1) return "Oblique"; Debug.Assert(_style == 2); return "Italic"; } private int _style; } } // 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
- FormViewActionList.cs
- ColumnMap.cs
- MultiAsyncResult.cs
- PrePostDescendentsWalker.cs
- PrinterUnitConvert.cs
- GeometryGroup.cs
- PageParser.cs
- _SslSessionsCache.cs
- SqlInfoMessageEvent.cs
- RewritingPass.cs
- ProbeMatchesCD1.cs
- SafeLocalMemHandle.cs
- PageSettings.cs
- SRGSCompiler.cs
- SafeHandles.cs
- Size3DValueSerializer.cs
- BindingWorker.cs
- PropertyKey.cs
- ResourcePermissionBase.cs
- MailSettingsSection.cs
- ImmutableClientRuntime.cs
- StylusPlugInCollection.cs
- GetChildSubtree.cs
- AppAction.cs
- SrgsElementFactoryCompiler.cs
- AnnotationStore.cs
- KeyBinding.cs
- Italic.cs
- QilTargetType.cs
- StylusPointPropertyId.cs
- _IPv6Address.cs
- ListViewGroup.cs
- AxHostDesigner.cs
- HighlightOverlayGlyph.cs
- DataRecordInternal.cs
- DrawingAttributeSerializer.cs
- mediaeventshelper.cs
- DataControlHelper.cs
- FastEncoderWindow.cs
- MetadataCache.cs
- ScrollViewerAutomationPeer.cs
- ObjectDataSource.cs
- PeerEndPoint.cs
- PageTheme.cs
- Table.cs
- BinaryEditor.cs
- InfoCardServiceInstallComponent.cs
- WindowsSolidBrush.cs
- WizardSideBarListControlItemEventArgs.cs
- MetricEntry.cs
- ItemCheckedEvent.cs
- FileSystemEnumerable.cs
- DataGridViewCellCollection.cs
- BitVec.cs
- NetPipeSectionData.cs
- XmlSchemaAttributeGroupRef.cs
- FontConverter.cs
- WindowsListViewGroupSubsetLink.cs
- ScrollItemPattern.cs
- InitiatorServiceModelSecurityTokenRequirement.cs
- ResourceDictionaryCollection.cs
- PersonalizationState.cs
- ContentTextAutomationPeer.cs
- NavigationHelper.cs
- CheckBoxPopupAdapter.cs
- PassportIdentity.cs
- RoutedUICommand.cs
- FileAuthorizationModule.cs
- RoutedEventHandlerInfo.cs
- PageTheme.cs
- DataSvcMapFile.cs
- ExportOptions.cs
- EntryIndex.cs
- CompilationLock.cs
- BoolExpr.cs
- StringFreezingAttribute.cs
- SmiEventSink_Default.cs
- ExpandCollapseProviderWrapper.cs
- RuntimeArgument.cs
- ClientSponsor.cs
- InputReferenceExpression.cs
- ClientTargetCollection.cs
- HtmlFormWrapper.cs
- OLEDB_Util.cs
- RangeValuePatternIdentifiers.cs
- StringToken.cs
- ProtocolViolationException.cs
- ImageSourceValueSerializer.cs
- DrawingContextDrawingContextWalker.cs
- TypeDescriptionProvider.cs
- StringBuilder.cs
- XmlSchemaValidator.cs
- UIPermission.cs
- EntityContainerRelationshipSet.cs
- BinHexDecoder.cs
- SuppressMergeCheckAttribute.cs
- OleDbParameter.cs
- DataBoundControlAdapter.cs
- CodeMemberMethod.cs
- MultidimensionalArrayItemReference.cs