Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CommonUI / System / Drawing / Size.cs / 1305376 / Size.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Drawing { using System.Runtime.Serialization.Formatters; 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 */ ////// /// Represents the size of a rectangular region /// with an ordered pair of width and height. /// [ TypeConverterAttribute(typeof(SizeConverter)), ] [Serializable] [System.Runtime.InteropServices.ComVisible(true)] [SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates")] public struct Size { ////// /// Initializes a new instance of the public static readonly Size Empty = new Size(); private int width; private int height; /** * Create a new Size object from a point */ ///class. /// /// /// public Size(Point pt) { width = pt.X; height = pt.Y; } /** * Create a new Size object of the specified dimension */ ////// Initializes a new instance of the ///class from /// the specified . /// /// /// Initializes a new instance of the public Size(int width, int height) { this.width = width; this.height = height; } ///class from /// the specified dimensions. /// /// /// Converts the specified public static implicit operator SizeF(Size p) { return new SizeF(p.Width, p.Height); } ///to a /// . /// /// /// public static Size operator +(Size sz1, Size sz2) { return Add(sz1, sz2); } ////// Performs vector addition of two ///objects. /// /// /// public static Size operator -(Size sz1, Size sz2) { return Subtract(sz1, sz2); } ////// Contracts a ///by another /// . /// /// /// Tests whether two public static bool operator ==(Size sz1, Size sz2) { return sz1.Width == sz2.Width && sz1.Height == sz2.Height; } ///objects /// are identical. /// /// /// [System.Runtime.TargetedPatchingOptOutAttribute("Performance critical to inline across NGen image boundaries")] public static bool operator !=(Size sz1, Size sz2) { return !(sz1 == sz2); } ////// Tests whether two ///objects are different. /// /// /// Converts the specified public static explicit operator Point(Size size) { return new Point(size.Width, size.Height); } ///to a /// . /// /// /// Tests whether this [Browsable(false)] public bool IsEmpty { [System.Runtime.TargetedPatchingOptOutAttribute("Performance critical to inline across NGen image boundaries")] get { return width == 0 && height == 0; } } /** * Horizontal dimension */ ///has zero /// width and height. /// /// /// public int Width { [System.Runtime.TargetedPatchingOptOutAttribute("Performance critical to inline across NGen image boundaries")] get { return width; } set { width = value; } } /** * Vertical dimension */ ////// Represents the horizontal component of this /// ///. /// /// /// Represents the vertical component of this /// public int Height { [System.Runtime.TargetedPatchingOptOutAttribute("Performance critical to inline across NGen image boundaries")] get { return height; } set { height = value; } } ///. /// /// public static Size Add(Size sz1, Size sz2) { return new Size(sz1.Width + sz2.Width, sz1.Height + sz2.Height); } ////// Performs vector addition of two ///objects. /// /// /// Converts a SizeF to a Size by performing a ceiling operation on /// all the coordinates. /// public static Size Ceiling(SizeF value) { return new Size((int)Math.Ceiling(value.Width), (int)Math.Ceiling(value.Height)); } ////// public static Size Subtract(Size sz1, Size sz2) { return new Size(sz1.Width - sz2.Width, sz1.Height - sz2.Height); } ////// Contracts a ///by another . /// /// /// Converts a SizeF to a Size by performing a truncate operation on /// all the coordinates. /// public static Size Truncate(SizeF value) { return new Size((int)value.Width, (int)value.Height); } ////// /// Converts a SizeF to a Size by performing a round operation on /// all the coordinates. /// public static Size Round(SizeF value) { return new Size((int)Math.Round(value.Width), (int)Math.Round(value.Height)); } ////// /// public override bool Equals(object obj) { if (!(obj is Size)) return false; Size comp = (Size)obj; // Note value types can't have derived classes, so we don't need to // check the types of the objects here. -- [....], 2/21/2001 return (comp.width == this.width) && (comp.height == this.height); } ////// Tests to see whether the specified object is a /// ////// with the same dimensions as this . /// /// /// public override int GetHashCode() { return width ^ height; } ////// Returns a hash code. /// ////// /// 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.Runtime.Serialization.Formatters; 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 */ ////// /// Represents the size of a rectangular region /// with an ordered pair of width and height. /// [ TypeConverterAttribute(typeof(SizeConverter)), ] [Serializable] [System.Runtime.InteropServices.ComVisible(true)] [SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates")] public struct Size { ////// /// Initializes a new instance of the public static readonly Size Empty = new Size(); private int width; private int height; /** * Create a new Size object from a point */ ///class. /// /// /// public Size(Point pt) { width = pt.X; height = pt.Y; } /** * Create a new Size object of the specified dimension */ ////// Initializes a new instance of the ///class from /// the specified . /// /// /// Initializes a new instance of the public Size(int width, int height) { this.width = width; this.height = height; } ///class from /// the specified dimensions. /// /// /// Converts the specified public static implicit operator SizeF(Size p) { return new SizeF(p.Width, p.Height); } ///to a /// . /// /// /// public static Size operator +(Size sz1, Size sz2) { return Add(sz1, sz2); } ////// Performs vector addition of two ///objects. /// /// /// public static Size operator -(Size sz1, Size sz2) { return Subtract(sz1, sz2); } ////// Contracts a ///by another /// . /// /// /// Tests whether two public static bool operator ==(Size sz1, Size sz2) { return sz1.Width == sz2.Width && sz1.Height == sz2.Height; } ///objects /// are identical. /// /// /// [System.Runtime.TargetedPatchingOptOutAttribute("Performance critical to inline across NGen image boundaries")] public static bool operator !=(Size sz1, Size sz2) { return !(sz1 == sz2); } ////// Tests whether two ///objects are different. /// /// /// Converts the specified public static explicit operator Point(Size size) { return new Point(size.Width, size.Height); } ///to a /// . /// /// /// Tests whether this [Browsable(false)] public bool IsEmpty { [System.Runtime.TargetedPatchingOptOutAttribute("Performance critical to inline across NGen image boundaries")] get { return width == 0 && height == 0; } } /** * Horizontal dimension */ ///has zero /// width and height. /// /// /// public int Width { [System.Runtime.TargetedPatchingOptOutAttribute("Performance critical to inline across NGen image boundaries")] get { return width; } set { width = value; } } /** * Vertical dimension */ ////// Represents the horizontal component of this /// ///. /// /// /// Represents the vertical component of this /// public int Height { [System.Runtime.TargetedPatchingOptOutAttribute("Performance critical to inline across NGen image boundaries")] get { return height; } set { height = value; } } ///. /// /// public static Size Add(Size sz1, Size sz2) { return new Size(sz1.Width + sz2.Width, sz1.Height + sz2.Height); } ////// Performs vector addition of two ///objects. /// /// /// Converts a SizeF to a Size by performing a ceiling operation on /// all the coordinates. /// public static Size Ceiling(SizeF value) { return new Size((int)Math.Ceiling(value.Width), (int)Math.Ceiling(value.Height)); } ////// public static Size Subtract(Size sz1, Size sz2) { return new Size(sz1.Width - sz2.Width, sz1.Height - sz2.Height); } ////// Contracts a ///by another . /// /// /// Converts a SizeF to a Size by performing a truncate operation on /// all the coordinates. /// public static Size Truncate(SizeF value) { return new Size((int)value.Width, (int)value.Height); } ////// /// Converts a SizeF to a Size by performing a round operation on /// all the coordinates. /// public static Size Round(SizeF value) { return new Size((int)Math.Round(value.Width), (int)Math.Round(value.Height)); } ////// /// public override bool Equals(object obj) { if (!(obj is Size)) return false; Size comp = (Size)obj; // Note value types can't have derived classes, so we don't need to // check the types of the objects here. -- [....], 2/21/2001 return (comp.width == this.width) && (comp.height == this.height); } ////// Tests to see whether the specified object is a /// ////// with the same dimensions as this . /// /// /// public override int GetHashCode() { return width ^ height; } ////// Returns a hash code. /// ////// /// 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
- TrustManager.cs
- TimeSpanConverter.cs
- documentsequencetextview.cs
- GridViewColumnHeader.cs
- TcpSocketManager.cs
- AdPostCacheSubstitution.cs
- WebPartEditorOkVerb.cs
- UITypeEditor.cs
- DataGridViewControlCollection.cs
- ImmutablePropertyDescriptorGridEntry.cs
- XmlResolver.cs
- DiscoveryExceptionDictionary.cs
- PageSetupDialog.cs
- FontInfo.cs
- WebPartDescriptionCollection.cs
- TypefaceCollection.cs
- FloaterParaClient.cs
- PrintPreviewGraphics.cs
- HttpConfigurationSystem.cs
- _OSSOCK.cs
- NetSectionGroup.cs
- TextInfo.cs
- ContentPropertyAttribute.cs
- ViewEvent.cs
- SingleStorage.cs
- CustomActivityDesigner.cs
- BamlCollectionHolder.cs
- PreservationFileReader.cs
- LocatorPart.cs
- ActivityExecutorSurrogate.cs
- ThicknessAnimationUsingKeyFrames.cs
- RSACryptoServiceProvider.cs
- LoginView.cs
- DataServiceEntityAttribute.cs
- DesignConnection.cs
- DataServiceStreamProviderWrapper.cs
- SafeArrayTypeMismatchException.cs
- DataGridrowEditEndingEventArgs.cs
- ForeignConstraint.cs
- TemplateBindingExpressionConverter.cs
- OperationAbortedException.cs
- EdmTypeAttribute.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- FrameAutomationPeer.cs
- DefinitionUpdate.cs
- ResourceContainer.cs
- Publisher.cs
- EntityTemplateFactory.cs
- EntityProviderFactory.cs
- MessageQueueException.cs
- CaseInsensitiveOrdinalStringComparer.cs
- SBCSCodePageEncoding.cs
- TypeReference.cs
- CodeCatchClause.cs
- StyleHelper.cs
- Win32.cs
- Rect3DValueSerializer.cs
- OneOfTypeConst.cs
- Renderer.cs
- TearOffProxy.cs
- XmlAttributeAttribute.cs
- GeometryModel3D.cs
- TlsnegoTokenProvider.cs
- SweepDirectionValidation.cs
- SystemIPv6InterfaceProperties.cs
- MessageQueuePermissionEntryCollection.cs
- QueryableDataSourceHelper.cs
- WebPartConnectionsConnectVerb.cs
- RequestTimeoutManager.cs
- KeySpline.cs
- HtmlLiteralTextAdapter.cs
- TreeNodeMouseHoverEvent.cs
- ForwardPositionQuery.cs
- FileDialog_Vista.cs
- DBConnectionString.cs
- DataSourceBooleanViewSchemaConverter.cs
- XmlUnspecifiedAttribute.cs
- Parser.cs
- ConnectionsZone.cs
- ListDesigner.cs
- ExecutedRoutedEventArgs.cs
- SchemaName.cs
- BitArray.cs
- EmptyStringExpandableObjectConverter.cs
- DataRow.cs
- XNodeSchemaApplier.cs
- Oid.cs
- TransformerTypeCollection.cs
- Vector3DIndependentAnimationStorage.cs
- StylusPointPropertyInfoDefaults.cs
- SelectionWordBreaker.cs
- XmlILTrace.cs
- ObjectListDataBindEventArgs.cs
- FormsAuthenticationModule.cs
- TargetInvocationException.cs
- ValidationErrorCollection.cs
- FixedPageProcessor.cs
- PropertyDescriptors.cs
- TitleStyle.cs
- OracleNumber.cs