Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / Framework / System / Windows / Shapes / Line.cs / 1 / Line.cs
//---------------------------------------------------------------------------- // File: Line.cs // // Description: // Implementation of Line shape element. // // History: // 05/30/02 - AdSmith - Created. // // Copyright (C) 2003 by Microsoft Corporation. All rights reserved. // //--------------------------------------------------------------------------- using System.Windows.Shapes; using System.Diagnostics; using System.Windows.Threading; using System.Windows; using System.Windows.Media; using System.ComponentModel; using MS.Internal; using System; namespace System.Windows.Shapes { ////// The line shape element /// This element (like all shapes) belongs under a Canvas, /// and will be presented by the parent canvas. /// public sealed class Line : Shape { #region Constructors ////// Instantiates a new instance of a line. /// public Line() { } #endregion Constructors #region Dynamic Properties ////// X1 property /// public static readonly DependencyProperty X1Property = DependencyProperty.Register( "X1", typeof(double), typeof(Line), new FrameworkPropertyMetadata(0d, FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender), new ValidateValueCallback(Shape.IsDoubleFinite)); ////// X1 property /// [TypeConverter(typeof(LengthConverter))] public double X1 { get { return (double)GetValue(X1Property); } set { SetValue(X1Property, value); } } ////// Y1 property /// public static readonly DependencyProperty Y1Property = DependencyProperty.Register( "Y1", typeof(double), typeof(Line), new FrameworkPropertyMetadata(0d, FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender), new ValidateValueCallback(Shape.IsDoubleFinite)); ////// Y1 property /// [TypeConverter(typeof(LengthConverter))] public double Y1 { get { return (double)GetValue(Y1Property); } set { SetValue(Y1Property, value); } } ////// X2 property /// public static readonly DependencyProperty X2Property = DependencyProperty.Register( "X2", typeof(double), typeof(Line), new FrameworkPropertyMetadata(0d, FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender), new ValidateValueCallback(Shape.IsDoubleFinite)); ////// X2 property /// [TypeConverter(typeof(LengthConverter))] public double X2 { get { return (double)GetValue(X2Property); } set { SetValue(X2Property, value); } } ////// Y2 property /// public static readonly DependencyProperty Y2Property = DependencyProperty.Register( "Y2", typeof(double), typeof(Line), new FrameworkPropertyMetadata(0d, FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender), new ValidateValueCallback(Shape.IsDoubleFinite)); ////// Y2 property /// [TypeConverter(typeof(LengthConverter))] public double Y2 { get { return (double)GetValue(Y2Property); } set { SetValue(Y2Property, value); } } #endregion Dynamic Properties #region Protected Methods and Properties ////// Get the line that defines this shape /// protected override Geometry DefiningGeometry { get { return _lineGeometry; } } #endregion #region Internal Methods internal override void CacheDefiningGeometry() { Point point1 = new Point(X1, Y1); Point point2 = new Point(X2, Y2); // Create the Line geometry _lineGeometry = new LineGeometry(point1, point2); } #endregion Internal Methods #region Private Methods and Members private LineGeometry _lineGeometry; #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //---------------------------------------------------------------------------- // File: Line.cs // // Description: // Implementation of Line shape element. // // History: // 05/30/02 - AdSmith - Created. // // Copyright (C) 2003 by Microsoft Corporation. All rights reserved. // //--------------------------------------------------------------------------- using System.Windows.Shapes; using System.Diagnostics; using System.Windows.Threading; using System.Windows; using System.Windows.Media; using System.ComponentModel; using MS.Internal; using System; namespace System.Windows.Shapes { ////// The line shape element /// This element (like all shapes) belongs under a Canvas, /// and will be presented by the parent canvas. /// public sealed class Line : Shape { #region Constructors ////// Instantiates a new instance of a line. /// public Line() { } #endregion Constructors #region Dynamic Properties ////// X1 property /// public static readonly DependencyProperty X1Property = DependencyProperty.Register( "X1", typeof(double), typeof(Line), new FrameworkPropertyMetadata(0d, FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender), new ValidateValueCallback(Shape.IsDoubleFinite)); ////// X1 property /// [TypeConverter(typeof(LengthConverter))] public double X1 { get { return (double)GetValue(X1Property); } set { SetValue(X1Property, value); } } ////// Y1 property /// public static readonly DependencyProperty Y1Property = DependencyProperty.Register( "Y1", typeof(double), typeof(Line), new FrameworkPropertyMetadata(0d, FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender), new ValidateValueCallback(Shape.IsDoubleFinite)); ////// Y1 property /// [TypeConverter(typeof(LengthConverter))] public double Y1 { get { return (double)GetValue(Y1Property); } set { SetValue(Y1Property, value); } } ////// X2 property /// public static readonly DependencyProperty X2Property = DependencyProperty.Register( "X2", typeof(double), typeof(Line), new FrameworkPropertyMetadata(0d, FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender), new ValidateValueCallback(Shape.IsDoubleFinite)); ////// X2 property /// [TypeConverter(typeof(LengthConverter))] public double X2 { get { return (double)GetValue(X2Property); } set { SetValue(X2Property, value); } } ////// Y2 property /// public static readonly DependencyProperty Y2Property = DependencyProperty.Register( "Y2", typeof(double), typeof(Line), new FrameworkPropertyMetadata(0d, FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender), new ValidateValueCallback(Shape.IsDoubleFinite)); ////// Y2 property /// [TypeConverter(typeof(LengthConverter))] public double Y2 { get { return (double)GetValue(Y2Property); } set { SetValue(Y2Property, value); } } #endregion Dynamic Properties #region Protected Methods and Properties ////// Get the line that defines this shape /// protected override Geometry DefiningGeometry { get { return _lineGeometry; } } #endregion #region Internal Methods internal override void CacheDefiningGeometry() { Point point1 = new Point(X1, Y1); Point point2 = new Point(X2, Y2); // Create the Line geometry _lineGeometry = new LineGeometry(point1, point2); } #endregion Internal Methods #region Private Methods and Members private LineGeometry _lineGeometry; #endregion } } // 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
- SiblingIterators.cs
- Statements.cs
- DrawingGroupDrawingContext.cs
- StringWriter.cs
- InfoCardRSAOAEPKeyExchangeDeformatter.cs
- UpdateCompiler.cs
- AnyReturnReader.cs
- DBNull.cs
- InkPresenter.cs
- UIPermission.cs
- ManagementNamedValueCollection.cs
- HtmlInputImage.cs
- FileLogRecordEnumerator.cs
- PropertyToken.cs
- SQLRoleProvider.cs
- PostBackOptions.cs
- EventLogPropertySelector.cs
- SubMenuStyleCollectionEditor.cs
- CodeNamespaceImportCollection.cs
- HandleValueEditor.cs
- ServiceOperation.cs
- StyleBamlTreeBuilder.cs
- SplashScreenNativeMethods.cs
- PrimitiveList.cs
- DbgUtil.cs
- XmlSchemaAppInfo.cs
- NavigationEventArgs.cs
- RuleSetBrowserDialog.cs
- ProfileSettings.cs
- EditorZone.cs
- LocalizedNameDescriptionPair.cs
- ListViewDeletedEventArgs.cs
- VariableQuery.cs
- KnownColorTable.cs
- NoneExcludedImageIndexConverter.cs
- PLINQETWProvider.cs
- SchemaImporter.cs
- SwitchLevelAttribute.cs
- CatalogPartChrome.cs
- Delegate.cs
- TextReader.cs
- SocketPermission.cs
- AbandonedMutexException.cs
- XmlSchemaSet.cs
- WsdlContractConversionContext.cs
- PropertyGeneratedEventArgs.cs
- XamlRtfConverter.cs
- BamlTreeUpdater.cs
- MultipleViewProviderWrapper.cs
- TextFindEngine.cs
- BevelBitmapEffect.cs
- ServiceBuildProvider.cs
- DataServiceHostFactory.cs
- CultureInfoConverter.cs
- DynamicDiscoSearcher.cs
- EventSinkHelperWriter.cs
- DrawingState.cs
- BrowserCapabilitiesCompiler.cs
- XmlSchemaElement.cs
- TypeResolver.cs
- TemplateBindingExtension.cs
- CodeCatchClause.cs
- CodeTypeDeclarationCollection.cs
- ListenerConnectionDemuxer.cs
- HyperLink.cs
- EditorServiceContext.cs
- TrustExchangeException.cs
- DeferredElementTreeState.cs
- Matrix3D.cs
- ListMarkerLine.cs
- WebPartEventArgs.cs
- ImportContext.cs
- EmptyEnumerator.cs
- TemplateKeyConverter.cs
- SafeRightsManagementHandle.cs
- SafeNativeMethods.cs
- ObjectFullSpanRewriter.cs
- TextDpi.cs
- FontFamilyConverter.cs
- WebPartDeleteVerb.cs
- FuncCompletionCallbackWrapper.cs
- OutputScopeManager.cs
- URLString.cs
- TransactionOptions.cs
- MessageDecoder.cs
- EntityStoreSchemaFilterEntry.cs
- Authorization.cs
- messageonlyhwndwrapper.cs
- UndirectedGraph.cs
- EncryptedReference.cs
- PenLineCapValidation.cs
- WindowsAuthenticationModule.cs
- IdentifierService.cs
- TypedTableGenerator.cs
- AssemblyUtil.cs
- CopyAction.cs
- TableItemProviderWrapper.cs
- FloaterParagraph.cs
- XmlReflectionMember.cs
- ReadContentAsBinaryHelper.cs