Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- CellRelation.cs
- ServiceDescriptionData.cs
- SoapIncludeAttribute.cs
- ObjectKeyFrameCollection.cs
- TransformPattern.cs
- SchemaDeclBase.cs
- XmlQueryType.cs
- SmiEventSink_DeferedProcessing.cs
- DataGridTextBox.cs
- CompositeDuplexBindingElement.cs
- FlowDocumentView.cs
- StorageFunctionMapping.cs
- WinOEToolBoxItem.cs
- Accessible.cs
- XPathDocumentBuilder.cs
- GroupBoxAutomationPeer.cs
- DragEvent.cs
- UnmanagedMemoryAccessor.cs
- TargetFrameworkAttribute.cs
- AssemblyCacheEntry.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- PropertyConverter.cs
- NullExtension.cs
- BindToObject.cs
- SmtpTransport.cs
- AnnotationResourceCollection.cs
- SpnEndpointIdentity.cs
- BindingExpressionBase.cs
- PasswordDeriveBytes.cs
- ZipArchive.cs
- DesignTimeTemplateParser.cs
- XmlWrappingWriter.cs
- UniqueIdentifierService.cs
- XmlSerializationReader.cs
- SmtpTransport.cs
- ReadOnlyHierarchicalDataSourceView.cs
- SafeProcessHandle.cs
- EdmItemCollection.cs
- SmtpDigestAuthenticationModule.cs
- DBCommand.cs
- XmlNodeComparer.cs
- TemplateBindingExpression.cs
- AddInDeploymentState.cs
- FileSecurity.cs
- WebPartConnectVerb.cs
- DataRelationPropertyDescriptor.cs
- PaperSize.cs
- EndpointIdentityExtension.cs
- Viewport3DVisual.cs
- CommonProperties.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- ZipIOExtraFieldElement.cs
- AtomMaterializer.cs
- OleCmdHelper.cs
- AddressHeaderCollectionElement.cs
- Resources.Designer.cs
- Drawing.cs
- TextElement.cs
- AutomationAttributeInfo.cs
- WriteFileContext.cs
- DbParameterHelper.cs
- RectValueSerializer.cs
- RadioButton.cs
- COM2IProvidePropertyBuilderHandler.cs
- MetabaseServerConfig.cs
- ConsoleEntryPoint.cs
- SafeHandle.cs
- NumberAction.cs
- MissingMemberException.cs
- TriState.cs
- EntityDataSourceWrapperPropertyDescriptor.cs
- GridViewRowCollection.cs
- AllMembershipCondition.cs
- GridViewPageEventArgs.cs
- FileDialog.cs
- ResourcesBuildProvider.cs
- HtmlGenericControl.cs
- PerformanceCountersElement.cs
- DataGridViewAutoSizeModeEventArgs.cs
- DocumentPage.cs
- CachedBitmap.cs
- HtmlInputControl.cs
- DirectoryObjectSecurity.cs
- XslTransform.cs
- ReachNamespaceInfo.cs
- assertwrapper.cs
- ParameterCollection.cs
- PartBasedPackageProperties.cs
- MimeBasePart.cs
- SessionStateModule.cs
- Process.cs
- InternalMappingException.cs
- ConfigurationPermission.cs
- DesignTimeValidationFeature.cs
- DbModificationClause.cs
- CheckBoxField.cs
- ZipIOExtraFieldZip64Element.cs
- EntityViewGenerator.cs
- ProcessModelInfo.cs
- PropertyInformation.cs