Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / CommonUI / System / Drawing / Advanced / PointF.cs / 1 / 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
- ActiveDocumentEvent.cs
- Comparer.cs
- TraceRecords.cs
- CellTreeNode.cs
- PrintPageEvent.cs
- NameValueFileSectionHandler.cs
- AttributeCollection.cs
- Calendar.cs
- CodeDOMUtility.cs
- XhtmlBasicCommandAdapter.cs
- ChildDocumentBlock.cs
- XmlTextWriter.cs
- UniformGrid.cs
- ByteStorage.cs
- AttributedMetaModel.cs
- NullableDecimalSumAggregationOperator.cs
- WindowsContainer.cs
- SchemaDeclBase.cs
- WhitespaceRule.cs
- ProjectionQueryOptionExpression.cs
- ParallelDesigner.xaml.cs
- HighlightVisual.cs
- SHA512.cs
- SynchronizedDispatch.cs
- MessageFormatterConverter.cs
- EndpointBehaviorElement.cs
- AuthenticodeSignatureInformation.cs
- DataServiceQueryOfT.cs
- TrackPointCollection.cs
- WmlCommandAdapter.cs
- ProxyRpc.cs
- PassportAuthenticationEventArgs.cs
- XsltException.cs
- TabRenderer.cs
- ToolStripSeparatorRenderEventArgs.cs
- UpdateRecord.cs
- CompositeDataBoundControl.cs
- CopyAction.cs
- WebPartHelpVerb.cs
- MultiPageTextView.cs
- DataGridViewCellCancelEventArgs.cs
- OAVariantLib.cs
- DataRowCollection.cs
- EventLogException.cs
- DefaultTextStoreTextComposition.cs
- CompiledWorkflowDefinitionContext.cs
- FilterQuery.cs
- ResourceType.cs
- InstanceLockLostException.cs
- XXXInfos.cs
- SafePEFileHandle.cs
- Perspective.cs
- GeneratedContractType.cs
- SymLanguageVendor.cs
- UnrecognizedPolicyAssertionElement.cs
- TextBox.cs
- errorpatternmatcher.cs
- AssemblyBuilder.cs
- MultipartIdentifier.cs
- CatalogPartCollection.cs
- ExpressionNormalizer.cs
- ControlCollection.cs
- DataServiceBuildProvider.cs
- FormViewPageEventArgs.cs
- sqlcontext.cs
- ToolboxItemWrapper.cs
- SrgsDocumentParser.cs
- IndexedEnumerable.cs
- DataGridViewBindingCompleteEventArgs.cs
- HttpResponse.cs
- UnescapedXmlDiagnosticData.cs
- FormsAuthenticationUserCollection.cs
- SoundPlayerAction.cs
- Types.cs
- XNodeNavigator.cs
- ProfileSettingsCollection.cs
- _Connection.cs
- DockAndAnchorLayout.cs
- cookie.cs
- FunctionImportElement.cs
- EditorAttribute.cs
- PolicyManager.cs
- ModelUIElement3D.cs
- GifBitmapEncoder.cs
- StylusSystemGestureEventArgs.cs
- DataListItem.cs
- CodeSnippetCompileUnit.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- NativeMethods.cs
- SignedXml.cs
- SqlUtil.cs
- FaultPropagationRecord.cs
- PageThemeBuildProvider.cs
- AppSettingsSection.cs
- CapacityStreamGeometryContext.cs
- PageParser.cs
- SqlServer2KCompatibilityAnnotation.cs
- RegularExpressionValidator.cs
- SiteMapNodeItemEventArgs.cs
- TextRange.cs