Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / Core / CSharp / System / Windows / FontStyle.cs / 1 / FontStyle.cs
//---------------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // Description: FontStyle structure. // // History: // 01/25/2005 mleonov - 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. // // Description: FontStyle structure. // // History: // 01/25/2005 mleonov - 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ListItemCollection.cs
- ConnectionManagementElementCollection.cs
- ImpersonateTokenRef.cs
- RawStylusInputCustomData.cs
- ContractInferenceHelper.cs
- Binding.cs
- SortQuery.cs
- Random.cs
- Encoding.cs
- TextParentUndoUnit.cs
- Literal.cs
- BulletChrome.cs
- DispatcherTimer.cs
- ValidationErrorEventArgs.cs
- ListCollectionView.cs
- ActivationArguments.cs
- SelectionItemProviderWrapper.cs
- FixedSOMTableCell.cs
- Underline.cs
- WindowsRebar.cs
- XmlSerializableReader.cs
- TcpTransportSecurityElement.cs
- WebHeaderCollection.cs
- AtomMaterializerLog.cs
- DoubleAnimationClockResource.cs
- ByteFacetDescriptionElement.cs
- WebContext.cs
- FormatVersion.cs
- RectangleF.cs
- SqlBulkCopyColumnMapping.cs
- Formatter.cs
- ComponentCollection.cs
- RtfFormatStack.cs
- ConfigXmlAttribute.cs
- ReferenceEqualityComparer.cs
- HwndMouseInputProvider.cs
- StateItem.cs
- StructuredCompositeActivityDesigner.cs
- DataTableTypeConverter.cs
- OletxCommittableTransaction.cs
- HierarchicalDataBoundControlAdapter.cs
- ReachUIElementCollectionSerializerAsync.cs
- IODescriptionAttribute.cs
- GridViewCellAutomationPeer.cs
- ClearCollection.cs
- MiniMapControl.xaml.cs
- MethodAccessException.cs
- DataReaderContainer.cs
- baseaxisquery.cs
- FontNamesConverter.cs
- BufferedReadStream.cs
- DataGridViewRowHeaderCell.cs
- SelectorItemAutomationPeer.cs
- Rotation3D.cs
- TransportContext.cs
- TreeViewImageKeyConverter.cs
- Convert.cs
- DependentList.cs
- InkCanvasSelection.cs
- Triplet.cs
- BrowserDefinitionCollection.cs
- PageAsyncTask.cs
- Utils.cs
- BooleanSwitch.cs
- ForceCopyBuildProvider.cs
- SystemIPInterfaceProperties.cs
- PrefixQName.cs
- DbDataRecord.cs
- WmlMobileTextWriter.cs
- CatchBlock.cs
- DSASignatureFormatter.cs
- Scene3D.cs
- TCPListener.cs
- ContentType.cs
- FrameAutomationPeer.cs
- ColorConvertedBitmapExtension.cs
- TimelineGroup.cs
- SrgsGrammarCompiler.cs
- HelpKeywordAttribute.cs
- QilFunction.cs
- OperationResponse.cs
- CancellationHandler.cs
- AsyncDataRequest.cs
- XhtmlTextWriter.cs
- QuaternionAnimation.cs
- DataGridToolTip.cs
- DesignerForm.cs
- InputBinder.cs
- AdornerPresentationContext.cs
- BitmapEffect.cs
- TreeViewImageGenerator.cs
- RuleSettings.cs
- Panel.cs
- WebPartCancelEventArgs.cs
- XPathNavigator.cs
- ResourcesChangeInfo.cs
- JsonWriterDelegator.cs
- SecurityKeyUsage.cs
- AttributeUsageAttribute.cs
- FlowDocumentView.cs