Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / CommonUI / System / Drawing / Advanced / PointF.cs / 2 / PointF.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Drawing {
using System.Diagnostics;
using System.Drawing;
using System.ComponentModel;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
/**
* Represents a point in 2D coordinate space
* (float precision floating-point coordinates)
*/
///
///
/// Represents an ordered pair of x and y coordinates that
/// define a point in a two-dimensional plane.
///
[Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public struct PointF {
///
///
///
/// Creates a new instance of the class
/// with member data left uninitialized.
///
///
public static readonly PointF Empty = new PointF();
private float x;
private float y;
/**
* Create a new Point object at the given location
*/
///
///
///
/// Initializes a new instance of the class
/// with the specified coordinates.
///
///
public PointF(float x, float y) {
this.x = x;
this.y = y;
}
///
///
///
/// Gets a value indicating whether this is empty.
///
///
[Browsable(false)]
public bool IsEmpty {
get {
return x == 0f && y == 0f;
}
}
///
///
///
/// Gets the x-coordinate of this .
///
///
public float X {
get {
return x;
}
set {
x = value;
}
}
///
///
///
/// Gets the y-coordinate of this .
///
///
public float Y {
get {
return y;
}
set {
y = value;
}
}
///
///
///
/// Translates a by a given .
///
///
public static PointF operator +(PointF pt, Size sz) {
return Add(pt, sz);
}
///
///
///
/// Translates a by the negative of a given .
///
///
public static PointF operator -(PointF pt, Size sz) {
return Subtract(pt, sz);
}
///
///
/// Translates a by a given .
///
///
public static PointF operator +(PointF pt, SizeF sz) {
return Add(pt, sz);
}
///
///
/// Translates a by the negative of a given .
///
///
public static PointF operator -(PointF pt, SizeF sz) {
return Subtract(pt, sz);
}
///
///
///
/// Compares two objects. The result specifies
/// whether the values of the and properties of the two
/// objects are equal.
///
///
public static bool operator ==(PointF left, PointF right) {
return left.X == right.X && left.Y == right.Y;
}
///
///
///
/// Compares two objects. The result specifies whether the values
/// of the or properties of the two
///
/// objects are unequal.
///
///
public static bool operator !=(PointF left, PointF right) {
return !(left == right);
}
///
///
/// Translates a by a given .
///
///
public static PointF Add(PointF pt, Size sz) {
return new PointF(pt.X + sz.Width, pt.Y + sz.Height);
}
///
///
/// Translates a by the negative of a given .
///
///
public static PointF Subtract(PointF pt, Size sz) {
return new PointF(pt.X - sz.Width, pt.Y - sz.Height);
}
///
///
/// Translates a by a given .
///
///
public static PointF Add(PointF pt, SizeF sz){
return new PointF(pt.X + sz.Width, pt.Y + sz.Height);
}
///
///
/// Translates a by the negative of a given .
///
///
public static PointF Subtract(PointF pt, SizeF sz){
return new PointF(pt.X - sz.Width, pt.Y - sz.Height);
}
///
///
/// [To be supplied.]
///
public override bool Equals(object obj) {
if (!(obj is PointF)) return false;
PointF comp = (PointF)obj;
return
comp.X == this.X &&
comp.Y == this.Y &&
comp.GetType().Equals(this.GetType());
}
///
///
/// [To be supplied.]
///
public override int GetHashCode() {
return base.GetHashCode();
}
///
public override string ToString() {
return string.Format(CultureInfo.CurrentCulture, "{{X={0}, Y={1}}}", x, y);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Drawing {
using System.Diagnostics;
using System.Drawing;
using System.ComponentModel;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
/**
* Represents a point in 2D coordinate space
* (float precision floating-point coordinates)
*/
///
///
/// Represents an ordered pair of x and y coordinates that
/// define a point in a two-dimensional plane.
///
[Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public struct PointF {
///
///
///
/// Creates a new instance of the class
/// with member data left uninitialized.
///
///
public static readonly PointF Empty = new PointF();
private float x;
private float y;
/**
* Create a new Point object at the given location
*/
///
///
///
/// Initializes a new instance of the class
/// with the specified coordinates.
///
///
public PointF(float x, float y) {
this.x = x;
this.y = y;
}
///
///
///
/// Gets a value indicating whether this is empty.
///
///
[Browsable(false)]
public bool IsEmpty {
get {
return x == 0f && y == 0f;
}
}
///
///
///
/// Gets the x-coordinate of this .
///
///
public float X {
get {
return x;
}
set {
x = value;
}
}
///
///
///
/// Gets the y-coordinate of this .
///
///
public float Y {
get {
return y;
}
set {
y = value;
}
}
///
///
///
/// Translates a by a given .
///
///
public static PointF operator +(PointF pt, Size sz) {
return Add(pt, sz);
}
///
///
///
/// Translates a by the negative of a given .
///
///
public static PointF operator -(PointF pt, Size sz) {
return Subtract(pt, sz);
}
///
///
/// Translates a by a given .
///
///
public static PointF operator +(PointF pt, SizeF sz) {
return Add(pt, sz);
}
///
///
/// Translates a by the negative of a given .
///
///
public static PointF operator -(PointF pt, SizeF sz) {
return Subtract(pt, sz);
}
///
///
///
/// Compares two objects. The result specifies
/// whether the values of the and properties of the two
/// objects are equal.
///
///
public static bool operator ==(PointF left, PointF right) {
return left.X == right.X && left.Y == right.Y;
}
///
///
///
/// Compares two objects. The result specifies whether the values
/// of the or properties of the two
///
/// objects are unequal.
///
///
public static bool operator !=(PointF left, PointF right) {
return !(left == right);
}
///
///
/// Translates a by a given .
///
///
public static PointF Add(PointF pt, Size sz) {
return new PointF(pt.X + sz.Width, pt.Y + sz.Height);
}
///
///
/// Translates a by the negative of a given .
///
///
public static PointF Subtract(PointF pt, Size sz) {
return new PointF(pt.X - sz.Width, pt.Y - sz.Height);
}
///
///
/// Translates a by a given .
///
///
public static PointF Add(PointF pt, SizeF sz){
return new PointF(pt.X + sz.Width, pt.Y + sz.Height);
}
///
///
/// Translates a by the negative of a given .
///
///
public static PointF Subtract(PointF pt, SizeF sz){
return new PointF(pt.X - sz.Width, pt.Y - sz.Height);
}
///
///
/// [To be supplied.]
///
public override bool Equals(object obj) {
if (!(obj is PointF)) return false;
PointF comp = (PointF)obj;
return
comp.X == this.X &&
comp.Y == this.Y &&
comp.GetType().Equals(this.GetType());
}
///
///
/// [To be supplied.]
///
public override int GetHashCode() {
return base.GetHashCode();
}
///
public override string ToString() {
return string.Format(CultureInfo.CurrentCulture, "{{X={0}, Y={1}}}", x, y);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- IEnumerable.cs
- compensatingcollection.cs
- AdCreatedEventArgs.cs
- TableHeaderCell.cs
- XPathMessageFilterElementComparer.cs
- CqlParserHelpers.cs
- TemplateXamlParser.cs
- XmlQuerySequence.cs
- TextRenderingModeValidation.cs
- Facet.cs
- TableItemStyle.cs
- XmlAtomicValue.cs
- ReflectionPermission.cs
- BrowsableAttribute.cs
- ECDsa.cs
- LeafCellTreeNode.cs
- TemplateField.cs
- RoleManagerSection.cs
- DataGridView.cs
- ConversionContext.cs
- TextBoxAutoCompleteSourceConverter.cs
- SerialReceived.cs
- ContainerParaClient.cs
- ContextMenu.cs
- XamlGridLengthSerializer.cs
- PathGeometry.cs
- BitmapEffectCollection.cs
- DetailsViewRowCollection.cs
- SqlNode.cs
- UInt16Storage.cs
- UIntPtr.cs
- AnnotationObservableCollection.cs
- Trace.cs
- ClientSettingsSection.cs
- WebPartEditorCancelVerb.cs
- ReceiveActivityDesigner.cs
- Timeline.cs
- EntityTransaction.cs
- OptimalBreakSession.cs
- AutoSizeToolBoxItem.cs
- AppliesToBehaviorDecisionTable.cs
- HttpPostedFileBase.cs
- AssemblyNameEqualityComparer.cs
- DispatcherProcessingDisabled.cs
- LassoHelper.cs
- StrokeCollection2.cs
- Quaternion.cs
- MemberPath.cs
- DataFormat.cs
- Gdiplus.cs
- Misc.cs
- List.cs
- UInt16Converter.cs
- ExpressionParser.cs
- PointLightBase.cs
- FlagsAttribute.cs
- Select.cs
- GridItemCollection.cs
- PageSettings.cs
- StatusBarAutomationPeer.cs
- CodeGenerator.cs
- PathData.cs
- PasswordRecovery.cs
- pingexception.cs
- CheckBoxList.cs
- GlyphsSerializer.cs
- DebugView.cs
- EntitySetBase.cs
- Mouse.cs
- SuppressMergeCheckAttribute.cs
- SafeProcessHandle.cs
- FileCodeGroup.cs
- LabelLiteral.cs
- ImageButton.cs
- AlphabetConverter.cs
- HttpResponse.cs
- HostedElements.cs
- WSDualHttpBindingCollectionElement.cs
- URLAttribute.cs
- ContentOperations.cs
- HierarchicalDataBoundControl.cs
- Regex.cs
- ProfileSettingsCollection.cs
- Style.cs
- ParameterCollection.cs
- ContextMarshalException.cs
- Int64KeyFrameCollection.cs
- FontStyles.cs
- ObjectStateManager.cs
- ProxyAttribute.cs
- UserThread.cs
- DataSourceSelectArguments.cs
- ToolStripDropDownMenu.cs
- EmbeddedMailObjectsCollection.cs
- OdbcConnectionOpen.cs
- ExtensionQuery.cs
- DataSpaceManager.cs
- ExtendedPropertiesHandler.cs
- InternalBufferOverflowException.cs
- WindowsFormsSectionHandler.cs