Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Core / CSharp / System / Windows / Media / LineSegment.cs / 1 / LineSegment.cs
//------------------------------------------------------------------------------
// Microsoft Avalon
// Copyright (c) Microsoft Corporation, 2001
//
// File: LineSegment.cs
//-----------------------------------------------------------------------------
using System;
using MS.Internal;
using MS.Internal.PresentationCore;
using System.ComponentModel;
using System.ComponentModel.Design.Serialization;
using System.Reflection;
using System.Collections;
using System.Text;
using System.Globalization;
using System.Windows.Media;
using System.Windows;
using System.Text.RegularExpressions;
using System.Windows.Media.Animation;
using System.Windows.Media.Composition;
using System.Diagnostics;
using System.Security;
using System.Security.Permissions;
using SR=MS.Internal.PresentationCore.SR;
using SRID=MS.Internal.PresentationCore.SRID;
namespace System.Windows.Media
{
///
/// LineSegment
///
public sealed partial class LineSegment : PathSegment
{
#region Constructors
///
///
///
public LineSegment()
{
}
///
///
///
public LineSegment(Point point, bool isStroked)
{
Point = point;
IsStroked = isStroked;
}
// Internal constructor supporting smooth joins between segments
internal LineSegment(Point point, bool isStroked, bool isSmoothJoin)
{
Point = point;
IsStroked = isStroked;
IsSmoothJoin = isSmoothJoin;
}
#endregion
#region AddToFigure
internal override void AddToFigure(
Matrix matrix, // The transformation matrid
PathFigure figure, // The figure to add to
ref Point current) // Out: Segment endpoint, not transformed
{
current = Point;
if (matrix.IsIdentity)
{
figure.Segments.Add(this);
}
else
{
Point pt = current;
pt *= matrix;
figure.Segments.Add(new LineSegment(pt, IsStroked, IsSmoothJoin));
}
}
#endregion
///
/// SerializeData - Serialize the contents of this Segment to the provided context.
///
internal override void SerializeData(StreamGeometryContext ctx)
{
ctx.LineTo(Point, IsStroked, IsSmoothJoin);
}
internal override bool IsCurved()
{
return false;
}
///
/// Creates a string representation of this object based on the format string
/// and IFormatProvider passed in.
/// If the provider is null, the CurrentCulture is used.
/// See the documentation for IFormattable for more information.
///
///
/// A string representation of this object.
///
internal override string ConvertToString(string format, IFormatProvider provider)
{
return "L" + ((IFormattable)Point).ToString(format, provider);
}
}
}
// 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
//
// File: LineSegment.cs
//-----------------------------------------------------------------------------
using System;
using MS.Internal;
using MS.Internal.PresentationCore;
using System.ComponentModel;
using System.ComponentModel.Design.Serialization;
using System.Reflection;
using System.Collections;
using System.Text;
using System.Globalization;
using System.Windows.Media;
using System.Windows;
using System.Text.RegularExpressions;
using System.Windows.Media.Animation;
using System.Windows.Media.Composition;
using System.Diagnostics;
using System.Security;
using System.Security.Permissions;
using SR=MS.Internal.PresentationCore.SR;
using SRID=MS.Internal.PresentationCore.SRID;
namespace System.Windows.Media
{
///
/// LineSegment
///
public sealed partial class LineSegment : PathSegment
{
#region Constructors
///
///
///
public LineSegment()
{
}
///
///
///
public LineSegment(Point point, bool isStroked)
{
Point = point;
IsStroked = isStroked;
}
// Internal constructor supporting smooth joins between segments
internal LineSegment(Point point, bool isStroked, bool isSmoothJoin)
{
Point = point;
IsStroked = isStroked;
IsSmoothJoin = isSmoothJoin;
}
#endregion
#region AddToFigure
internal override void AddToFigure(
Matrix matrix, // The transformation matrid
PathFigure figure, // The figure to add to
ref Point current) // Out: Segment endpoint, not transformed
{
current = Point;
if (matrix.IsIdentity)
{
figure.Segments.Add(this);
}
else
{
Point pt = current;
pt *= matrix;
figure.Segments.Add(new LineSegment(pt, IsStroked, IsSmoothJoin));
}
}
#endregion
///
/// SerializeData - Serialize the contents of this Segment to the provided context.
///
internal override void SerializeData(StreamGeometryContext ctx)
{
ctx.LineTo(Point, IsStroked, IsSmoothJoin);
}
internal override bool IsCurved()
{
return false;
}
///
/// Creates a string representation of this object based on the format string
/// and IFormatProvider passed in.
/// If the provider is null, the CurrentCulture is used.
/// See the documentation for IFormattable for more information.
///
///
/// A string representation of this object.
///
internal override string ConvertToString(string format, IFormatProvider provider)
{
return "L" + ((IFormattable)Point).ToString(format, provider);
}
}
}
// 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
- EventHandlersStore.cs
- PhysicalAddress.cs
- JapaneseCalendar.cs
- SecurityTokenSpecification.cs
- ToolStripOverflowButton.cs
- DesignerHost.cs
- TextFormatterHost.cs
- KnowledgeBase.cs
- ButtonFlatAdapter.cs
- Enlistment.cs
- DocumentApplicationJournalEntry.cs
- RegexCompiler.cs
- ReplyChannelBinder.cs
- PaintValueEventArgs.cs
- SqlUserDefinedAggregateAttribute.cs
- StrokeSerializer.cs
- EntityClassGenerator.cs
- SystemTcpStatistics.cs
- RowSpanVector.cs
- SettingsBindableAttribute.cs
- TextSelection.cs
- PrimitiveXmlSerializers.cs
- ImplicitInputBrush.cs
- MenuItemBinding.cs
- VoiceInfo.cs
- CommonProperties.cs
- XsltLoader.cs
- HandleExceptionArgs.cs
- CancelEventArgs.cs
- XamlSerializer.cs
- SectionVisual.cs
- BitmapEffect.cs
- ResourceType.cs
- ComponentGuaranteesAttribute.cs
- SystemWebCachingSectionGroup.cs
- ErrorFormatterPage.cs
- XPathDocumentIterator.cs
- ManualResetEvent.cs
- ReadOnlyTernaryTree.cs
- HashSetEqualityComparer.cs
- ObjectItemCollection.cs
- TextElementEditingBehaviorAttribute.cs
- Animatable.cs
- VirtualizingPanel.cs
- CellIdBoolean.cs
- PenLineCapValidation.cs
- ServicesExceptionNotHandledEventArgs.cs
- _SslStream.cs
- IdentityReference.cs
- ToolStripHighContrastRenderer.cs
- JsonEnumDataContract.cs
- propertyentry.cs
- SEHException.cs
- SolidColorBrush.cs
- AdPostCacheSubstitution.cs
- UInt64.cs
- Hashtable.cs
- ValidationResult.cs
- SchemaElement.cs
- X509CertificateChain.cs
- HostedNamedPipeTransportManager.cs
- WSHttpBinding.cs
- IList.cs
- MultipleViewProviderWrapper.cs
- WorkflowRequestContext.cs
- BamlReader.cs
- SessionStateUtil.cs
- TypedDataSetSchemaImporterExtensionFx35.cs
- DesignerActionUIStateChangeEventArgs.cs
- KnownBoxes.cs
- StatusBar.cs
- ActivityTypeDesigner.xaml.cs
- SafeCancelMibChangeNotify.cs
- HtmlFormAdapter.cs
- SchemaImporterExtension.cs
- ColumnResizeUndoUnit.cs
- BevelBitmapEffect.cs
- EllipseGeometry.cs
- DrawingCollection.cs
- BuildManager.cs
- Compiler.cs
- NullableConverter.cs
- unitconverter.cs
- MergablePropertyAttribute.cs
- LayoutUtils.cs
- ObjectViewFactory.cs
- XsltInput.cs
- OleDbParameter.cs
- LookupNode.cs
- XmlResolver.cs
- While.cs
- ContentPresenter.cs
- MimeBasePart.cs
- SpecialFolderEnumConverter.cs
- PropertyContainer.cs
- FutureFactory.cs
- PageResolution.cs
- XmlEntity.cs
- FontWeights.cs
- DesignColumnCollection.cs