Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Base / System / Windows / Point.cs / 1 / 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.
//------------------------------------------------------------------------------
// 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
- TreeViewDesigner.cs
- ClickablePoint.cs
- TreeViewImageGenerator.cs
- ThemeableAttribute.cs
- RoutedEventHandlerInfo.cs
- TextEditorTyping.cs
- FileRegion.cs
- TextTreeRootTextBlock.cs
- FieldDescriptor.cs
- EllipseGeometry.cs
- mediapermission.cs
- SizeAnimationUsingKeyFrames.cs
- BitmapPalette.cs
- NTAccount.cs
- ServiceReference.cs
- Keywords.cs
- VBIdentifierDesigner.xaml.cs
- Roles.cs
- RightsManagementManager.cs
- XMLDiffLoader.cs
- ConnectionInterfaceCollection.cs
- InstallerTypeAttribute.cs
- ResponseStream.cs
- SQLInt32Storage.cs
- SelectorAutomationPeer.cs
- StringBuilder.cs
- PersonalizableTypeEntry.cs
- TextServicesCompartment.cs
- COM2IPerPropertyBrowsingHandler.cs
- MatchingStyle.cs
- UnionCodeGroup.cs
- PropertyIDSet.cs
- KeyEventArgs.cs
- StringInfo.cs
- Binding.cs
- DisplayInformation.cs
- CategoryEditor.cs
- EnvelopedPkcs7.cs
- FlowNode.cs
- Converter.cs
- MemberProjectedSlot.cs
- Point3DValueSerializer.cs
- AutomationPatternInfo.cs
- DrawingCollection.cs
- HasCopySemanticsAttribute.cs
- GrowingArray.cs
- ObjectSet.cs
- BufferModesCollection.cs
- GridViewAutomationPeer.cs
- SecurityTokenInclusionMode.cs
- InfoCardPolicy.cs
- RSAProtectedConfigurationProvider.cs
- HitTestParameters.cs
- ExpressionBinding.cs
- ProxyFragment.cs
- ColorAnimationUsingKeyFrames.cs
- VerificationAttribute.cs
- Button.cs
- ObjectDataSourceChooseTypePanel.cs
- VisualProxy.cs
- CapabilitiesPattern.cs
- ValidatorCompatibilityHelper.cs
- FormViewPagerRow.cs
- ValueHandle.cs
- RawStylusSystemGestureInputReport.cs
- GridView.cs
- TimeoutException.cs
- ScrollableControlDesigner.cs
- EventSchemaTraceListener.cs
- FontStyle.cs
- PrinterSettings.cs
- SplitContainerDesigner.cs
- DrawingGroup.cs
- unitconverter.cs
- IndexedString.cs
- KeyValueSerializer.cs
- ObjectIDGenerator.cs
- DomainLiteralReader.cs
- InheritanceContextHelper.cs
- SqlTypeSystemProvider.cs
- QilName.cs
- DataGridParentRows.cs
- NamespaceList.cs
- ViewGenResults.cs
- ProxySimple.cs
- ConfigurationStrings.cs
- GeneralTransformCollection.cs
- UTF7Encoding.cs
- DatagridviewDisplayedBandsData.cs
- CustomBindingElement.cs
- validationstate.cs
- wpf-etw.cs
- DependentList.cs
- Compiler.cs
- CustomErrorsSectionWrapper.cs
- SamlNameIdentifierClaimResource.cs
- NumberFunctions.cs
- OperationResponse.cs
- UInt64Converter.cs
- DataGridTableStyleMappingNameEditor.cs