Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Base / System / Windows / Point.cs / 1305600 / Point.cs
//------------------------------------------------------------------------------ // Microsoft Avalon // Copyright (c) Microsoft Corporation, 2001, 2002 // // File: Point.cs //----------------------------------------------------------------------------- using System; using System.ComponentModel; using System.ComponentModel.Design.Serialization; using System.Reflection; using System.Text; using System.Collections; using System.Globalization; using System.Windows; using System.Windows.Media; using System.Runtime.InteropServices; namespace System.Windows { ////// Point - Defaults to 0,0 /// public partial struct Point { #region Constructors ////// Constructor which accepts the X and Y values /// /// The value for the X coordinate of the new Point /// The value for the Y coordinate of the new Point public Point(double x, double y) { _x = x; _y = y; } #endregion Constructors #region Public Methods ////// Offset - update the location by adding offsetX to X and offsetY to Y /// /// The offset in the x dimension /// The offset in the y dimension public void Offset(double offsetX, double offsetY) { _x += offsetX; _y += offsetY; } ////// Operator Point + Vector /// ////// Point - The result of the addition /// /// The Point to be added to the Vector /// The Vectr to be added to the Point public static Point operator + (Point point, Vector vector) { return new Point(point._x + vector._x, point._y + vector._y); } ////// Add: Point + Vector /// ////// Point - The result of the addition /// /// The Point to be added to the Vector /// The Vector to be added to the Point public static Point Add(Point point, Vector vector) { return new Point(point._x + vector._x, point._y + vector._y); } ////// Operator Point - Vector /// ////// Point - The result of the subtraction /// /// The Point from which the Vector is subtracted /// The Vector which is subtracted from the Point public static Point operator - (Point point, Vector vector) { return new Point(point._x - vector._x, point._y - vector._y); } ////// Subtract: Point - Vector /// ////// Point - The result of the subtraction /// /// The Point from which the Vector is subtracted /// The Vector which is subtracted from the Point public static Point Subtract(Point point, Vector vector) { return new Point(point._x - vector._x, point._y - vector._y); } ////// Operator Point - Point /// ////// Vector - The result of the subtraction /// /// The Point from which point2 is subtracted /// The Point subtracted from point1 public static Vector operator - (Point point1, Point point2) { return new Vector(point1._x - point2._x, point1._y - point2._y); } ////// Subtract: Point - Point /// ////// Vector - The result of the subtraction /// /// The Point from which point2 is subtracted /// The Point subtracted from point1 public static Vector Subtract(Point point1, Point point2) { return new Vector(point1._x - point2._x, point1._y - point2._y); } ////// Operator Point * Matrix /// public static Point operator * (Point point, Matrix matrix) { return matrix.Transform(point); } ////// Multiply: Point * Matrix /// public static Point Multiply(Point point, Matrix matrix) { return matrix.Transform(point); } ////// Explicit conversion to Size. Note that since Size cannot contain negative values, /// the resulting size will contains the absolute values of X and Y /// ////// Size - A Size equal to this Point /// /// Point - the Point to convert to a Size public static explicit operator Size(Point point) { return new Size(Math.Abs(point._x), Math.Abs(point._y)); } ////// Explicit conversion to Vector /// ////// Vector - A Vector equal to this Point /// /// Point - the Point to convert to a Vector public static explicit operator Vector(Point point) { return new Vector(point._x, point._y); } #endregion Public Methods } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- StyleReferenceConverter.cs
- Assert.cs
- CategoryValueConverter.cs
- DurationConverter.cs
- TransformConverter.cs
- XsdDuration.cs
- TripleDESCryptoServiceProvider.cs
- ExpressionHelper.cs
- SmtpFailedRecipientException.cs
- TrailingSpaceComparer.cs
- ExpressionBuilderCollection.cs
- SerTrace.cs
- CompressEmulationStream.cs
- PartManifestEntry.cs
- Package.cs
- XmlAttributeCollection.cs
- ArrangedElement.cs
- PermissionAttributes.cs
- BorderSidesEditor.cs
- DataTableMappingCollection.cs
- NamedObject.cs
- CommonXSendMessage.cs
- ResourcesGenerator.cs
- SymmetricAlgorithm.cs
- Char.cs
- WSSecurityOneDotZeroReceiveSecurityHeader.cs
- MimeTypePropertyAttribute.cs
- UseLicense.cs
- XmlSchemaObjectCollection.cs
- BitmapScalingModeValidation.cs
- ExpressionConverter.cs
- RootNamespaceAttribute.cs
- MetadataElement.cs
- EdmPropertyAttribute.cs
- ConfigurationManagerInternalFactory.cs
- Soap.cs
- XsltException.cs
- DbBuffer.cs
- ArrayWithOffset.cs
- AsymmetricKeyExchangeFormatter.cs
- WizardForm.cs
- SqlClientPermission.cs
- EventLogTraceListener.cs
- InplaceBitmapMetadataWriter.cs
- ConstructorArgumentAttribute.cs
- PackUriHelper.cs
- ObjectDisposedException.cs
- TextEditorTyping.cs
- PhysicalAddress.cs
- QueryStringHandler.cs
- RelationshipWrapper.cs
- BrowserCapabilitiesFactoryBase.cs
- EdmToObjectNamespaceMap.cs
- XmlAttributeProperties.cs
- RegexRunnerFactory.cs
- TransformerInfo.cs
- WebBrowsableAttribute.cs
- DesignerAttribute.cs
- UnauthorizedWebPart.cs
- VirtualPathProvider.cs
- CustomErrorsSectionWrapper.cs
- FaultHandlingFilter.cs
- OrthographicCamera.cs
- DataGridPagerStyle.cs
- UIPermission.cs
- ToolStripPanel.cs
- validation.cs
- ConfigurationSection.cs
- SeekStoryboard.cs
- DefaultParameterValueAttribute.cs
- LoginView.cs
- OrderedEnumerableRowCollection.cs
- FixedDSBuilder.cs
- GeometryDrawing.cs
- EncodingNLS.cs
- DesignTimeTemplateParser.cs
- PriorityItem.cs
- GeneralTransform3DTo2D.cs
- GreenMethods.cs
- ProviderIncompatibleException.cs
- Identifier.cs
- PathFigureCollection.cs
- DataGridColumnHeader.cs
- SystemUdpStatistics.cs
- AtomicFile.cs
- TemplateKeyConverter.cs
- TCEAdapterGenerator.cs
- CustomCredentialPolicy.cs
- TraceHwndHost.cs
- XmlQueryRuntime.cs
- OraclePermissionAttribute.cs
- WindowsFormsHostAutomationPeer.cs
- panel.cs
- ColorConverter.cs
- FormsAuthenticationCredentials.cs
- DbConnectionFactory.cs
- LayoutEngine.cs
- RadioButtonFlatAdapter.cs
- WindowsBrush.cs
- EntityContainerRelationshipSetEnd.cs