Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / CommonUI / System / Drawing / Advanced / SizeF.cs / 1 / SizeF.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Drawing { using System.Diagnostics; using System; using System.IO; using Microsoft.Win32; using System.ComponentModel; using System.Diagnostics.CodeAnalysis; using System.Globalization; /** * Represents a dimension in 2D coordinate space */ ////// /// [Serializable] [System.Runtime.InteropServices.ComVisible(true)] [TypeConverter(typeof(SizeFConverter))] [SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates")] public struct SizeF { ////// Represents the size of a rectangular region /// with an ordered pair of width and height. /// ////// /// Initializes a new instance of the public static readonly SizeF Empty = new SizeF(); private float width; private float height; /** * Create a new SizeF object from another size object */ ///class. /// /// /// Initializes a new instance of the public SizeF(SizeF size) { width = size.width; height = size.height; } /** * Create a new SizeF object from a point */ ///class /// from the specified existing . /// /// /// public SizeF(PointF pt) { width = pt.X; height = pt.Y; } /** * Create a new SizeF object of the specified dimension */ ////// Initializes a new instance of the ///class from /// the specified . /// /// /// public SizeF(float width, float height) { this.width = width; this.height = height; } ////// Initializes a new instance of the ///class from /// the specified dimensions. /// /// /// public static SizeF operator +(SizeF sz1, SizeF sz2) { return Add(sz1, sz2); } ////// Performs vector addition of two ///objects. /// /// /// public static SizeF operator -(SizeF sz1, SizeF sz2) { return Subtract(sz1, sz2); } ////// Contracts a ///by another /// . /// /// /// Tests whether two public static bool operator ==(SizeF sz1, SizeF sz2) { return sz1.Width == sz2.Width && sz1.Height == sz2.Height; } ///objects /// are identical. /// /// /// public static bool operator !=(SizeF sz1, SizeF sz2) { return !(sz1 == sz2); } ////// Tests whether two ///objects are different. /// /// /// public static explicit operator PointF(SizeF size) { return new PointF(size.Width, size.Height); } ////// Converts the specified ///to a /// . /// /// /// [Browsable(false)] public bool IsEmpty { get { return width == 0 && height == 0; } } /** * Horizontal dimension */ ////// Tests whether this ///has zero /// width and height. /// /// /// public float Width { get { return width; } set { width = value; } } /** * Vertical dimension */ ////// Represents the horizontal component of this /// ///. /// /// /// public float Height { get { return height; } set { height = value; } } ////// Represents the vertical component of this /// ///. /// /// public static SizeF Add(SizeF sz1, SizeF sz2) { return new SizeF(sz1.Width + sz2.Width, sz1.Height + sz2.Height); } ////// Performs vector addition of two ///objects. /// /// /// public static SizeF Subtract(SizeF sz1, SizeF sz2) { return new SizeF(sz1.Width - sz2.Width, sz1.Height - sz2.Height); } ////// Contracts a ///by another /// . /// /// /// public override bool Equals(object obj) { if (!(obj is SizeF)) return false; SizeF comp = (SizeF)obj; return(comp.Width == this.Width) && (comp.Height == this.Height) && (comp.GetType().Equals(GetType())); } ////// Tests to see whether the specified object is a /// ////// with the same dimensions as this . /// /// /// public override int GetHashCode() { return base.GetHashCode(); } ///[To be supplied.] ////// /// public PointF ToPointF() { return (PointF) this; } ///[To be supplied.] ////// /// public Size ToSize() { return Size.Truncate(this); } ///[To be supplied.] ////// /// public override string ToString() { return "{Width=" + width.ToString(CultureInfo.CurrentCulture) + ", Height=" + height.ToString(CultureInfo.CurrentCulture) + "}"; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ ///// Creates a human-readable string that represents this /// ///. /// // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Drawing { using System.Diagnostics; using System; using System.IO; using Microsoft.Win32; using System.ComponentModel; using System.Diagnostics.CodeAnalysis; using System.Globalization; /** * Represents a dimension in 2D coordinate space */ ////// /// [Serializable] [System.Runtime.InteropServices.ComVisible(true)] [TypeConverter(typeof(SizeFConverter))] [SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates")] public struct SizeF { ////// Represents the size of a rectangular region /// with an ordered pair of width and height. /// ////// /// Initializes a new instance of the public static readonly SizeF Empty = new SizeF(); private float width; private float height; /** * Create a new SizeF object from another size object */ ///class. /// /// /// Initializes a new instance of the public SizeF(SizeF size) { width = size.width; height = size.height; } /** * Create a new SizeF object from a point */ ///class /// from the specified existing . /// /// /// public SizeF(PointF pt) { width = pt.X; height = pt.Y; } /** * Create a new SizeF object of the specified dimension */ ////// Initializes a new instance of the ///class from /// the specified . /// /// /// public SizeF(float width, float height) { this.width = width; this.height = height; } ////// Initializes a new instance of the ///class from /// the specified dimensions. /// /// /// public static SizeF operator +(SizeF sz1, SizeF sz2) { return Add(sz1, sz2); } ////// Performs vector addition of two ///objects. /// /// /// public static SizeF operator -(SizeF sz1, SizeF sz2) { return Subtract(sz1, sz2); } ////// Contracts a ///by another /// . /// /// /// Tests whether two public static bool operator ==(SizeF sz1, SizeF sz2) { return sz1.Width == sz2.Width && sz1.Height == sz2.Height; } ///objects /// are identical. /// /// /// public static bool operator !=(SizeF sz1, SizeF sz2) { return !(sz1 == sz2); } ////// Tests whether two ///objects are different. /// /// /// public static explicit operator PointF(SizeF size) { return new PointF(size.Width, size.Height); } ////// Converts the specified ///to a /// . /// /// /// [Browsable(false)] public bool IsEmpty { get { return width == 0 && height == 0; } } /** * Horizontal dimension */ ////// Tests whether this ///has zero /// width and height. /// /// /// public float Width { get { return width; } set { width = value; } } /** * Vertical dimension */ ////// Represents the horizontal component of this /// ///. /// /// /// public float Height { get { return height; } set { height = value; } } ////// Represents the vertical component of this /// ///. /// /// public static SizeF Add(SizeF sz1, SizeF sz2) { return new SizeF(sz1.Width + sz2.Width, sz1.Height + sz2.Height); } ////// Performs vector addition of two ///objects. /// /// /// public static SizeF Subtract(SizeF sz1, SizeF sz2) { return new SizeF(sz1.Width - sz2.Width, sz1.Height - sz2.Height); } ////// Contracts a ///by another /// . /// /// /// public override bool Equals(object obj) { if (!(obj is SizeF)) return false; SizeF comp = (SizeF)obj; return(comp.Width == this.Width) && (comp.Height == this.Height) && (comp.GetType().Equals(GetType())); } ////// Tests to see whether the specified object is a /// ////// with the same dimensions as this . /// /// /// public override int GetHashCode() { return base.GetHashCode(); } ///[To be supplied.] ////// /// public PointF ToPointF() { return (PointF) this; } ///[To be supplied.] ////// /// public Size ToSize() { return Size.Truncate(this); } ///[To be supplied.] ////// /// public override string ToString() { return "{Width=" + width.ToString(CultureInfo.CurrentCulture) + ", Height=" + height.ToString(CultureInfo.CurrentCulture) + "}"; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007./// Creates a human-readable string that represents this /// ///. ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DataGridViewCheckBoxCell.cs
- StyleSheetDesigner.cs
- RegexCharClass.cs
- versioninfo.cs
- DataSourceCacheDurationConverter.cs
- EncoderParameter.cs
- ParseChildrenAsPropertiesAttribute.cs
- MultipleViewPatternIdentifiers.cs
- Color.cs
- CompModSwitches.cs
- ButtonChrome.cs
- ControlType.cs
- ClockController.cs
- TabPanel.cs
- XPathConvert.cs
- LinqTreeNodeEvaluator.cs
- CssTextWriter.cs
- ProviderException.cs
- GroupStyle.cs
- ThrowHelper.cs
- OleDbError.cs
- entityreference_tresulttype.cs
- HtmlControlAdapter.cs
- Base64Encoding.cs
- SqlLiftIndependentRowExpressions.cs
- DataGridViewRowErrorTextNeededEventArgs.cs
- SqlDataReaderSmi.cs
- ComplexObject.cs
- RuntimeCompatibilityAttribute.cs
- ReaderWriterLock.cs
- RegexRunnerFactory.cs
- WebPartCatalogCloseVerb.cs
- XamlPointCollectionSerializer.cs
- HtmlShimManager.cs
- DynamicDataResources.Designer.cs
- CustomServiceCredentials.cs
- ManualResetEvent.cs
- PointKeyFrameCollection.cs
- TypeLibConverter.cs
- ArithmeticLiteral.cs
- DataGridPageChangedEventArgs.cs
- DataGridViewTopLeftHeaderCell.cs
- DbQueryCommandTree.cs
- DocumentPageTextView.cs
- ErrorFormatterPage.cs
- CheckableControlBaseAdapter.cs
- CryptoProvider.cs
- XmlDocumentFragment.cs
- BypassElementCollection.cs
- ToolboxItem.cs
- CacheMemory.cs
- PolicyStatement.cs
- RemotingConfiguration.cs
- WebPartVerbCollection.cs
- EntityTypeEmitter.cs
- UrlPropertyAttribute.cs
- Helper.cs
- AbstractDataSvcMapFileLoader.cs
- TextDecorationCollection.cs
- MetadataUtilsSmi.cs
- XmlSchemaSimpleTypeRestriction.cs
- CompiledQueryCacheEntry.cs
- CodeCommentStatement.cs
- LoginDesignerUtil.cs
- HttpListenerElement.cs
- XmlSchemas.cs
- CodeArgumentReferenceExpression.cs
- SmiEventStream.cs
- ImplicitInputBrush.cs
- InheritanceRules.cs
- ReliabilityContractAttribute.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- SizeConverter.cs
- DodSequenceMerge.cs
- SQLInt64Storage.cs
- ResourceType.cs
- MemberRelationshipService.cs
- __Filters.cs
- OdbcStatementHandle.cs
- NameSpaceExtractor.cs
- ConfigXmlReader.cs
- SourceFileBuildProvider.cs
- TextPattern.cs
- _AutoWebProxyScriptHelper.cs
- SqlDependencyUtils.cs
- Events.cs
- NTAccount.cs
- SetterBaseCollection.cs
- TreeViewItemAutomationPeer.cs
- IISMapPath.cs
- HMACSHA512.cs
- ConcurrentStack.cs
- CollectionViewGroupInternal.cs
- TableProviderWrapper.cs
- ToolStripActionList.cs
- TextProperties.cs
- ImageListStreamer.cs
- DbTypeMap.cs
- Icon.cs
- _AutoWebProxyScriptEngine.cs