Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CommonUI / System / Drawing / Point.cs / 1305376 / Point.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.Drawing.Internal; using System.Diagnostics.CodeAnalysis; using System.Globalization; ////// /// Represents an ordered pair of x and y coordinates that /// define a point in a two-dimensional plane. /// [ TypeConverterAttribute(typeof(PointConverter)), ] [Serializable] [System.Runtime.InteropServices.ComVisible(true)] [SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates")] public struct Point { ////// /// Creates a new instance of the public static readonly Point Empty = new Point(); private int x; private int y; ///class /// with member data left uninitialized. /// /// /// Initializes a new instance of the public Point(int x, int y) { this.x = x; this.y = y; } ///class /// with the specified coordinates. /// /// /// public Point(Size sz) { this.x = sz.Width; this.y = sz.Height; } ////// Initializes a new instance of the ///class /// from a . /// /// /// Initializes a new instance of the Point class using /// coordinates specified by an integer value. /// public Point(int dw) { this.x = (short)LOWORD(dw); this.y = (short)HIWORD(dw); } ////// /// [Browsable(false)] public bool IsEmpty { get { return x == 0 && y == 0; } } ////// Gets a value indicating whether this ///is empty. /// /// /// Gets the x-coordinate of this public int X { get { return x; } set { x = value; } } ///. /// /// /// public int Y { get { return y; } set { y = value; } } ////// Gets the y-coordinate of this ///. /// /// /// public static implicit operator PointF(Point p) { return new PointF(p.X, p.Y); } ////// Creates a ///with the coordinates of the specified /// /// . /// /// /// public static explicit operator Size(Point p) { return new Size(p.X, p.Y); } ////// Creates a ///with the coordinates of the specified . /// /// /// public static Point operator +(Point pt, Size sz) { return Add(pt, sz); } ////// Translates a ///by a given . /// /// /// public static Point operator -(Point pt, Size sz) { return Subtract(pt, sz); } ////// Translates a ///by the negative of a given . /// /// /// public static bool operator ==(Point left, Point right) { return left.X == right.X && left.Y == right.Y; } ////// Compares two ///objects. The result specifies /// whether the values of the and properties of the two /// objects are equal. /// /// /// [System.Runtime.TargetedPatchingOptOutAttribute("Performance critical to inline across NGen image boundaries")] public static bool operator !=(Point left, Point right) { return !(left == right); } ////// Compares two ///objects. The result specifies whether the values /// of the or properties of the two /// /// objects are unequal. /// /// public static Point Add(Point pt, Size sz) { return new Point(pt.X + sz.Width, pt.Y + sz.Height); } ////// Translates a ///by a given . /// /// public static Point Subtract(Point pt, Size sz) { return new Point(pt.X - sz.Width, pt.Y - sz.Height); } ////// Translates a ///by the negative of a given . /// /// /// Converts a PointF to a Point by performing a ceiling operation on /// all the coordinates. /// public static Point Ceiling(PointF value) { return new Point((int)Math.Ceiling(value.X), (int)Math.Ceiling(value.Y)); } ////// /// Converts a PointF to a Point by performing a truncate operation on /// all the coordinates. /// public static Point Truncate(PointF value) { return new Point((int)value.X, (int)value.Y); } ////// /// Converts a PointF to a Point by performing a round operation on /// all the coordinates. /// public static Point Round(PointF value) { return new Point((int)Math.Round(value.X), (int)Math.Round(value.Y)); } ////// /// public override bool Equals(object obj) { if (!(obj is Point)) return false; Point comp = (Point)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.X == this.X && comp.Y == this.Y; } ////// Specifies whether this ///contains /// the same coordinates as the specified . /// /// /// public override int GetHashCode() { return x ^ y; } /** * Offset the current Point object by the given amount */ ////// Returns a hash code. /// ////// /// Translates this [System.Runtime.TargetedPatchingOptOutAttribute("Performance critical to inline across NGen image boundaries")] public void Offset(int dx, int dy) { X += dx; Y += dy; } ///by the specified amount. /// /// /// Translates this public void Offset(Point p) { Offset(p.X, p.Y); } ///by the specified amount. /// /// /// public override string ToString() { return "{X=" + X.ToString(CultureInfo.CurrentCulture) + ",Y=" + Y.ToString(CultureInfo.CurrentCulture) + "}"; } private static int HIWORD(int n) { return(n >> 16) & 0xffff; } private static int LOWORD(int n) { return n & 0xffff; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ ///// Converts this ////// to a human readable /// string. /// // 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.Drawing.Internal; using System.Diagnostics.CodeAnalysis; using System.Globalization; ////// /// Represents an ordered pair of x and y coordinates that /// define a point in a two-dimensional plane. /// [ TypeConverterAttribute(typeof(PointConverter)), ] [Serializable] [System.Runtime.InteropServices.ComVisible(true)] [SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates")] public struct Point { ////// /// Creates a new instance of the public static readonly Point Empty = new Point(); private int x; private int y; ///class /// with member data left uninitialized. /// /// /// Initializes a new instance of the public Point(int x, int y) { this.x = x; this.y = y; } ///class /// with the specified coordinates. /// /// /// public Point(Size sz) { this.x = sz.Width; this.y = sz.Height; } ////// Initializes a new instance of the ///class /// from a . /// /// /// Initializes a new instance of the Point class using /// coordinates specified by an integer value. /// public Point(int dw) { this.x = (short)LOWORD(dw); this.y = (short)HIWORD(dw); } ////// /// [Browsable(false)] public bool IsEmpty { get { return x == 0 && y == 0; } } ////// Gets a value indicating whether this ///is empty. /// /// /// Gets the x-coordinate of this public int X { get { return x; } set { x = value; } } ///. /// /// /// public int Y { get { return y; } set { y = value; } } ////// Gets the y-coordinate of this ///. /// /// /// public static implicit operator PointF(Point p) { return new PointF(p.X, p.Y); } ////// Creates a ///with the coordinates of the specified /// /// . /// /// /// public static explicit operator Size(Point p) { return new Size(p.X, p.Y); } ////// Creates a ///with the coordinates of the specified . /// /// /// public static Point operator +(Point pt, Size sz) { return Add(pt, sz); } ////// Translates a ///by a given . /// /// /// public static Point operator -(Point pt, Size sz) { return Subtract(pt, sz); } ////// Translates a ///by the negative of a given . /// /// /// public static bool operator ==(Point left, Point right) { return left.X == right.X && left.Y == right.Y; } ////// Compares two ///objects. The result specifies /// whether the values of the and properties of the two /// objects are equal. /// /// /// [System.Runtime.TargetedPatchingOptOutAttribute("Performance critical to inline across NGen image boundaries")] public static bool operator !=(Point left, Point right) { return !(left == right); } ////// Compares two ///objects. The result specifies whether the values /// of the or properties of the two /// /// objects are unequal. /// /// public static Point Add(Point pt, Size sz) { return new Point(pt.X + sz.Width, pt.Y + sz.Height); } ////// Translates a ///by a given . /// /// public static Point Subtract(Point pt, Size sz) { return new Point(pt.X - sz.Width, pt.Y - sz.Height); } ////// Translates a ///by the negative of a given . /// /// /// Converts a PointF to a Point by performing a ceiling operation on /// all the coordinates. /// public static Point Ceiling(PointF value) { return new Point((int)Math.Ceiling(value.X), (int)Math.Ceiling(value.Y)); } ////// /// Converts a PointF to a Point by performing a truncate operation on /// all the coordinates. /// public static Point Truncate(PointF value) { return new Point((int)value.X, (int)value.Y); } ////// /// Converts a PointF to a Point by performing a round operation on /// all the coordinates. /// public static Point Round(PointF value) { return new Point((int)Math.Round(value.X), (int)Math.Round(value.Y)); } ////// /// public override bool Equals(object obj) { if (!(obj is Point)) return false; Point comp = (Point)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.X == this.X && comp.Y == this.Y; } ////// Specifies whether this ///contains /// the same coordinates as the specified . /// /// /// public override int GetHashCode() { return x ^ y; } /** * Offset the current Point object by the given amount */ ////// Returns a hash code. /// ////// /// Translates this [System.Runtime.TargetedPatchingOptOutAttribute("Performance critical to inline across NGen image boundaries")] public void Offset(int dx, int dy) { X += dx; Y += dy; } ///by the specified amount. /// /// /// Translates this public void Offset(Point p) { Offset(p.X, p.Y); } ///by the specified amount. /// /// /// public override string ToString() { return "{X=" + X.ToString(CultureInfo.CurrentCulture) + ",Y=" + Y.ToString(CultureInfo.CurrentCulture) + "}"; } private static int HIWORD(int n) { return(n >> 16) & 0xffff; } private static int LOWORD(int n) { return n & 0xffff; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007./// Converts this ////// to a human readable /// string. ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Axis.cs
- XmlSchemaValidator.cs
- FacetDescription.cs
- DynamicMetaObject.cs
- AppDomainManager.cs
- ConvertTextFrag.cs
- HttpResponseInternalWrapper.cs
- UserControl.cs
- ListViewGroupItemCollection.cs
- SelectedGridItemChangedEvent.cs
- ConfigurationSectionGroupCollection.cs
- AssemblyResourceLoader.cs
- PrefixQName.cs
- ComAwareEventInfo.cs
- QilSortKey.cs
- SiteMapSection.cs
- AccessText.cs
- Resources.Designer.cs
- HighContrastHelper.cs
- PrimitiveType.cs
- HTTP_SERVICE_CONFIG_URLACL_PARAM.cs
- WorkflowOperationInvoker.cs
- ContextMarshalException.cs
- PageRequestManager.cs
- SamlEvidence.cs
- ThemeDictionaryExtension.cs
- SqlFormatter.cs
- PointConverter.cs
- SurrogateDataContract.cs
- ReadOnlyNameValueCollection.cs
- RuleSettings.cs
- WindowsFormsHost.cs
- EmbeddedMailObject.cs
- DataSourceControlBuilder.cs
- Evaluator.cs
- TextServicesCompartmentEventSink.cs
- TabRenderer.cs
- ExpressionLexer.cs
- DefaultProxySection.cs
- SystemDiagnosticsSection.cs
- VariableAction.cs
- SQLInt64Storage.cs
- DragDrop.cs
- MonthCalendarDesigner.cs
- DocumentXPathNavigator.cs
- CharacterMetrics.cs
- Int16Storage.cs
- RequestSecurityTokenResponseCollection.cs
- SchemaElementLookUpTable.cs
- SqlAliasesReferenced.cs
- QuadraticBezierSegment.cs
- FormViewUpdatedEventArgs.cs
- Pair.cs
- PasswordTextNavigator.cs
- XmlSchemaAttributeGroupRef.cs
- SoapSchemaImporter.cs
- NativeMethodsCLR.cs
- AnonymousIdentificationModule.cs
- WorkflowViewStateService.cs
- SplineKeyFrames.cs
- HeaderCollection.cs
- Blend.cs
- RemoteWebConfigurationHostServer.cs
- RemoteCryptoTokenProvider.cs
- RoleManagerEventArgs.cs
- OdbcConnectionOpen.cs
- MessageQueueTransaction.cs
- DocumentStatusResources.cs
- XsltConvert.cs
- CompositeControlDesigner.cs
- DataGridViewCellPaintingEventArgs.cs
- SizeKeyFrameCollection.cs
- ScriptReferenceEventArgs.cs
- _LoggingObject.cs
- AnimatedTypeHelpers.cs
- ListViewItem.cs
- CopyOfAction.cs
- AnonymousIdentificationSection.cs
- ServerValidateEventArgs.cs
- HMACSHA384.cs
- ProgressBarRenderer.cs
- PrintDialogException.cs
- LoginUtil.cs
- BinaryCommonClasses.cs
- Hash.cs
- CallContext.cs
- Zone.cs
- PasswordPropertyTextAttribute.cs
- WindowsListViewSubItem.cs
- XamlVector3DCollectionSerializer.cs
- SplashScreenNativeMethods.cs
- SecurityPolicySection.cs
- ReaderWriterLock.cs
- OdbcFactory.cs
- TransformerTypeCollection.cs
- RsaSecurityTokenAuthenticator.cs
- SymDocumentType.cs
- streamingZipPartStream.cs
- TextServicesPropertyRanges.cs
- Model3D.cs