// Code compiled into PresentationFramework.dll // Initialize known object types internal static object CreateKnownElement(KnownElements knownElement) { object o = null; switch (knownElement) { case KnownElements.AccessText: o = new System.Windows.Controls.AccessText(); break; case KnownElements.AdornedElementPlaceholder: o = new System.Windows.Controls.AdornedElementPlaceholder(); break; case KnownElements.AdornerDecorator: o = new System.Windows.Documents.AdornerDecorator(); break; case KnownElements.AmbientLight: o = new System.Windows.Media.Media3D.AmbientLight(); break; case KnownElements.Application: o = new System.Windows.Application(); break; case KnownElements.ArcSegment: o = new System.Windows.Media.ArcSegment(); break; case KnownElements.ArrayExtension: o = new System.Windows.Markup.ArrayExtension(); break; case KnownElements.AxisAngleRotation3D: o = new System.Windows.Media.Media3D.AxisAngleRotation3D(); break; case KnownElements.BeginStoryboard: o = new System.Windows.Media.Animation.BeginStoryboard(); break; case KnownElements.BevelBitmapEffect: o = new System.Windows.Media.Effects.BevelBitmapEffect(); break; case KnownElements.BezierSegment: o = new System.Windows.Media.BezierSegment(); break; case KnownElements.Binding: o = new System.Windows.Data.Binding(); break; case KnownElements.BitmapEffectCollection: o = new System.Windows.Media.Effects.BitmapEffectCollection(); break; case KnownElements.BitmapEffectGroup: o = new System.Windows.Media.Effects.BitmapEffectGroup(); break; case KnownElements.BitmapEffectInput: o = new System.Windows.Media.Effects.BitmapEffectInput(); break; case KnownElements.BitmapImage: o = new System.Windows.Media.Imaging.BitmapImage(); break; case KnownElements.BlockUIContainer: o = new System.Windows.Documents.BlockUIContainer(); break; case KnownElements.BlurBitmapEffect: o = new System.Windows.Media.Effects.BlurBitmapEffect(); break; case KnownElements.BmpBitmapEncoder: o = new System.Windows.Media.Imaging.BmpBitmapEncoder(); break; case KnownElements.Bold: o = new System.Windows.Documents.Bold(); break; case KnownElements.BoolIListConverter: o = new System.Windows.Media.Converters.BoolIListConverter(); break; case KnownElements.BooleanAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.BooleanAnimationUsingKeyFrames(); break; case KnownElements.BooleanConverter: o = new System.ComponentModel.BooleanConverter(); break; case KnownElements.BooleanKeyFrameCollection: o = new System.Windows.Media.Animation.BooleanKeyFrameCollection(); break; case KnownElements.BooleanToVisibilityConverter: o = new System.Windows.Controls.BooleanToVisibilityConverter(); break; case KnownElements.Border: o = new System.Windows.Controls.Border(); break; case KnownElements.BorderGapMaskConverter: o = new System.Windows.Controls.BorderGapMaskConverter(); break; case KnownElements.BrushConverter: o = new System.Windows.Media.BrushConverter(); break; case KnownElements.BulletDecorator: o = new System.Windows.Controls.Primitives.BulletDecorator(); break; case KnownElements.Button: o = new System.Windows.Controls.Button(); break; case KnownElements.ByteAnimation: o = new System.Windows.Media.Animation.ByteAnimation(); break; case KnownElements.ByteAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.ByteAnimationUsingKeyFrames(); break; case KnownElements.ByteConverter: o = new System.ComponentModel.ByteConverter(); break; case KnownElements.ByteKeyFrameCollection: o = new System.Windows.Media.Animation.ByteKeyFrameCollection(); break; case KnownElements.Canvas: o = new System.Windows.Controls.Canvas(); break; case KnownElements.CharAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.CharAnimationUsingKeyFrames(); break; case KnownElements.CharConverter: o = new System.ComponentModel.CharConverter(); break; case KnownElements.CharIListConverter: o = new System.Windows.Media.Converters.CharIListConverter(); break; case KnownElements.CharKeyFrameCollection: o = new System.Windows.Media.Animation.CharKeyFrameCollection(); break; case KnownElements.CheckBox: o = new System.Windows.Controls.CheckBox(); break; case KnownElements.CollectionContainer: o = new System.Windows.Data.CollectionContainer(); break; case KnownElements.CollectionViewSource: o = new System.Windows.Data.CollectionViewSource(); break; case KnownElements.Color: o = new System.Windows.Media.Color(); break; case KnownElements.ColorAnimation: o = new System.Windows.Media.Animation.ColorAnimation(); break; case KnownElements.ColorAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.ColorAnimationUsingKeyFrames(); break; case KnownElements.ColorConvertedBitmap: o = new System.Windows.Media.Imaging.ColorConvertedBitmap(); break; case KnownElements.ColorConvertedBitmapExtension: o = new System.Windows.ColorConvertedBitmapExtension(); break; case KnownElements.ColorConverter: o = new System.Windows.Media.ColorConverter(); break; case KnownElements.ColorKeyFrameCollection: o = new System.Windows.Media.Animation.ColorKeyFrameCollection(); break; case KnownElements.ColumnDefinition: o = new System.Windows.Controls.ColumnDefinition(); break; case KnownElements.CombinedGeometry: o = new System.Windows.Media.CombinedGeometry(); break; case KnownElements.ComboBox: o = new System.Windows.Controls.ComboBox(); break; case KnownElements.ComboBoxItem: o = new System.Windows.Controls.ComboBoxItem(); break; case KnownElements.CommandConverter: o = new System.Windows.Input.CommandConverter(); break; case KnownElements.ComponentResourceKey: o = new System.Windows.ComponentResourceKey(); break; case KnownElements.ComponentResourceKeyConverter: o = new System.Windows.Markup.ComponentResourceKeyConverter(); break; case KnownElements.Condition: o = new System.Windows.Condition(); break; case KnownElements.ContainerVisual: o = new System.Windows.Media.ContainerVisual(); break; case KnownElements.ContentControl: o = new System.Windows.Controls.ContentControl(); break; case KnownElements.ContentElement: o = new System.Windows.ContentElement(); break; case KnownElements.ContentPresenter: o = new System.Windows.Controls.ContentPresenter(); break; case KnownElements.ContextMenu: o = new System.Windows.Controls.ContextMenu(); break; case KnownElements.Control: o = new System.Windows.Controls.Control(); break; case KnownElements.ControlTemplate: o = new System.Windows.Controls.ControlTemplate(); break; case KnownElements.CornerRadius: o = new System.Windows.CornerRadius(); break; case KnownElements.CornerRadiusConverter: o = new System.Windows.CornerRadiusConverter(); break; case KnownElements.CroppedBitmap: o = new System.Windows.Media.Imaging.CroppedBitmap(); break; case KnownElements.CultureInfoConverter: o = new System.ComponentModel.CultureInfoConverter(); break; case KnownElements.CultureInfoIetfLanguageTagConverter: o = new System.Windows.CultureInfoIetfLanguageTagConverter(); break; case KnownElements.CursorConverter: o = new System.Windows.Input.CursorConverter(); break; case KnownElements.DashStyle: o = new System.Windows.Media.DashStyle(); break; case KnownElements.DataTemplate: o = new System.Windows.DataTemplate(); break; case KnownElements.DataTemplateKey: o = new System.Windows.DataTemplateKey(); break; case KnownElements.DataTrigger: o = new System.Windows.DataTrigger(); break; case KnownElements.DateTimeConverter: o = new System.ComponentModel.DateTimeConverter(); break; case KnownElements.DateTimeConverter2: o = new System.Windows.Markup.DateTimeConverter2(); break; case KnownElements.DecimalAnimation: o = new System.Windows.Media.Animation.DecimalAnimation(); break; case KnownElements.DecimalAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.DecimalAnimationUsingKeyFrames(); break; case KnownElements.DecimalConverter: o = new System.ComponentModel.DecimalConverter(); break; case KnownElements.DecimalKeyFrameCollection: o = new System.Windows.Media.Animation.DecimalKeyFrameCollection(); break; case KnownElements.Decorator: o = new System.Windows.Controls.Decorator(); break; case KnownElements.DependencyObject: o = new System.Windows.DependencyObject(); break; case KnownElements.DependencyPropertyConverter: o = new System.Windows.Markup.DependencyPropertyConverter(); break; case KnownElements.DialogResultConverter: o = new System.Windows.DialogResultConverter(); break; case KnownElements.DiffuseMaterial: o = new System.Windows.Media.Media3D.DiffuseMaterial(); break; case KnownElements.DirectionalLight: o = new System.Windows.Media.Media3D.DirectionalLight(); break; case KnownElements.DiscreteBooleanKeyFrame: o = new System.Windows.Media.Animation.DiscreteBooleanKeyFrame(); break; case KnownElements.DiscreteByteKeyFrame: o = new System.Windows.Media.Animation.DiscreteByteKeyFrame(); break; case KnownElements.DiscreteCharKeyFrame: o = new System.Windows.Media.Animation.DiscreteCharKeyFrame(); break; case KnownElements.DiscreteColorKeyFrame: o = new System.Windows.Media.Animation.DiscreteColorKeyFrame(); break; case KnownElements.DiscreteDecimalKeyFrame: o = new System.Windows.Media.Animation.DiscreteDecimalKeyFrame(); break; case KnownElements.DiscreteDoubleKeyFrame: o = new System.Windows.Media.Animation.DiscreteDoubleKeyFrame(); break; case KnownElements.DiscreteInt16KeyFrame: o = new System.Windows.Media.Animation.DiscreteInt16KeyFrame(); break; case KnownElements.DiscreteInt32KeyFrame: o = new System.Windows.Media.Animation.DiscreteInt32KeyFrame(); break; case KnownElements.DiscreteInt64KeyFrame: o = new System.Windows.Media.Animation.DiscreteInt64KeyFrame(); break; case KnownElements.DiscreteMatrixKeyFrame: o = new System.Windows.Media.Animation.DiscreteMatrixKeyFrame(); break; case KnownElements.DiscreteObjectKeyFrame: o = new System.Windows.Media.Animation.DiscreteObjectKeyFrame(); break; case KnownElements.DiscretePoint3DKeyFrame: o = new System.Windows.Media.Animation.DiscretePoint3DKeyFrame(); break; case KnownElements.DiscretePointKeyFrame: o = new System.Windows.Media.Animation.DiscretePointKeyFrame(); break; case KnownElements.DiscreteQuaternionKeyFrame: o = new System.Windows.Media.Animation.DiscreteQuaternionKeyFrame(); break; case KnownElements.DiscreteRectKeyFrame: o = new System.Windows.Media.Animation.DiscreteRectKeyFrame(); break; case KnownElements.DiscreteRotation3DKeyFrame: o = new System.Windows.Media.Animation.DiscreteRotation3DKeyFrame(); break; case KnownElements.DiscreteSingleKeyFrame: o = new System.Windows.Media.Animation.DiscreteSingleKeyFrame(); break; case KnownElements.DiscreteSizeKeyFrame: o = new System.Windows.Media.Animation.DiscreteSizeKeyFrame(); break; case KnownElements.DiscreteStringKeyFrame: o = new System.Windows.Media.Animation.DiscreteStringKeyFrame(); break; case KnownElements.DiscreteThicknessKeyFrame: o = new System.Windows.Media.Animation.DiscreteThicknessKeyFrame(); break; case KnownElements.DiscreteVector3DKeyFrame: o = new System.Windows.Media.Animation.DiscreteVector3DKeyFrame(); break; case KnownElements.DiscreteVectorKeyFrame: o = new System.Windows.Media.Animation.DiscreteVectorKeyFrame(); break; case KnownElements.DockPanel: o = new System.Windows.Controls.DockPanel(); break; case KnownElements.DocumentPageView: o = new System.Windows.Controls.Primitives.DocumentPageView(); break; case KnownElements.DocumentReference: o = new System.Windows.Documents.DocumentReference(); break; case KnownElements.DocumentViewer: o = new System.Windows.Controls.DocumentViewer(); break; case KnownElements.DoubleAnimation: o = new System.Windows.Media.Animation.DoubleAnimation(); break; case KnownElements.DoubleAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.DoubleAnimationUsingKeyFrames(); break; case KnownElements.DoubleAnimationUsingPath: o = new System.Windows.Media.Animation.DoubleAnimationUsingPath(); break; case KnownElements.DoubleCollection: o = new System.Windows.Media.DoubleCollection(); break; case KnownElements.DoubleCollectionConverter: o = new System.Windows.Media.DoubleCollectionConverter(); break; case KnownElements.DoubleConverter: o = new System.ComponentModel.DoubleConverter(); break; case KnownElements.DoubleIListConverter: o = new System.Windows.Media.Converters.DoubleIListConverter(); break; case KnownElements.DoubleKeyFrameCollection: o = new System.Windows.Media.Animation.DoubleKeyFrameCollection(); break; case KnownElements.DrawingBrush: o = new System.Windows.Media.DrawingBrush(); break; case KnownElements.DrawingCollection: o = new System.Windows.Media.DrawingCollection(); break; case KnownElements.DrawingGroup: o = new System.Windows.Media.DrawingGroup(); break; case KnownElements.DrawingImage: o = new System.Windows.Media.DrawingImage(); break; case KnownElements.DrawingVisual: o = new System.Windows.Media.DrawingVisual(); break; case KnownElements.DropShadowBitmapEffect: o = new System.Windows.Media.Effects.DropShadowBitmapEffect(); break; case KnownElements.Duration: o = new System.Windows.Duration(); break; case KnownElements.DurationConverter: o = new System.Windows.DurationConverter(); break; case KnownElements.DynamicResourceExtension: o = new System.Windows.DynamicResourceExtension(); break; case KnownElements.DynamicResourceExtensionConverter: o = new System.Windows.DynamicResourceExtensionConverter(); break; case KnownElements.Ellipse: o = new System.Windows.Shapes.Ellipse(); break; case KnownElements.EllipseGeometry: o = new System.Windows.Media.EllipseGeometry(); break; case KnownElements.EmbossBitmapEffect: o = new System.Windows.Media.Effects.EmbossBitmapEffect(); break; case KnownElements.EmissiveMaterial: o = new System.Windows.Media.Media3D.EmissiveMaterial(); break; case KnownElements.EventSetter: o = new System.Windows.EventSetter(); break; case KnownElements.EventTrigger: o = new System.Windows.EventTrigger(); break; case KnownElements.Expander: o = new System.Windows.Controls.Expander(); break; case KnownElements.ExpressionConverter: o = new System.Windows.ExpressionConverter(); break; case KnownElements.Figure: o = new System.Windows.Documents.Figure(); break; case KnownElements.FigureLength: o = new System.Windows.FigureLength(); break; case KnownElements.FigureLengthConverter: o = new System.Windows.FigureLengthConverter(); break; case KnownElements.FixedDocument: o = new System.Windows.Documents.FixedDocument(); break; case KnownElements.FixedDocumentSequence: o = new System.Windows.Documents.FixedDocumentSequence(); break; case KnownElements.FixedPage: o = new System.Windows.Documents.FixedPage(); break; case KnownElements.Floater: o = new System.Windows.Documents.Floater(); break; case KnownElements.FlowDocument: o = new System.Windows.Documents.FlowDocument(); break; case KnownElements.FlowDocumentPageViewer: o = new System.Windows.Controls.FlowDocumentPageViewer(); break; case KnownElements.FlowDocumentReader: o = new System.Windows.Controls.FlowDocumentReader(); break; case KnownElements.FlowDocumentScrollViewer: o = new System.Windows.Controls.FlowDocumentScrollViewer(); break; case KnownElements.FontFamily: o = new System.Windows.Media.FontFamily(); break; case KnownElements.FontFamilyConverter: o = new System.Windows.Media.FontFamilyConverter(); break; case KnownElements.FontSizeConverter: o = new System.Windows.FontSizeConverter(); break; case KnownElements.FontStretch: o = new System.Windows.FontStretch(); break; case KnownElements.FontStretchConverter: o = new System.Windows.FontStretchConverter(); break; case KnownElements.FontStyle: o = new System.Windows.FontStyle(); break; case KnownElements.FontStyleConverter: o = new System.Windows.FontStyleConverter(); break; case KnownElements.FontWeight: o = new System.Windows.FontWeight(); break; case KnownElements.FontWeightConverter: o = new System.Windows.FontWeightConverter(); break; case KnownElements.FormatConvertedBitmap: o = new System.Windows.Media.Imaging.FormatConvertedBitmap(); break; case KnownElements.Frame: o = new System.Windows.Controls.Frame(); break; case KnownElements.FrameworkContentElement: o = new System.Windows.FrameworkContentElement(); break; case KnownElements.FrameworkElement: o = new System.Windows.FrameworkElement(); break; case KnownElements.FrameworkElementFactory: o = new System.Windows.FrameworkElementFactory(); break; case KnownElements.FrameworkPropertyMetadata: o = new System.Windows.FrameworkPropertyMetadata(); break; case KnownElements.GeneralTransformCollection: o = new System.Windows.Media.GeneralTransformCollection(); break; case KnownElements.GeneralTransformGroup: o = new System.Windows.Media.GeneralTransformGroup(); break; case KnownElements.GeometryCollection: o = new System.Windows.Media.GeometryCollection(); break; case KnownElements.GeometryConverter: o = new System.Windows.Media.GeometryConverter(); break; case KnownElements.GeometryDrawing: o = new System.Windows.Media.GeometryDrawing(); break; case KnownElements.GeometryGroup: o = new System.Windows.Media.GeometryGroup(); break; case KnownElements.GeometryModel3D: o = new System.Windows.Media.Media3D.GeometryModel3D(); break; case KnownElements.GestureRecognizer: o = new System.Windows.Ink.GestureRecognizer(); break; case KnownElements.GifBitmapEncoder: o = new System.Windows.Media.Imaging.GifBitmapEncoder(); break; case KnownElements.GlyphRun: o = new System.Windows.Media.GlyphRun(); break; case KnownElements.GlyphRunDrawing: o = new System.Windows.Media.GlyphRunDrawing(); break; case KnownElements.GlyphTypeface: o = new System.Windows.Media.GlyphTypeface(); break; case KnownElements.Glyphs: o = new System.Windows.Documents.Glyphs(); break; case KnownElements.GradientStop: o = new System.Windows.Media.GradientStop(); break; case KnownElements.GradientStopCollection: o = new System.Windows.Media.GradientStopCollection(); break; case KnownElements.Grid: o = new System.Windows.Controls.Grid(); break; case KnownElements.GridLength: o = new System.Windows.GridLength(); break; case KnownElements.GridLengthConverter: o = new System.Windows.GridLengthConverter(); break; case KnownElements.GridSplitter: o = new System.Windows.Controls.GridSplitter(); break; case KnownElements.GridView: o = new System.Windows.Controls.GridView(); break; case KnownElements.GridViewColumn: o = new System.Windows.Controls.GridViewColumn(); break; case KnownElements.GridViewColumnHeader: o = new System.Windows.Controls.GridViewColumnHeader(); break; case KnownElements.GridViewHeaderRowPresenter: o = new System.Windows.Controls.GridViewHeaderRowPresenter(); break; case KnownElements.GridViewRowPresenter: o = new System.Windows.Controls.GridViewRowPresenter(); break; case KnownElements.GroupBox: o = new System.Windows.Controls.GroupBox(); break; case KnownElements.GroupItem: o = new System.Windows.Controls.GroupItem(); break; case KnownElements.GuidConverter: o = new System.ComponentModel.GuidConverter(); break; case KnownElements.GuidelineSet: o = new System.Windows.Media.GuidelineSet(); break; case KnownElements.HeaderedContentControl: o = new System.Windows.Controls.HeaderedContentControl(); break; case KnownElements.HeaderedItemsControl: o = new System.Windows.Controls.HeaderedItemsControl(); break; case KnownElements.HierarchicalDataTemplate: o = new System.Windows.HierarchicalDataTemplate(); break; case KnownElements.HostVisual: o = new System.Windows.Media.HostVisual(); break; case KnownElements.Hyperlink: o = new System.Windows.Documents.Hyperlink(); break; case KnownElements.Image: o = new System.Windows.Controls.Image(); break; case KnownElements.ImageBrush: o = new System.Windows.Media.ImageBrush(); break; case KnownElements.ImageDrawing: o = new System.Windows.Media.ImageDrawing(); break; case KnownElements.ImageSourceConverter: o = new System.Windows.Media.ImageSourceConverter(); break; case KnownElements.InkCanvas: o = new System.Windows.Controls.InkCanvas(); break; case KnownElements.InkPresenter: o = new System.Windows.Controls.InkPresenter(); break; case KnownElements.InlineUIContainer: o = new System.Windows.Documents.InlineUIContainer(); break; case KnownElements.InputScope: o = new System.Windows.Input.InputScope(); break; case KnownElements.InputScopeConverter: o = new System.Windows.Input.InputScopeConverter(); break; case KnownElements.InputScopeName: o = new System.Windows.Input.InputScopeName(); break; case KnownElements.InputScopeNameConverter: o = new System.Windows.Input.InputScopeNameConverter(); break; case KnownElements.Int16Animation: o = new System.Windows.Media.Animation.Int16Animation(); break; case KnownElements.Int16AnimationUsingKeyFrames: o = new System.Windows.Media.Animation.Int16AnimationUsingKeyFrames(); break; case KnownElements.Int16Converter: o = new System.ComponentModel.Int16Converter(); break; case KnownElements.Int16KeyFrameCollection: o = new System.Windows.Media.Animation.Int16KeyFrameCollection(); break; case KnownElements.Int32Animation: o = new System.Windows.Media.Animation.Int32Animation(); break; case KnownElements.Int32AnimationUsingKeyFrames: o = new System.Windows.Media.Animation.Int32AnimationUsingKeyFrames(); break; case KnownElements.Int32Collection: o = new System.Windows.Media.Int32Collection(); break; case KnownElements.Int32CollectionConverter: o = new System.Windows.Media.Int32CollectionConverter(); break; case KnownElements.Int32Converter: o = new System.ComponentModel.Int32Converter(); break; case KnownElements.Int32KeyFrameCollection: o = new System.Windows.Media.Animation.Int32KeyFrameCollection(); break; case KnownElements.Int32Rect: o = new System.Windows.Int32Rect(); break; case KnownElements.Int32RectConverter: o = new System.Windows.Int32RectConverter(); break; case KnownElements.Int64Animation: o = new System.Windows.Media.Animation.Int64Animation(); break; case KnownElements.Int64AnimationUsingKeyFrames: o = new System.Windows.Media.Animation.Int64AnimationUsingKeyFrames(); break; case KnownElements.Int64Converter: o = new System.ComponentModel.Int64Converter(); break; case KnownElements.Int64KeyFrameCollection: o = new System.Windows.Media.Animation.Int64KeyFrameCollection(); break; case KnownElements.Italic: o = new System.Windows.Documents.Italic(); break; case KnownElements.ItemsControl: o = new System.Windows.Controls.ItemsControl(); break; case KnownElements.ItemsPanelTemplate: o = new System.Windows.Controls.ItemsPanelTemplate(); break; case KnownElements.ItemsPresenter: o = new System.Windows.Controls.ItemsPresenter(); break; case KnownElements.JournalEntryListConverter: o = new System.Windows.Navigation.JournalEntryListConverter(); break; case KnownElements.JournalEntryUnifiedViewConverter: o = new System.Windows.Navigation.JournalEntryUnifiedViewConverter(); break; case KnownElements.JpegBitmapEncoder: o = new System.Windows.Media.Imaging.JpegBitmapEncoder(); break; case KnownElements.KeyBinding: o = new System.Windows.Input.KeyBinding(); break; case KnownElements.KeyConverter: o = new System.Windows.Input.KeyConverter(); break; case KnownElements.KeyGestureConverter: o = new System.Windows.Input.KeyGestureConverter(); break; case KnownElements.KeySpline: o = new System.Windows.Media.Animation.KeySpline(); break; case KnownElements.KeySplineConverter: o = new System.Windows.KeySplineConverter(); break; case KnownElements.KeyTime: o = new System.Windows.Media.Animation.KeyTime(); break; case KnownElements.KeyTimeConverter: o = new System.Windows.KeyTimeConverter(); break; case KnownElements.Label: o = new System.Windows.Controls.Label(); break; case KnownElements.LengthConverter: o = new System.Windows.LengthConverter(); break; case KnownElements.Line: o = new System.Windows.Shapes.Line(); break; case KnownElements.LineBreak: o = new System.Windows.Documents.LineBreak(); break; case KnownElements.LineGeometry: o = new System.Windows.Media.LineGeometry(); break; case KnownElements.LineSegment: o = new System.Windows.Media.LineSegment(); break; case KnownElements.LinearByteKeyFrame: o = new System.Windows.Media.Animation.LinearByteKeyFrame(); break; case KnownElements.LinearColorKeyFrame: o = new System.Windows.Media.Animation.LinearColorKeyFrame(); break; case KnownElements.LinearDecimalKeyFrame: o = new System.Windows.Media.Animation.LinearDecimalKeyFrame(); break; case KnownElements.LinearDoubleKeyFrame: o = new System.Windows.Media.Animation.LinearDoubleKeyFrame(); break; case KnownElements.LinearGradientBrush: o = new System.Windows.Media.LinearGradientBrush(); break; case KnownElements.LinearInt16KeyFrame: o = new System.Windows.Media.Animation.LinearInt16KeyFrame(); break; case KnownElements.LinearInt32KeyFrame: o = new System.Windows.Media.Animation.LinearInt32KeyFrame(); break; case KnownElements.LinearInt64KeyFrame: o = new System.Windows.Media.Animation.LinearInt64KeyFrame(); break; case KnownElements.LinearPoint3DKeyFrame: o = new System.Windows.Media.Animation.LinearPoint3DKeyFrame(); break; case KnownElements.LinearPointKeyFrame: o = new System.Windows.Media.Animation.LinearPointKeyFrame(); break; case KnownElements.LinearQuaternionKeyFrame: o = new System.Windows.Media.Animation.LinearQuaternionKeyFrame(); break; case KnownElements.LinearRectKeyFrame: o = new System.Windows.Media.Animation.LinearRectKeyFrame(); break; case KnownElements.LinearRotation3DKeyFrame: o = new System.Windows.Media.Animation.LinearRotation3DKeyFrame(); break; case KnownElements.LinearSingleKeyFrame: o = new System.Windows.Media.Animation.LinearSingleKeyFrame(); break; case KnownElements.LinearSizeKeyFrame: o = new System.Windows.Media.Animation.LinearSizeKeyFrame(); break; case KnownElements.LinearThicknessKeyFrame: o = new System.Windows.Media.Animation.LinearThicknessKeyFrame(); break; case KnownElements.LinearVector3DKeyFrame: o = new System.Windows.Media.Animation.LinearVector3DKeyFrame(); break; case KnownElements.LinearVectorKeyFrame: o = new System.Windows.Media.Animation.LinearVectorKeyFrame(); break; case KnownElements.List: o = new System.Windows.Documents.List(); break; case KnownElements.ListBox: o = new System.Windows.Controls.ListBox(); break; case KnownElements.ListBoxItem: o = new System.Windows.Controls.ListBoxItem(); break; case KnownElements.ListItem: o = new System.Windows.Documents.ListItem(); break; case KnownElements.ListView: o = new System.Windows.Controls.ListView(); break; case KnownElements.ListViewItem: o = new System.Windows.Controls.ListViewItem(); break; case KnownElements.MaterialCollection: o = new System.Windows.Media.Media3D.MaterialCollection(); break; case KnownElements.MaterialGroup: o = new System.Windows.Media.Media3D.MaterialGroup(); break; case KnownElements.Matrix: o = new System.Windows.Media.Matrix(); break; case KnownElements.Matrix3D: o = new System.Windows.Media.Media3D.Matrix3D(); break; case KnownElements.Matrix3DConverter: o = new System.Windows.Media.Media3D.Matrix3DConverter(); break; case KnownElements.MatrixAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.MatrixAnimationUsingKeyFrames(); break; case KnownElements.MatrixAnimationUsingPath: o = new System.Windows.Media.Animation.MatrixAnimationUsingPath(); break; case KnownElements.MatrixCamera: o = new System.Windows.Media.Media3D.MatrixCamera(); break; case KnownElements.MatrixConverter: o = new System.Windows.Media.MatrixConverter(); break; case KnownElements.MatrixKeyFrameCollection: o = new System.Windows.Media.Animation.MatrixKeyFrameCollection(); break; case KnownElements.MatrixTransform: o = new System.Windows.Media.MatrixTransform(); break; case KnownElements.MatrixTransform3D: o = new System.Windows.Media.Media3D.MatrixTransform3D(); break; case KnownElements.MediaElement: o = new System.Windows.Controls.MediaElement(); break; case KnownElements.MediaPlayer: o = new System.Windows.Media.MediaPlayer(); break; case KnownElements.MediaTimeline: o = new System.Windows.Media.MediaTimeline(); break; case KnownElements.Menu: o = new System.Windows.Controls.Menu(); break; case KnownElements.MenuItem: o = new System.Windows.Controls.MenuItem(); break; case KnownElements.MenuScrollingVisibilityConverter: o = new System.Windows.Controls.MenuScrollingVisibilityConverter(); break; case KnownElements.MeshGeometry3D: o = new System.Windows.Media.Media3D.MeshGeometry3D(); break; case KnownElements.Model3DCollection: o = new System.Windows.Media.Media3D.Model3DCollection(); break; case KnownElements.Model3DGroup: o = new System.Windows.Media.Media3D.Model3DGroup(); break; case KnownElements.ModelVisual3D: o = new System.Windows.Media.Media3D.ModelVisual3D(); break; case KnownElements.ModifierKeysConverter: o = new System.Windows.Input.ModifierKeysConverter(); break; case KnownElements.MouseActionConverter: o = new System.Windows.Input.MouseActionConverter(); break; case KnownElements.MouseBinding: o = new System.Windows.Input.MouseBinding(); break; case KnownElements.MouseGesture: o = new System.Windows.Input.MouseGesture(); break; case KnownElements.MouseGestureConverter: o = new System.Windows.Input.MouseGestureConverter(); break; case KnownElements.MultiBinding: o = new System.Windows.Data.MultiBinding(); break; case KnownElements.MultiDataTrigger: o = new System.Windows.MultiDataTrigger(); break; case KnownElements.MultiTrigger: o = new System.Windows.MultiTrigger(); break; case KnownElements.NameScope: o = new System.Windows.NameScope(); break; case KnownElements.NavigationWindow: o = new System.Windows.Navigation.NavigationWindow(); break; case KnownElements.NullExtension: o = new System.Windows.Markup.NullExtension(); break; case KnownElements.NullableBoolConverter: o = new System.Windows.NullableBoolConverter(); break; case KnownElements.NumberSubstitution: o = new System.Windows.Media.NumberSubstitution(); break; case KnownElements.Object: o = new System.Object(); break; case KnownElements.ObjectAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.ObjectAnimationUsingKeyFrames(); break; case KnownElements.ObjectDataProvider: o = new System.Windows.Data.ObjectDataProvider(); break; case KnownElements.ObjectKeyFrameCollection: o = new System.Windows.Media.Animation.ObjectKeyFrameCollection(); break; case KnownElements.OrthographicCamera: o = new System.Windows.Media.Media3D.OrthographicCamera(); break; case KnownElements.OuterGlowBitmapEffect: o = new System.Windows.Media.Effects.OuterGlowBitmapEffect(); break; case KnownElements.Page: o = new System.Windows.Controls.Page(); break; case KnownElements.PageContent: o = new System.Windows.Documents.PageContent(); break; case KnownElements.Paragraph: o = new System.Windows.Documents.Paragraph(); break; case KnownElements.ParallelTimeline: o = new System.Windows.Media.Animation.ParallelTimeline(); break; case KnownElements.ParserContext: o = new System.Windows.Markup.ParserContext(); break; case KnownElements.PasswordBox: o = new System.Windows.Controls.PasswordBox(); break; case KnownElements.Path: o = new System.Windows.Shapes.Path(); break; case KnownElements.PathFigure: o = new System.Windows.Media.PathFigure(); break; case KnownElements.PathFigureCollection: o = new System.Windows.Media.PathFigureCollection(); break; case KnownElements.PathFigureCollectionConverter: o = new System.Windows.Media.PathFigureCollectionConverter(); break; case KnownElements.PathGeometry: o = new System.Windows.Media.PathGeometry(); break; case KnownElements.PathSegmentCollection: o = new System.Windows.Media.PathSegmentCollection(); break; case KnownElements.PauseStoryboard: o = new System.Windows.Media.Animation.PauseStoryboard(); break; case KnownElements.Pen: o = new System.Windows.Media.Pen(); break; case KnownElements.PerspectiveCamera: o = new System.Windows.Media.Media3D.PerspectiveCamera(); break; case KnownElements.PixelFormat: o = new System.Windows.Media.PixelFormat(); break; case KnownElements.PixelFormatConverter: o = new System.Windows.Media.PixelFormatConverter(); break; case KnownElements.PngBitmapEncoder: o = new System.Windows.Media.Imaging.PngBitmapEncoder(); break; case KnownElements.Point: o = new System.Windows.Point(); break; case KnownElements.Point3D: o = new System.Windows.Media.Media3D.Point3D(); break; case KnownElements.Point3DAnimation: o = new System.Windows.Media.Animation.Point3DAnimation(); break; case KnownElements.Point3DAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.Point3DAnimationUsingKeyFrames(); break; case KnownElements.Point3DCollection: o = new System.Windows.Media.Media3D.Point3DCollection(); break; case KnownElements.Point3DCollectionConverter: o = new System.Windows.Media.Media3D.Point3DCollectionConverter(); break; case KnownElements.Point3DConverter: o = new System.Windows.Media.Media3D.Point3DConverter(); break; case KnownElements.Point3DKeyFrameCollection: o = new System.Windows.Media.Animation.Point3DKeyFrameCollection(); break; case KnownElements.Point4D: o = new System.Windows.Media.Media3D.Point4D(); break; case KnownElements.Point4DConverter: o = new System.Windows.Media.Media3D.Point4DConverter(); break; case KnownElements.PointAnimation: o = new System.Windows.Media.Animation.PointAnimation(); break; case KnownElements.PointAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.PointAnimationUsingKeyFrames(); break; case KnownElements.PointAnimationUsingPath: o = new System.Windows.Media.Animation.PointAnimationUsingPath(); break; case KnownElements.PointCollection: o = new System.Windows.Media.PointCollection(); break; case KnownElements.PointCollectionConverter: o = new System.Windows.Media.PointCollectionConverter(); break; case KnownElements.PointConverter: o = new System.Windows.PointConverter(); break; case KnownElements.PointIListConverter: o = new System.Windows.Media.Converters.PointIListConverter(); break; case KnownElements.PointKeyFrameCollection: o = new System.Windows.Media.Animation.PointKeyFrameCollection(); break; case KnownElements.PointLight: o = new System.Windows.Media.Media3D.PointLight(); break; case KnownElements.PolyBezierSegment: o = new System.Windows.Media.PolyBezierSegment(); break; case KnownElements.PolyLineSegment: o = new System.Windows.Media.PolyLineSegment(); break; case KnownElements.PolyQuadraticBezierSegment: o = new System.Windows.Media.PolyQuadraticBezierSegment(); break; case KnownElements.Polygon: o = new System.Windows.Shapes.Polygon(); break; case KnownElements.Polyline: o = new System.Windows.Shapes.Polyline(); break; case KnownElements.Popup: o = new System.Windows.Controls.Primitives.Popup(); break; case KnownElements.PriorityBinding: o = new System.Windows.Data.PriorityBinding(); break; case KnownElements.ProgressBar: o = new System.Windows.Controls.ProgressBar(); break; case KnownElements.PropertyPathConverter: o = new System.Windows.PropertyPathConverter(); break; case KnownElements.QuadraticBezierSegment: o = new System.Windows.Media.QuadraticBezierSegment(); break; case KnownElements.Quaternion: o = new System.Windows.Media.Media3D.Quaternion(); break; case KnownElements.QuaternionAnimation: o = new System.Windows.Media.Animation.QuaternionAnimation(); break; case KnownElements.QuaternionAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.QuaternionAnimationUsingKeyFrames(); break; case KnownElements.QuaternionConverter: o = new System.Windows.Media.Media3D.QuaternionConverter(); break; case KnownElements.QuaternionKeyFrameCollection: o = new System.Windows.Media.Animation.QuaternionKeyFrameCollection(); break; case KnownElements.QuaternionRotation3D: o = new System.Windows.Media.Media3D.QuaternionRotation3D(); break; case KnownElements.RadialGradientBrush: o = new System.Windows.Media.RadialGradientBrush(); break; case KnownElements.RadioButton: o = new System.Windows.Controls.RadioButton(); break; case KnownElements.Rect: o = new System.Windows.Rect(); break; case KnownElements.Rect3D: o = new System.Windows.Media.Media3D.Rect3D(); break; case KnownElements.Rect3DConverter: o = new System.Windows.Media.Media3D.Rect3DConverter(); break; case KnownElements.RectAnimation: o = new System.Windows.Media.Animation.RectAnimation(); break; case KnownElements.RectAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.RectAnimationUsingKeyFrames(); break; case KnownElements.RectConverter: o = new System.Windows.RectConverter(); break; case KnownElements.RectKeyFrameCollection: o = new System.Windows.Media.Animation.RectKeyFrameCollection(); break; case KnownElements.Rectangle: o = new System.Windows.Shapes.Rectangle(); break; case KnownElements.RectangleGeometry: o = new System.Windows.Media.RectangleGeometry(); break; case KnownElements.RelativeSource: o = new System.Windows.Data.RelativeSource(); break; case KnownElements.RemoveStoryboard: o = new System.Windows.Media.Animation.RemoveStoryboard(); break; case KnownElements.RepeatBehavior: o = new System.Windows.Media.Animation.RepeatBehavior(); break; case KnownElements.RepeatBehaviorConverter: o = new System.Windows.Media.Animation.RepeatBehaviorConverter(); break; case KnownElements.RepeatButton: o = new System.Windows.Controls.Primitives.RepeatButton(); break; case KnownElements.ResizeGrip: o = new System.Windows.Controls.Primitives.ResizeGrip(); break; case KnownElements.ResourceDictionary: o = new System.Windows.ResourceDictionary(); break; case KnownElements.ResumeStoryboard: o = new System.Windows.Media.Animation.ResumeStoryboard(); break; case KnownElements.RichTextBox: o = new System.Windows.Controls.RichTextBox(); break; case KnownElements.RotateTransform: o = new System.Windows.Media.RotateTransform(); break; case KnownElements.RotateTransform3D: o = new System.Windows.Media.Media3D.RotateTransform3D(); break; case KnownElements.Rotation3DAnimation: o = new System.Windows.Media.Animation.Rotation3DAnimation(); break; case KnownElements.Rotation3DAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.Rotation3DAnimationUsingKeyFrames(); break; case KnownElements.Rotation3DKeyFrameCollection: o = new System.Windows.Media.Animation.Rotation3DKeyFrameCollection(); break; case KnownElements.RoutedCommand: o = new System.Windows.Input.RoutedCommand(); break; case KnownElements.RoutedEventConverter: o = new System.Windows.Markup.RoutedEventConverter(); break; case KnownElements.RoutedUICommand: o = new System.Windows.Input.RoutedUICommand(); break; case KnownElements.RowDefinition: o = new System.Windows.Controls.RowDefinition(); break; case KnownElements.Run: o = new System.Windows.Documents.Run(); break; case KnownElements.SByteConverter: o = new System.ComponentModel.SByteConverter(); break; case KnownElements.ScaleTransform: o = new System.Windows.Media.ScaleTransform(); break; case KnownElements.ScaleTransform3D: o = new System.Windows.Media.Media3D.ScaleTransform3D(); break; case KnownElements.ScrollBar: o = new System.Windows.Controls.Primitives.ScrollBar(); break; case KnownElements.ScrollContentPresenter: o = new System.Windows.Controls.ScrollContentPresenter(); break; case KnownElements.ScrollViewer: o = new System.Windows.Controls.ScrollViewer(); break; case KnownElements.Section: o = new System.Windows.Documents.Section(); break; case KnownElements.SeekStoryboard: o = new System.Windows.Media.Animation.SeekStoryboard(); break; case KnownElements.Separator: o = new System.Windows.Controls.Separator(); break; case KnownElements.SetStoryboardSpeedRatio: o = new System.Windows.Media.Animation.SetStoryboardSpeedRatio(); break; case KnownElements.Setter: o = new System.Windows.Setter(); break; case KnownElements.SingleAnimation: o = new System.Windows.Media.Animation.SingleAnimation(); break; case KnownElements.SingleAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.SingleAnimationUsingKeyFrames(); break; case KnownElements.SingleConverter: o = new System.ComponentModel.SingleConverter(); break; case KnownElements.SingleKeyFrameCollection: o = new System.Windows.Media.Animation.SingleKeyFrameCollection(); break; case KnownElements.Size: o = new System.Windows.Size(); break; case KnownElements.Size3D: o = new System.Windows.Media.Media3D.Size3D(); break; case KnownElements.Size3DConverter: o = new System.Windows.Media.Media3D.Size3DConverter(); break; case KnownElements.SizeAnimation: o = new System.Windows.Media.Animation.SizeAnimation(); break; case KnownElements.SizeAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.SizeAnimationUsingKeyFrames(); break; case KnownElements.SizeConverter: o = new System.Windows.SizeConverter(); break; case KnownElements.SizeKeyFrameCollection: o = new System.Windows.Media.Animation.SizeKeyFrameCollection(); break; case KnownElements.SkewTransform: o = new System.Windows.Media.SkewTransform(); break; case KnownElements.SkipStoryboardToFill: o = new System.Windows.Media.Animation.SkipStoryboardToFill(); break; case KnownElements.Slider: o = new System.Windows.Controls.Slider(); break; case KnownElements.SolidColorBrush: o = new System.Windows.Media.SolidColorBrush(); break; case KnownElements.SoundPlayerAction: o = new System.Windows.Controls.SoundPlayerAction(); break; case KnownElements.Span: o = new System.Windows.Documents.Span(); break; case KnownElements.SpecularMaterial: o = new System.Windows.Media.Media3D.SpecularMaterial(); break; case KnownElements.SplineByteKeyFrame: o = new System.Windows.Media.Animation.SplineByteKeyFrame(); break; case KnownElements.SplineColorKeyFrame: o = new System.Windows.Media.Animation.SplineColorKeyFrame(); break; case KnownElements.SplineDecimalKeyFrame: o = new System.Windows.Media.Animation.SplineDecimalKeyFrame(); break; case KnownElements.SplineDoubleKeyFrame: o = new System.Windows.Media.Animation.SplineDoubleKeyFrame(); break; case KnownElements.SplineInt16KeyFrame: o = new System.Windows.Media.Animation.SplineInt16KeyFrame(); break; case KnownElements.SplineInt32KeyFrame: o = new System.Windows.Media.Animation.SplineInt32KeyFrame(); break; case KnownElements.SplineInt64KeyFrame: o = new System.Windows.Media.Animation.SplineInt64KeyFrame(); break; case KnownElements.SplinePoint3DKeyFrame: o = new System.Windows.Media.Animation.SplinePoint3DKeyFrame(); break; case KnownElements.SplinePointKeyFrame: o = new System.Windows.Media.Animation.SplinePointKeyFrame(); break; case KnownElements.SplineQuaternionKeyFrame: o = new System.Windows.Media.Animation.SplineQuaternionKeyFrame(); break; case KnownElements.SplineRectKeyFrame: o = new System.Windows.Media.Animation.SplineRectKeyFrame(); break; case KnownElements.SplineRotation3DKeyFrame: o = new System.Windows.Media.Animation.SplineRotation3DKeyFrame(); break; case KnownElements.SplineSingleKeyFrame: o = new System.Windows.Media.Animation.SplineSingleKeyFrame(); break; case KnownElements.SplineSizeKeyFrame: o = new System.Windows.Media.Animation.SplineSizeKeyFrame(); break; case KnownElements.SplineThicknessKeyFrame: o = new System.Windows.Media.Animation.SplineThicknessKeyFrame(); break; case KnownElements.SplineVector3DKeyFrame: o = new System.Windows.Media.Animation.SplineVector3DKeyFrame(); break; case KnownElements.SplineVectorKeyFrame: o = new System.Windows.Media.Animation.SplineVectorKeyFrame(); break; case KnownElements.SpotLight: o = new System.Windows.Media.Media3D.SpotLight(); break; case KnownElements.StackPanel: o = new System.Windows.Controls.StackPanel(); break; case KnownElements.StaticExtension: o = new System.Windows.Markup.StaticExtension(); break; case KnownElements.StaticResourceExtension: o = new System.Windows.StaticResourceExtension(); break; case KnownElements.StatusBar: o = new System.Windows.Controls.Primitives.StatusBar(); break; case KnownElements.StatusBarItem: o = new System.Windows.Controls.Primitives.StatusBarItem(); break; case KnownElements.StopStoryboard: o = new System.Windows.Media.Animation.StopStoryboard(); break; case KnownElements.Storyboard: o = new System.Windows.Media.Animation.Storyboard(); break; case KnownElements.StreamGeometry: o = new System.Windows.Media.StreamGeometry(); break; case KnownElements.StreamResourceInfo: o = new System.Windows.Resources.StreamResourceInfo(); break; case KnownElements.StringAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.StringAnimationUsingKeyFrames(); break; case KnownElements.StringConverter: o = new System.ComponentModel.StringConverter(); break; case KnownElements.StringKeyFrameCollection: o = new System.Windows.Media.Animation.StringKeyFrameCollection(); break; case KnownElements.StrokeCollection: o = new System.Windows.Ink.StrokeCollection(); break; case KnownElements.StrokeCollectionConverter: o = new System.Windows.StrokeCollectionConverter(); break; case KnownElements.Style: o = new System.Windows.Style(); break; case KnownElements.TabControl: o = new System.Windows.Controls.TabControl(); break; case KnownElements.TabItem: o = new System.Windows.Controls.TabItem(); break; case KnownElements.TabPanel: o = new System.Windows.Controls.Primitives.TabPanel(); break; case KnownElements.Table: o = new System.Windows.Documents.Table(); break; case KnownElements.TableCell: o = new System.Windows.Documents.TableCell(); break; case KnownElements.TableColumn: o = new System.Windows.Documents.TableColumn(); break; case KnownElements.TableRow: o = new System.Windows.Documents.TableRow(); break; case KnownElements.TableRowGroup: o = new System.Windows.Documents.TableRowGroup(); break; case KnownElements.TemplateBindingExpressionConverter: o = new System.Windows.TemplateBindingExpressionConverter(); break; case KnownElements.TemplateBindingExtension: o = new System.Windows.TemplateBindingExtension(); break; case KnownElements.TemplateBindingExtensionConverter: o = new System.Windows.TemplateBindingExtensionConverter(); break; case KnownElements.TemplateKeyConverter: o = new System.Windows.Markup.TemplateKeyConverter(); break; case KnownElements.TextBlock: o = new System.Windows.Controls.TextBlock(); break; case KnownElements.TextBox: o = new System.Windows.Controls.TextBox(); break; case KnownElements.TextDecoration: o = new System.Windows.TextDecoration(); break; case KnownElements.TextDecorationCollection: o = new System.Windows.TextDecorationCollection(); break; case KnownElements.TextDecorationCollectionConverter: o = new System.Windows.TextDecorationCollectionConverter(); break; case KnownElements.TextEffect: o = new System.Windows.Media.TextEffect(); break; case KnownElements.TextEffectCollection: o = new System.Windows.Media.TextEffectCollection(); break; case KnownElements.ThemeDictionaryExtension: o = new System.Windows.ThemeDictionaryExtension(); break; case KnownElements.Thickness: o = new System.Windows.Thickness(); break; case KnownElements.ThicknessAnimation: o = new System.Windows.Media.Animation.ThicknessAnimation(); break; case KnownElements.ThicknessAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.ThicknessAnimationUsingKeyFrames(); break; case KnownElements.ThicknessConverter: o = new System.Windows.ThicknessConverter(); break; case KnownElements.ThicknessKeyFrameCollection: o = new System.Windows.Media.Animation.ThicknessKeyFrameCollection(); break; case KnownElements.Thumb: o = new System.Windows.Controls.Primitives.Thumb(); break; case KnownElements.TickBar: o = new System.Windows.Controls.Primitives.TickBar(); break; case KnownElements.TiffBitmapEncoder: o = new System.Windows.Media.Imaging.TiffBitmapEncoder(); break; case KnownElements.TimeSpanConverter: o = new System.ComponentModel.TimeSpanConverter(); break; case KnownElements.TimelineCollection: o = new System.Windows.Media.Animation.TimelineCollection(); break; case KnownElements.ToggleButton: o = new System.Windows.Controls.Primitives.ToggleButton(); break; case KnownElements.ToolBar: o = new System.Windows.Controls.ToolBar(); break; case KnownElements.ToolBarOverflowPanel: o = new System.Windows.Controls.Primitives.ToolBarOverflowPanel(); break; case KnownElements.ToolBarPanel: o = new System.Windows.Controls.Primitives.ToolBarPanel(); break; case KnownElements.ToolBarTray: o = new System.Windows.Controls.ToolBarTray(); break; case KnownElements.ToolTip: o = new System.Windows.Controls.ToolTip(); break; case KnownElements.Track: o = new System.Windows.Controls.Primitives.Track(); break; case KnownElements.Transform3DCollection: o = new System.Windows.Media.Media3D.Transform3DCollection(); break; case KnownElements.Transform3DGroup: o = new System.Windows.Media.Media3D.Transform3DGroup(); break; case KnownElements.TransformCollection: o = new System.Windows.Media.TransformCollection(); break; case KnownElements.TransformConverter: o = new System.Windows.Media.TransformConverter(); break; case KnownElements.TransformGroup: o = new System.Windows.Media.TransformGroup(); break; case KnownElements.TransformedBitmap: o = new System.Windows.Media.Imaging.TransformedBitmap(); break; case KnownElements.TranslateTransform: o = new System.Windows.Media.TranslateTransform(); break; case KnownElements.TranslateTransform3D: o = new System.Windows.Media.Media3D.TranslateTransform3D(); break; case KnownElements.TreeView: o = new System.Windows.Controls.TreeView(); break; case KnownElements.TreeViewItem: o = new System.Windows.Controls.TreeViewItem(); break; case KnownElements.Trigger: o = new System.Windows.Trigger(); break; case KnownElements.TypeExtension: o = new System.Windows.Markup.TypeExtension(); break; case KnownElements.TypeTypeConverter: o = new System.Windows.Markup.TypeTypeConverter(); break; case KnownElements.UIElement: o = new System.Windows.UIElement(); break; case KnownElements.UInt16Converter: o = new System.ComponentModel.UInt16Converter(); break; case KnownElements.UInt32Converter: o = new System.ComponentModel.UInt32Converter(); break; case KnownElements.UInt64Converter: o = new System.ComponentModel.UInt64Converter(); break; case KnownElements.UShortIListConverter: o = new System.Windows.Media.Converters.UShortIListConverter(); break; case KnownElements.Underline: o = new System.Windows.Documents.Underline(); break; case KnownElements.UniformGrid: o = new System.Windows.Controls.Primitives.UniformGrid(); break; case KnownElements.UriTypeConverter: o = new System.UriTypeConverter(); break; case KnownElements.UserControl: o = new System.Windows.Controls.UserControl(); break; case KnownElements.Vector: o = new System.Windows.Vector(); break; case KnownElements.Vector3D: o = new System.Windows.Media.Media3D.Vector3D(); break; case KnownElements.Vector3DAnimation: o = new System.Windows.Media.Animation.Vector3DAnimation(); break; case KnownElements.Vector3DAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.Vector3DAnimationUsingKeyFrames(); break; case KnownElements.Vector3DCollection: o = new System.Windows.Media.Media3D.Vector3DCollection(); break; case KnownElements.Vector3DCollectionConverter: o = new System.Windows.Media.Media3D.Vector3DCollectionConverter(); break; case KnownElements.Vector3DConverter: o = new System.Windows.Media.Media3D.Vector3DConverter(); break; case KnownElements.Vector3DKeyFrameCollection: o = new System.Windows.Media.Animation.Vector3DKeyFrameCollection(); break; case KnownElements.VectorAnimation: o = new System.Windows.Media.Animation.VectorAnimation(); break; case KnownElements.VectorAnimationUsingKeyFrames: o = new System.Windows.Media.Animation.VectorAnimationUsingKeyFrames(); break; case KnownElements.VectorCollection: o = new System.Windows.Media.VectorCollection(); break; case KnownElements.VectorCollectionConverter: o = new System.Windows.Media.VectorCollectionConverter(); break; case KnownElements.VectorConverter: o = new System.Windows.VectorConverter(); break; case KnownElements.VectorKeyFrameCollection: o = new System.Windows.Media.Animation.VectorKeyFrameCollection(); break; case KnownElements.VideoDrawing: o = new System.Windows.Media.VideoDrawing(); break; case KnownElements.Viewbox: o = new System.Windows.Controls.Viewbox(); break; case KnownElements.Viewport3D: o = new System.Windows.Controls.Viewport3D(); break; case KnownElements.Viewport3DVisual: o = new System.Windows.Media.Media3D.Viewport3DVisual(); break; case KnownElements.VirtualizingStackPanel: o = new System.Windows.Controls.VirtualizingStackPanel(); break; case KnownElements.VisualBrush: o = new System.Windows.Media.VisualBrush(); break; case KnownElements.Window: o = new System.Windows.Window(); break; case KnownElements.WmpBitmapEncoder: o = new System.Windows.Media.Imaging.WmpBitmapEncoder(); break; case KnownElements.WrapPanel: o = new System.Windows.Controls.WrapPanel(); break; case KnownElements.XamlBrushSerializer: o = new System.Windows.Markup.XamlBrushSerializer(); break; case KnownElements.XamlInt32CollectionSerializer: o = new System.Windows.Markup.XamlInt32CollectionSerializer(); break; case KnownElements.XamlPathDataSerializer: o = new System.Windows.Markup.XamlPathDataSerializer(); break; case KnownElements.XamlPoint3DCollectionSerializer: o = new System.Windows.Markup.XamlPoint3DCollectionSerializer(); break; case KnownElements.XamlPointCollectionSerializer: o = new System.Windows.Markup.XamlPointCollectionSerializer(); break; case KnownElements.XamlStyleSerializer: o = new System.Windows.Markup.XamlStyleSerializer(); break; case KnownElements.XamlTemplateSerializer: o = new System.Windows.Markup.XamlTemplateSerializer(); break; case KnownElements.XamlVector3DCollectionSerializer: o = new System.Windows.Markup.XamlVector3DCollectionSerializer(); break; case KnownElements.XmlDataProvider: o = new System.Windows.Data.XmlDataProvider(); break; case KnownElements.XmlLanguageConverter: o = new System.Windows.Markup.XmlLanguageConverter(); break; case KnownElements.XmlNamespaceMapping: o = new System.Windows.Data.XmlNamespaceMapping(); break; case KnownElements.ZoomPercentageConverter: o = new System.Windows.Documents.ZoomPercentageConverter(); break; } return o; }
public List <PointF> AddElementsPreviewF(GridSetup grid) { List <PointF> filteredPoints = new List <PointF>(); List <UIElement> prewiElements = grid.canvas.Children.OfType <UIElement>().Where(n => n.Uid.Contains("ElementPreview")).ToList(); foreach (var item in prewiElements) { grid.canvas.Children.Remove(item); } foreach (var item in grid.gridPoints) { int counter = 0; Line check = DrawCheckline(item, wpfOutterCheckpoint, wpfOutterCheckpoint); foreach (var wall in grid.WpfWalls) { PointF intersection = tool.GetIntersection(check, wall); if (CheckIfPointBelongToLine(check, intersection)) { if (CheckIfPointBelongToLine(wall, intersection)) { counter++; } } } if (counter % 2 == 0) { continue; } Ellipse el = new Ellipse(); el.Height = 10; el.Width = 10; el.Stroke = Brushes.Tomato; el.Fill = Brushes.Aqua; el.Uid = "ElementPreview"; Canvas.SetTop(el, item.Y - el.Height / 2); Canvas.SetLeft(el, item.X - el.Width / 2); filteredPoints.Add(item); grid.canvas.Children.Add(el); } return(filteredPoints); }
private void move(List <string> args) { List <double> argd = new List <double>(); foreach (string arg in args) { double a = 0; if (!double.TryParse(arg, out a)) { throw new Exception("Not numeric arguments for a moving command"); } argd.Add(a); } if (args.Count % 2 != 0) { throw new Exception("Odd number of arguments for a move command"); } for (int i = 0; i < argd.Count; i += 2) { System.Windows.Point startPosition = currentPosition; double dx = -argd[i]; double dy = argd[i + 1]; if (isRelative) { currentPosition = new System.Windows.Point(startPosition.X + dx, startPosition.Y + dy); } else { currentPosition = new System.Windows.Point(dx, dy); } if (isDown) { System.Windows.Shapes.Line newLine = new System.Windows.Shapes.Line(); newLine.X1 = startPosition.X; newLine.Y1 = startPosition.Y; newLine.X2 = currentPosition.X; newLine.Y2 = currentPosition.Y; if (Math.Abs(newLine.X2 - newLine.X1) > 0 || Math.Abs(newLine.Y2 - newLine.Y1) > 0) { visitedLines[currentPen].Add(newLine); } } } }
public override void Draw() { if (Instance == null || !(Instance is System.Windows.Shapes.Line)) { Instance = new System.Windows.Shapes.Line(); } var line = Instance as System.Windows.Shapes.Line; line.X1 = A.X; line.Y1 = A.Y; line.X2 = B.X; line.Y2 = B.Y; base.Draw(); line.StrokeThickness = 2; }
public static void addCordinate(Canvas gv) { System.Windows.Shapes.Line a1 = new System.Windows.Shapes.Line(); a1.X1 = -100; a1.Y1 = 0; a1.X2 = 100; a1.Y2 = 0; a1.Stroke = Brushes.Black; gv.Children.Add(a1); System.Windows.Shapes.Line a2 = new System.Windows.Shapes.Line(); a2.X1 = 00; a2.Y1 = 100; a2.X2 = 0; a2.Y2 = -100; a2.Stroke = Brushes.Black; gv.Children.Add(a2); }
public override void OnMouseDown(Object sender, MouseEventArgs e) { isDrawig = true; point = new Point(e.GetPosition(canvas).X, e.GetPosition(canvas).Y); triangle = new Triangle(point, point, point); triangleSide1 = new System.Windows.Shapes.Line(); triangleSide2 = new System.Windows.Shapes.Line(); triangleSide3 = new System.Windows.Shapes.Line(); triangleSide1.X1 = triangleSide2.X1 = triangleSide3.X1 = triangleSide1.X2 = triangleSide2.X2 = triangleSide3.X2 = point.getX(); triangleSide1.Y1 = triangleSide2.Y1 = triangleSide3.Y1 = triangleSide1.Y2 = triangleSide2.Y2 = triangleSide3.Y2 = point.getY(); triangleSide1.Stroke = triangleSide2.Stroke = triangleSide3.Stroke = Brushes.Red; canvas.Children.Add(triangleSide1); canvas.Children.Add(triangleSide2); canvas.Children.Add(triangleSide3); }
/// <summary> /// Initializes a new instance of the DrawingCanvas class. /// </summary> public DrawingCanvas() { // Set the control content. this.Content = this.mainGrid = new Grid(); // Background must not be null (null backgrounds don't pass mouse hit tests). this.mainGrid.Background = new SolidColorBrush(Colors.Transparent); // Hook the mouse events. this.mainGrid.MouseLeftButtonDown += mainGrid_MouseLeftButtonDown; this.mainGrid.MouseLeftButtonUp += mainGrid_MouseLeftButtonUp; this.mainGrid.MouseRightButtonDown += mainGrid_MouseRightButtonDown; this.mainGrid.MouseRightButtonUp += mainGrid_MouseRightButtonUp; this.mainGrid.MouseMove += mainGrid_MouseMove; // Init all grids. this.mainGrid.Children.Add(this.animationGrid = new Grid()); this.mainGrid.Children.Add(this.polygonsGrid = new Grid()); this.mainGrid.Children.Add(this.linesGrid = new Grid()); this.mainGrid.Children.Add(this.pointsGrid = new Grid()); this.mainGrid.Children.Add(this.selectionGrid = new Grid()); // Init the selection line. this.selectionGrid.Children.Add(this.selectionLine = new System.Windows.Shapes.Line()); this.selectionLine.Stroke = new SolidColorBrush(Colors.Gray); this.selectionLine.StrokeDashArray = new DoubleCollection(new double[] { 2, 1 }); // Initialized the observable collections (read more about observables). this.points = new ObservableCollection <CGUtilities.Point>(); this.points.CollectionChanged += points_CollectionChanged; this.lines = new ObservableCollection <Line>(); this.lines.CollectionChanged += lines_CollectionChanged; this.polygons = new ObservableCollection <Polygon>(); this.polygons.CollectionChanged += polygons_CollectionChanged; polygonsUI = new List <ObservableCollection <Line> >(); this.KeyUp += DrawingCanvas_KeyUp; // Set the polygons flag to ready for receiving new Polygon lastPolygonClosed = true; // Ready to start Dragging new Polygon first line rightBtnIsDragging = false; }
/*Draw Mesh*/ public static void DrawMesh(Mesh xMesh, Canvas mainCanvas) { System.Windows.Shapes.Polygon wPoly = new System.Windows.Shapes.Polygon(); foreach (netDxf.Entities.MeshEdge xEdge in xMesh.Edges) { System.Windows.Point myPt1 = TypeConverter.Vertex3ToPoint(xMesh.Vertexes[xEdge.StartVertexIndex]); System.Windows.Point myPt2 = TypeConverter.Vertex3ToPoint(xMesh.Vertexes[xEdge.EndVertexIndex]); myPt1.Y = mainCanvas.Height - myPt1.Y; myPt2.Y = mainCanvas.Height - myPt2.Y; System.Windows.Shapes.Line wLine = DrawUtils.GetLine(myPt1.X, myPt1.Y, myPt2.X, myPt2.Y); TypeConverter.Entity2Shape(xMesh, wLine); mainCanvas.Children.Add(wLine); } }
internal override void Reset() { if (_x1 < 1 || _x2 < 1 || _lines.Count == 0) { return; } Line line = _lines[_lines.Count - 1]; _x1Value = _chartX.GetReverseXInternal(line.X1) + _chartX._startIndex; _y1Value = _chartPanel.GetReverseY(line.Y1); _x2Value = _chartX.GetReverseXInternal(line.X2) + _chartX._startIndex; _y2Value = _chartPanel.GetReverseY(line.Y2); _x1 = _chartX.GetXPixel(_x1Value - _chartX._startIndex); _y1 = _chartPanel.GetY(_y1Value); _x2 = _chartX.GetXPixel(_x2Value - _chartX._startIndex); _y2 = _chartPanel.GetY(_y2Value); }
internal override void DrawLineStudy(Types.RectEx rect, LineStatus lineStatus) { if (_line == null && lineStatus != LineStatus.StartPaint) { DrawLineStudy(rect, LineStatus.StartPaint); } if (lineStatus == LineStatus.StartPaint) { _line = new Line { Stroke = Stroke, StrokeThickness = StrokeThickness, Tag = this }; Types.SetShapePattern(_line, StrokeType); C.Children.Add(_line); Canvas.SetZIndex(_line, ZIndexConstants.LineStudies1); if (_contextLine == null) { _contextLine = new ContextLine(this); _chartX.InvokeLineStudyCreated(new StockChartX.LineStudyCreatedEventArgs(this)); } _internalObjectCreated = true; _segment.BindToLine(_line); return; } if (double.IsInfinity(rect.Top)) { return; } // _line.X1 = rect.Left; // _line.Y1 = rect.Top; // // _line.X2 = rect.Right; // _line.Y2 = rect.Bottom; _segment.X1 = rect.Left; _segment.Y1 = rect.Top; _segment.X2 = rect.Right; _segment.Y2 = rect.Bottom; }
public static List <PolyLine> convertRectangleToPolyLines(System.Windows.Rect rectangle, bool machineRemoval) { double removal = machineRemoval ? Machine.INSIDE_KNIFE_POINTS_REMOVAL / Machine.POINTS_PER_INCH : 0; System.Windows.Shapes.Line left, right, top, bottom; left = new System.Windows.Shapes.Line(); right = new System.Windows.Shapes.Line(); top = new System.Windows.Shapes.Line(); bottom = new System.Windows.Shapes.Line(); bottom.X1 = top.X2 = rectangle.Right - removal; bottom.X2 = top.X1 = rectangle.Left + removal; left.Y1 = right.Y2 = rectangle.Bottom + removal; left.Y2 = right.Y1 = rectangle.Top - removal; bottom.Y1 = bottom.Y2 = rectangle.Bottom; top.Y1 = top.Y2 = rectangle.Top; left.X1 = left.X2 = rectangle.Left; right.X1 = right.X2 = rectangle.Right + 0.01; return(convertLinesToPolyLines(new List <System.Windows.Shapes.Line>(new System.Windows.Shapes.Line[] { bottom, left, top, right }))); }
public Line(Circle start, Circle end, Brush stroke, Brush labelColor, double opacity, double thickness = 1, double strokeDashLength = 0) { _line = new System.Windows.Shapes.Line(); Canvas.SetZIndex(_line, int.MinValue); _label = new LineLabel(labelColor); Start = start; End = end; Stroke = stroke; LabelColor = labelColor; Opacity = opacity; Thickness = thickness; if (strokeDashLength > 0) { StrokeDash = new DoubleCollection() { strokeDashLength } } ; }
internal static void DrawLine(double x1, double y1, double x2, double y2, Brush strokeBrush, LinePattern strokePattern, double strokeThickness, PaintObjectsManager <Line> lines) { Line linePo = lines.GetPaintObject(); System.Windows.Shapes.Line line = linePo._line; line.X1 = x1; line.X2 = x2; line.Y1 = y1; line.Y2 = y2; if (!BrushesEqual(line.Stroke, strokeBrush)) { line.Stroke = strokeBrush; } line.StrokeThickness = strokeThickness; Types.SetShapePattern(line, strokePattern); }
public void MouseDownPolyLine(Panel canvas, MouseButtonEventArgs e, Matrix screenToWorld, PolyLine1 ply) { Point p = e.GetPosition(canvas); p = screenToWorld.Transform(p); var point = new Point(p.X, p.Y); ply.Points.Add(point); _polyline = ply; PolyLine1 clonePy = new PolyLine1(); clonePy.Points = new PointCollection(); _line = new System.Windows.Shapes.Line(); //_line = new Line(); _line.Stroke = new SolidColorBrush(Colors.Black); _line.StrokeDashArray.Add(4); _line.X1 = p.X; _line.Y1 = p.Y; _line.X2 = p.X; _line.Y2 = p.Y; if (ply.Points.Count == 1) { // ply.Points.Add(point);//添加新的数据点 canvas.Children.Add(ply); canvas.Children.Add(_line); lastIndex = canvas.Children.IndexOf(ply); } else { canvas.Children.RemoveAt(lastIndex); clonePy.Points = ply.Points.Clone(); _polyline = clonePy; canvas.Children.Insert(lastIndex, clonePy);//重新new 新节点否则不会onrender 执行 canvas.Children.RemoveAt(lastIndex + 1); canvas.Children.Insert(lastIndex + 1, _line); } }
private void PaintLine(double x1, double y1, double x2, double y2, int index, bool paint) { if (!paint && _lines[index] != null) { _lines[index]._line.Visibility = Visibility.Collapsed; return; } System.Windows.Shapes.Line l = _lines[index]._line; _lines[index]._line.X1 = x1; _lines[index]._line.Y1 = y1; _lines[index]._line.X2 = x2; _lines[index]._line.Y2 = y2; _lines[index]._line.StrokeThickness = _series.StrokeThickness; if (_lines[index]._line.Visibility == Visibility.Collapsed) { _lines[index]._line.Visibility = Visibility.Visible; } }
/// <summary> /// Displays the grouping of the strokes. /// </summary> public void displayAdjacency() { foreach (Sketch.Shape shape1 in panel.Sketch.Shapes) { foreach (Sketch.Shape shape2 in shape1.ConnectedShapes) { System.Windows.Point p1 = new System.Windows.Point((int)shape1.Centroid.X, (int)shape1.Centroid.Y); System.Windows.Point p2 = new System.Windows.Point((int)shape2.Centroid.X, (int)shape2.Centroid.Y); System.Windows.Shapes.Line line = new System.Windows.Shapes.Line(); line.X1 = p1.X; line.X2 = p2.X; line.Y1 = p1.Y; line.Y1 = p2.Y; panel.InkCanvas.Children.Add(line); line.Visibility = System.Windows.Visibility.Visible; } } }
public void drawLine(float x1, float y1, float x2, float y2, Brush outer, Brush inner) { System.Windows.Shapes.Line objLine = new System.Windows.Shapes.Line(); objLine.Stroke = outer; objLine.Fill = inner; //objLine.Width = 1; //< Start-Point > objLine.X1 = x1; objLine.Y1 = y1; //</ Start-Point > //< End-Point > objLine.X2 = x2; objLine.Y2 = y2; //</ End-Point > //< show in maingrid > MainWindow.mainGrid.Children.Add(objLine); //</ show in maingrid > }
public static Canvas GetPoint(Color couleur, double radius, double thickness) { SolidColorBrush myBrush = new SolidColorBrush(couleur); double myThickness = 1 * (radius / 40); if (thickness > 0) { myThickness = thickness; } Canvas canvas1 = new Canvas(); System.Windows.Shapes.Rectangle wRect = new System.Windows.Shapes.Rectangle(); wRect.Width = radius; wRect.Height = radius; wRect.Stroke = myBrush; wRect.StrokeThickness = myThickness; Canvas.SetLeft(wRect, radius / 2); Canvas.SetTop(wRect, radius / 2); canvas1.Children.Add(wRect); System.Windows.Shapes.Line wLine = GetLine(0, radius, radius * 2, radius); wLine.Stroke = myBrush; wLine.StrokeThickness = myThickness; wLine.SnapsToDevicePixels = false; canvas1.Children.Add(wLine); wLine = GetLine(radius, 0, radius, radius * 2); wLine.Stroke = myBrush; wLine.StrokeThickness = myThickness; canvas1.Children.Add(wLine); Canvas.SetZIndex(canvas1, 9999); return(canvas1); }
public void displayConnections(Dictionary <Sketch.Shape, Dictionary <Sketch.Shape, bool> > shapeconnections) { foreach (Sketch.Shape shape1 in shapeconnections.Keys) { foreach (Sketch.Shape shape2 in shapeconnections[shape1].Keys) { if (shapeconnections[shape1][shape2]) { System.Windows.Point p1 = new System.Windows.Point((int)shape1.Centroid.X, (int)shape1.Centroid.Y); System.Windows.Point p2 = new System.Windows.Point((int)shape2.Centroid.X, (int)shape2.Centroid.Y); System.Windows.Shapes.Line line = new System.Windows.Shapes.Line(); line.X1 = p1.X; line.X2 = p2.X; line.Y1 = p1.Y; line.Y1 = p2.Y; panel.InkCanvas.Children.Add(line); line.Visibility = System.Windows.Visibility.Visible; } } } }
protected override void Write(WpfRenderer renderer, ThematicBreakBlock obj) { if (renderer == null) { throw new ArgumentNullException(nameof(renderer)); } if (obj == null) { throw new ArgumentNullException(nameof(obj)); } var line = new System.Windows.Shapes.Line { X2 = 1 }; line.SetResourceReference(FrameworkContentElement.StyleProperty, Styles.ThematicBreakStyleKey); var paragraph = new Paragraph { Inlines = { new InlineUIContainer(line) } }; renderer.WriteBlock(paragraph); }
internal override void SetCursor() { if (_lines.Length == 0) { return; } System.Windows.Shapes.Line line = _lines[0]; if (_selectionVisible) { foreach (System.Windows.Shapes.Line l in _lines) { l.Cursor = Cursors.Hand; } return; } if (_selectionVisible || line.Cursor == Cursors.Arrow) { return; } foreach (System.Windows.Shapes.Line l in _lines) { l.Cursor = Cursors.Arrow; } }
public Line() { C = new System.Windows.Shapes.Line(); }
internal override void DrawLineStudy(Types.RectEx rect, LineStatus lineStatus) { if (lineStatus == LineStatus.StartPaint) { return; } rect.Normalize(); if (rect.Width == 0 || rect.Left < 0) { return; } int revX1 = (int)(_chartX.GetReverseXInternal(rect.Left) + _chartX._startIndex); int revX2 = (int)(_chartX.GetReverseXInternal(rect.Right) + _chartX._startIndex); if (revX1 < 0) { revX1 = 0; } if (revX2 < 0) { revX2 = 0; } if (revX1 == revX2) { return; } // Note: this code makes the vague assumption // that only one symbol exists on this panel. // Get the close series Series sClose = GetSeriesOHLC(SeriesTypeOHLC.Close); if (sClose == null) { return; } //Debug.Assert(sClose.RecordCount == _chartX.RecordCount); if (revX1 >= _chartX.RecordCount) { revX1 = _chartX.RecordCount - 1; } if (revX2 >= _chartX.RecordCount) { revX2 = _chartX.RecordCount - 1; } // Get the highest high of the high series. double highestHigh = 0; Series sHigh = GetSeriesOHLC(SeriesTypeOHLC.High); if (sHigh == null) { return; } //Debug.Assert(revX1 <= revX2); for (int i = revX1; i <= revX2; i++) { if (sHigh[i].Value > highestHigh) { highestHigh = sHigh[i].Value.Value; } } //Get the lowest low of the low series. double lowestLow = highestHigh; Series sLow = GetSeriesOHLC(SeriesTypeOHLC.Low); if (sLow == null) { return; } for (int i = revX1; i <= revX2; i++) { if (sLow[i].Value < lowestLow) { lowestLow = sLow[i].Value.Value; } } double range = (highestHigh - lowestLow) * 0.5; if (_rangeScale.HasValue) { range = (highestHigh - lowestLow) * _rangeScale.Value; } // Perform linear regression on the data double xSum = 0, ySum = 0, xSquaredSum = 0, xYSum = 0; int x = revX2 - revX1; int j, n; for (n = 1; n != x + 1; ++n) { j = revX1 + n - 1; xSum += n; ySum += sClose[j].Value.Value; xSquaredSum += (n * n); xYSum += (sClose[j].Value.Value * n); } n = x; double q1 = n != 0 ? (xYSum - ((xSum * ySum) / n)) : 0; double q2 = n != 0 ? (xSquaredSum - ((xSum * xSum) / n)) : 0; double slope = q2 != 0 ? (q1 / q2) : 0; double leftValue = slope != 0 ? (((1 / (double)n) * ySum) - (((int)((double)n / 2)) * slope)) : 0.0; double rightValue = ((n * slope) + leftValue); double inc = (x - 1) != 0 ? (rightValue - leftValue) / (x - 1) : 0; j = 0; double prevVal = 0; double lX1 = rect.Left; //_chartX.GetX(revX1 - _chartX._startIndex); double lX2 = rect.Right; // _chartX.GetX((revX2 - 1) - _chartX._startIndex + 1); if (_linesError.Count == 0) { for (int i = 0; i < 3; i++) { System.Windows.Shapes.Line line = new System.Windows.Shapes.Line { Tag = this }; Canvas.SetZIndex(line, ZIndexConstants.LineStudies1); C.Children.Add(line); _linesError.Add(line); } _contextLine = new ContextLine(this); _chartX.InvokeLineStudyCreated(new StockChartX.LineStudyCreatedEventArgs(this)); } _internalObjectCreated = true; _lines.C = C; _lines.Start(); for (n = revX1; n <= revX2; n++, j++) { double val = leftValue + inc * (j - 1); //double lX1 = _chartX.GetX(n - _chartX._startIndex); //double lX2 = _chartX.GetX(n - _chartX._startIndex + 1); double lY1 = _chartPanel.GetY(prevVal + range); double lY2 = _chartPanel.GetY(val + range); if (prevVal != 0.0) { _errorLines[2].Y1 = lY1; _errorLines[2].Y2 = lY2; Utils.DrawLine(lX1, lY1, lX2, lY2, Stroke, StrokeType, StrokeThickness, _linesError[0]); } lY1 = _chartPanel.GetY(prevVal - range); lY2 = _chartPanel.GetY(val - range); if (prevVal != 0.0) { _errorLines[0].Y1 = lY1; _errorLines[0].Y2 = lY2; Utils.DrawLine(lX1, lY1, lX2, lY2, Stroke, StrokeType, StrokeThickness, _linesError[1]); } lY1 = _chartPanel.GetY(prevVal); lY2 = _chartPanel.GetY(val); if (prevVal != 0.0) { _errorLines[1].Y1 = lY1; _errorLines[1].Y2 = lY2; Utils.DrawLine(lX1, lY1, lX2, lY2, Stroke, StrokeType, StrokeThickness, _linesError[2]); } prevVal = val; } if (lineStatus == LineStatus.Moving || lineStatus == LineStatus.Painting) { Utils.DrawLine(rect.Left, 0, rect.Left, _chartPanel.Height, Stroke, StrokeType, StrokeThickness, _lines); Utils.DrawLine(rect.Right, 0, rect.Right, _chartPanel.Height, Stroke, StrokeType, StrokeThickness, _lines); } _lines.Stop(); _lines.Do(l => l.ZIndex = ZIndexConstants.LineStudies1); _errorLines[0].X1 = rect.Left; _errorLines[0].X2 = rect.Right; _errorLines[1].X1 = rect.Left; _errorLines[1].X2 = rect.Right; _errorLines[2].X1 = rect.Left; _errorLines[2].X2 = rect.Right; if (_contextLine == null && _linesError.Count > 0) { _contextLine = new ContextLine(this); } }
/// <summary> /// Handles setting up the custom numbering margin. /// </summary> /// <remarks>Handles being called more than once as it will only add margin if it doesn't exist yet.</remarks> /// <history> /// [Curtis_Beard] 04/08/2015 ADD: update RichTextBox to AvalonEdit /// </history> private void InitCustomMargin() { if (hasCustomMargin) { return; } var leftMargins = this.TextArea.LeftMargins; var dottedLine = new System.Windows.Shapes.Line { X1 = 0, Y1 = 0, X2 = 0, Y2 = 1, StrokeDashArray = { 0, 2 }, Stretch = System.Windows.Media.Stretch.Fill, StrokeThickness = 1, StrokeDashCap = System.Windows.Media.PenLineCap.Round, Margin = new System.Windows.Thickness(2, 0, 2, 0), Tag = dottedLineTag }; dottedLine.SetBinding( System.Windows.Shapes.Line.StrokeProperty, new System.Windows.Data.Binding("LineNumbersForeground") { Source = this } ); leftMargins.Insert(0, customMargin); leftMargins.Insert(1, dottedLine); customMargin.SetBinding(System.Windows.Controls.Control.ForegroundProperty, new System.Windows.Data.Binding("LineNumbersForeground") { Source = this }); customMargin.SetBinding(System.Windows.Controls.Control.BackgroundProperty, new System.Windows.Data.Binding("LineNumbersMatchForeground") { Source = this }); hasCustomMargin = true; }
public int GetScale(PointF min, PointF max, int CanvasSize) { int BorderAroutWorkArea = 150; double LongestWall = 0; int Scale = 0; CanvasSize = CanvasSize - BorderAroutWorkArea; List <System.Windows.Shapes.Line> sides = new List <System.Windows.Shapes.Line>(); System.Windows.Shapes.Line sideA = new System.Windows.Shapes.Line(); sideA.X1 = min.X; sideA.Y1 = min.Y; sideA.X2 = min.X; sideA.Y2 = max.Y; sides.Add(sideA); System.Windows.Shapes.Line sideB = new System.Windows.Shapes.Line(); sideB.X1 = min.X; sideB.Y1 = max.Y; sideB.X2 = max.X; sideB.Y2 = max.Y; sides.Add(sideB); System.Windows.Shapes.Line sideC = new System.Windows.Shapes.Line(); sideC.X1 = max.X; sideC.Y1 = max.Y; sideC.X2 = max.X; sideC.Y2 = min.Y; sides.Add(sideC); System.Windows.Shapes.Line sideD = new System.Windows.Shapes.Line(); sideD.X1 = max.X; sideD.Y1 = min.Y; sideD.X2 = min.X; sideD.Y2 = min.Y; sides.Add(sideD); WpfCoordinates coord = new WpfCoordinates(); foreach (var item in sides) { if (coord.GetLength(item) > LongestWall) { LongestWall = coord.GetLength(item); } } if ((LongestWall / CanvasSize) < 1) { Scale = 1; } else if ((LongestWall / CanvasSize) >= 1 && (LongestWall / CanvasSize) < 2) { Scale = 2; } else if ((LongestWall / CanvasSize) >= 2 && (LongestWall / CanvasSize) < 5) { Scale = 5; } else if ((LongestWall / CanvasSize) >= 5 && (LongestWall / CanvasSize) < 10) { Scale = 10; } else if ((LongestWall / CanvasSize) >= 10 && (LongestWall / CanvasSize) < 20) { Scale = 20; } else if ((LongestWall / CanvasSize) >= 20 && (LongestWall / CanvasSize) < 25) { Scale = 25; } else if ((LongestWall / CanvasSize) >= 25 && (LongestWall / CanvasSize) < 50) { Scale = 50; } else if ((LongestWall / CanvasSize) >= 50 && (LongestWall / CanvasSize) < 100) { Scale = 100; } else if ((LongestWall / CanvasSize) >= 100 && (LongestWall / CanvasSize) < 200) { Scale = 200; } else if ((LongestWall / CanvasSize) >= 200 && (LongestWall / CanvasSize) < 500) { Scale = 500; } else if ((LongestWall / CanvasSize) >= 500 && (LongestWall / CanvasSize) < 1000) { Scale = 1000; } return(Scale); }
public List <PolyLine> getOutsideLines() { List <System.Windows.Shapes.Line> lines = new List <System.Windows.Shapes.Line>(); if (!cutOutside_) { return(PolyLine.convertLinesToPolyLines(lines)); } bool top = qtyX_ % 2 == 1; bool left = qtyY_ % 2 == 0; for (int i = left ? 1 : qtyX_ - 1; left?i < qtyX_ : i > 0; i += left ? 1 : -1) { System.Windows.Shapes.Line newLine = new System.Windows.Shapes.Line(); newLine.X1 = newLine.X2 = i * outside_.Width; if (top) { newLine.Y1 = 0; newLine.Y2 = outside_.Height * qtyY_; } else { newLine.Y2 = 0; newLine.Y1 = outside_.Height * qtyY_; } lines.Add(newLine); top = !top; } for (int j = 1; j < qtyY_; j++) { System.Windows.Shapes.Line newLine = new System.Windows.Shapes.Line(); newLine.Y1 = newLine.Y2 = j * outside_.Height; if (left) { newLine.X1 = outside_.Width * qtyX_; newLine.X2 = 0; } else { newLine.X1 = 0; newLine.X2 = outside_.Width * qtyX_; } lines.Add(newLine); left = !left; } System.Windows.Shapes.Line topLine = new System.Windows.Shapes.Line(); System.Windows.Shapes.Line rightLine = new System.Windows.Shapes.Line(); System.Windows.Shapes.Line bottomLine = new System.Windows.Shapes.Line(); System.Windows.Shapes.Line leftLine = new System.Windows.Shapes.Line(); topLine.X2 = rightLine.X1 = rightLine.X2 = bottomLine.X1 = 0; topLine.X1 = bottomLine.X2 = leftLine.X1 = leftLine.X2 = outside_.Width * qtyX_; topLine.Y1 = topLine.Y2 = rightLine.Y1 = leftLine.Y2 = outside_.Height * qtyY_; rightLine.Y2 = bottomLine.Y1 = bottomLine.Y2 = leftLine.Y1; lines.AddRange( new List <System.Windows.Shapes.Line> { rightLine, bottomLine, leftLine, topLine, }); return(PolyLine.convertLinesToPolyLines(lines)); }
internal override void DrawLineStudy(Types.RectEx rect, LineStatus lineStatus) { if (lineStatus == LineStatus.StartPaint) { for (int i = 0; i < _lines.Length; i++) { _lines[i] = new Line { Tag = this }; Canvas.SetZIndex(_lines[i], ZIndexConstants.LineStudies1); C.Children.Add(_lines[i]); } _contextLine = new ContextLine(this); _internalObjectCreated = true; _chartX.InvokeLineStudyCreated(new StockChartX.LineStudyCreatedEventArgs(this)); return; } // for (int i = 0; i < _lines.Length; i++ ) // { // double cx = C.ActualWidth - rect.Right; // double cy = rect.Bottom - (cx * _angles[i]); // Utils.DrawLine(rect.Right, rect.Bottom, C.ActualWidth, cy, Stroke, StrokeType, StrokeThickness, _lines[i]); // } double x = 0; double cx = 0; double y = 0; double cy = 0; //rect.Normalize(); for (int n = 0; n != 10; n++) { bool flip = true; double ay = 0; if (lineStatus == LineStatus.Painting || lineStatus == LineStatus.Moving) { ay = rect.Bottom; } else { ay = _y1; } if (ay > C.ActualHeight - 30) { flip = true; } else if (ay < 30) { flip = false; } else { flip = _prevUp; } double right = rect.Left + ((rect.Right + MAX_VISIBLE) * ((n + 3) * 0.125)); cx = right; if (flip) { cy = rect.Top - MAX_VISIBLE; if (n == 4) { n = 5; } if (n == 5) { cx = rect.Right + MAX_VISIBLE; } y = rect.Bottom; x = rect.Left; } else { cy = rect.Bottom + MAX_VISIBLE; y = rect.Top; x = rect.Left; } Utils.DrawLine(x, y, cx, cy, Stroke, StrokeType, StrokeThickness, Opacity, _lines[n]); } }
internal override void DrawLineStudy(Types.RectEx rect, LineStatus lineStatus) { if (lineStatus == LineStatus.StartPaint) { for (int i = 0; i < _lines.Length; i++) { _lines[i] = new System.Windows.Shapes.Line { Tag = this }; Canvas.SetZIndex(_lines[i], ZIndexConstants.LineStudies1); C.Children.Add(_lines[i]); } if (_contextLine == null) { _contextLine = new ContextLine(this); _chartX.InvokeLineStudyCreated(new StockChartX.LineStudyCreatedEventArgs(this)); } _internalObjectCreated = true; return; } rect.Normalize(); if (rect.Width == 0) { return; } int revX1 = (int)(_chartX.GetReverseXInternal(rect.Left) + _chartX._startIndex); int revX2 = (int)(_chartX.GetReverseXInternal(rect.Right) + _chartX._startIndex); if (revX1 < 0) { revX1 = 0; } if (revX2 < 0) { revX2 = 0; } if (revX1 == revX2) { return; } // Get the highest high of the high series. // Note: this code makes the vague assumption // that only one symbol exists on this panel. Series sHigh = GetSeriesOHLC(SeriesTypeOHLC.High); if (sHigh == null) { return; } Series sLow = GetSeriesOHLC(SeriesTypeOHLC.Low); if (sLow == null) { return; } Series sClose = GetSeriesOHLC(SeriesTypeOHLC.Close); if (revX1 >= sHigh.RecordCount) { revX1 = sHigh.RecordCount; } if (revX2 >= sHigh.RecordCount) { revX2 = sHigh.RecordCount; } //********** // Perform linear regression on the data double xSum = 0, ySum = 0, xSquaredSum = 0, xYSum = 0; int n, j; if (revX1 > revX2) { revX2 = revX1; } int x = revX2 - revX1; for (n = 1; n != x + 1; ++n) { j = revX1 + n - 1; xSum += n; ySum += sClose[j].Value.Value; xSquaredSum += (n * n); xYSum += (sClose[j].Value.Value * n); } n = x; double q1 = n != 0 ? (xYSum - ((xSum * ySum) / n)) : 0; double q2 = n != 0 ? (xSquaredSum - ((xSum * xSum) / n)) : 0; double slope = q2 != 0 ? (q1 / q2) : 0; double leftValue = slope != 0 ? (((1 / (double)n) * ySum) - (((int)((double)n / 2)) * slope)) : 0.0; double rightValue = ((n * slope) + leftValue); double right = (x - 1); double inc = 0; if (right != 0) { inc = (rightValue - leftValue) / right; } double prevVal = 0.0; j = 0; // Find max distance from linear regression line double lowestLow = sHigh[0].Value.Value; double highestHigh = 0; for (n = revX1; n < revX2; ++n) { j++; double val = leftValue + inc * (j - 1); if (prevVal != 0) { if (sHigh[n].Value.Value - val > highestHigh) { highestHigh = sHigh[n].Value.Value - val; } if (val - sLow[n].Value.Value < lowestLow && val - sLow[n].Value.Value > 0) { lowestLow = val - sLow[n].Value.Value; } } prevVal = val; } if (highestHigh > lowestLow) { lowestLow = highestHigh; } if (lowestLow > highestHigh) { highestHigh = lowestLow; } _linesSel.C = C; double lX1 = _chartX.GetXPixel(revX1 - _chartX._startIndex); double lX2 = _chartX.GetXPixel(revX2 - _chartX._startIndex + 1); j = 0; for (n = revX1; n < revX2; n++, j++) { double val = leftValue + inc * (j - 1); double lY1 = _chartPanel.GetY(prevVal - lowestLow); double lY2 = _chartPanel.GetY(val - lowestLow); if (prevVal != 0) { Utils.DrawLine(lX1, lY1, lX2, lY2, Stroke, StrokeType, StrokeThickness, _lines[0]); } lY1 = _chartPanel.GetY(prevVal); lY2 = _chartPanel.GetY(val); if (prevVal != 0) { Utils.DrawLine(lX1, lY1, lX2, lY2, Stroke, StrokeType, StrokeThickness, _lines[1]); } lY1 = _chartPanel.GetY(prevVal + highestHigh); lY2 = _chartPanel.GetY(val + highestHigh); if (prevVal != 0) { Utils.DrawLine(lX1, lY1, lX2, lY2, Stroke, StrokeType, StrokeThickness, _lines[2]); } prevVal = val; } _linesSel.Start(); if (lineStatus == LineStatus.Moving || lineStatus == LineStatus.Painting) { Utils.DrawLine(lX1, 0, lX1, C.ActualHeight, Stroke, LinePattern.Dot, StrokeThickness, _linesSel); Utils.DrawLine(lX2, 0, lX2, C.ActualHeight, Stroke, LinePattern.Dot, StrokeThickness, _linesSel); } _linesSel.Stop(); _linesSel.Do(l => l.ZIndex = ZIndexConstants.LineStudies1); }
/// <summary> /// Updates this instance. /// </summary> private void Update() { double xAxisWidthStep = (int)this.ActualWidth / this.XAxis.MIntervalCount; double xAxisWidthPosition = xAxisWidthStep; int xminorCount = 0; int yminorCount = 0; if ((this.XAxis.MLabels.Count) == _xLines.Count) { for (int i = 0; i < this.XAxis.MLabels.Count; i++) { Line line = _xLines[i]; line.X1 = xAxisWidthPosition; line.X2 = xAxisWidthPosition; line.Y2 = (int)this.ActualHeight; if (i != (this.XAxis.MLabels.Count - 1)) { for (int a = 0; a < this.XAxis.MinorTicksCount; a++) { Line minorline = _xMinorLines[xminorCount]; minorline.X1 = this.XAxis.DataToPoint((this.XAxis.MStartValue + (this.XAxis.MInterval * i)) + ((this.XAxis.MInterval / (this.XAxis.MinorTicksCount + 1)) * (a + 1))); minorline.X2 = this.XAxis.DataToPoint((this.XAxis.MStartValue + (this.XAxis.MInterval * i)) + ((this.XAxis.MInterval / (this.XAxis.MinorTicksCount + 1)) * (a + 1))); minorline.Y1 = 0; minorline.Y2 = this.ActualHeight; xminorCount++; } } xAxisWidthPosition += xAxisWidthStep; } } else { if ((this.XAxis.MLabels.Count) > _xLines.Count) { int offset = (this.XAxis.MLabels.Count) - _xLines.Count; for (int j = 0; j < offset; j++) { Line line = new Line {X1 = 0, X2 = 0, Y2 = this.ActualHeight}; Binding styleBinding = new Binding { Path = new PropertyPath("CrossLineStyle"), Source = this.XAxis }; Binding showCrossLines = new Binding { Path = new PropertyPath("ShowCrossLines"), Source = this.XAxis, Converter = new BooleanToVisibilityConverter() }; line.SetBinding(Line.VisibilityProperty, showCrossLines); line.SetBinding(Line.StyleProperty, styleBinding); for (int a = 0; a < this.XAxis.MinorTicksCount; a++) { Line minorline = new Line(); Binding minorstyleBinding = new Binding { Path = new PropertyPath("MinorCrossLineStyle"), Source = this.XAxis }; minorline.SetBinding(Line.StyleProperty, minorstyleBinding); Binding minorshowCrossLines = new Binding { Path = new PropertyPath("ShowMinorCrossLines"), Source = this.XAxis }; minorshowCrossLines.Converter = new BooleanToVisibilityConverter(); minorline.SetBinding(Line.VisibilityProperty, minorshowCrossLines); minorline.X1 = this.XAxis.DataToPoint((this.XAxis.MStartValue + (this.XAxis.MInterval * j)) + ((this.XAxis.MInterval / (this.XAxis.MinorTicksCount + 1)) * (a + 1))); minorline.X2 = this.XAxis.DataToPoint((this.XAxis.MStartValue + (this.XAxis.MInterval * j)) + ((this.XAxis.MInterval / (this.XAxis.MinorTicksCount + 1)) * (a + 1))); minorline.Y1 = 0; minorline.Y2 = this.ActualHeight; this.Children.Add(minorline); _xMinorLines.Add(minorline); } _xLines.Add(line); this.Children.Add(line); } } else { int offset = _xLines.Count - (this.XAxis.MLabels.Count); for (int j = 0; j < offset; j++) { for (int a = 0; a < this.XAxis.MinorTicksCount; a++) { this.Children.Remove(_xMinorLines[_xMinorLines.Count - 1]); _xMinorLines.RemoveAt(_xMinorLines.Count - 1); } this.Children.Remove(_xLines[_xLines.Count - 1]); _xLines.RemoveAt(_xLines.Count - 1); } } for (int i = 0; i < this.XAxis.MLabels.Count; i++) { Line line = _xLines[i]; line.X1 = xAxisWidthPosition; line.X2 = xAxisWidthPosition; line.Y2 = this.ActualHeight; if (i != (this.XAxis.MLabels.Count - 1)) { for (int a = 0; a < this.XAxis.MinorTicksCount; a++) { Line minorline = _xMinorLines[xminorCount]; minorline.X1 = this.XAxis.DataToPoint((this.XAxis.MStartValue + (this.XAxis.MInterval * i)) + ((this.XAxis.MInterval / (this.XAxis.MinorTicksCount + 1)) * (a + 1))); minorline.X2 = this.XAxis.DataToPoint((this.XAxis.MStartValue + (this.XAxis.MInterval * i)) + ((this.XAxis.MInterval / (this.XAxis.MinorTicksCount + 1)) * (a + 1))); minorline.Y1 = 0; minorline.Y2 = this.ActualHeight; xminorCount++; } } xAxisWidthPosition += xAxisWidthStep; } } double yAxisHeightStep = (int)this.ActualHeight / this.YAxis.MIntervalCount; double yAxisHeightPosition = yAxisHeightStep; if (YAxis.MLabels.Count == _yLines.Count) { for (int i = 0; i < YAxis.MLabels.Count ; i++) { Line line = _yLines[i]; line.X2 = this.ActualWidth; line.Y1 = yAxisHeightPosition; line.Y2 = yAxisHeightPosition; if (i != (this.YAxis.MLabels.Count - 1)) { for (int a = 0; a < this.YAxis.MinorTicksCount; a++) { Line minorline = _yMinorLines[yminorCount]; minorline.Y1 = this.YAxis.DataToPoint((this.YAxis.MStartValue + (this.YAxis.MInterval * i)) + ((this.YAxis.MInterval / (this.YAxis.MinorTicksCount + 1)) * (a + 1))); minorline.Y2 = this.YAxis.DataToPoint((this.YAxis.MStartValue + (this.YAxis.MInterval * i)) + ((this.YAxis.MInterval / (this.YAxis.MinorTicksCount + 1)) * (a + 1))); minorline.X1 = 0; minorline.X2 = this.ActualWidth; yminorCount++; } } yAxisHeightPosition += yAxisHeightStep; } } else { if ((this.YAxis.MLabels.Count) > _yLines.Count) { int offset = (this.YAxis.MLabels.Count) - _yLines.Count; for (int j = 0; j < offset; j++) { Line line = new Line(); line.X1 = 0; line.X2 = this.ActualWidth; line.Y1 = yAxisHeightPosition; line.Y2 = yAxisHeightPosition; Binding showCrossLines = new Binding { Path = new PropertyPath("ShowCrossLines"), Source = this.YAxis, Converter = new BooleanToVisibilityConverter() }; line.SetBinding(Line.VisibilityProperty, showCrossLines); Binding styleBinding = new Binding { Path = new PropertyPath("CrossLineStyle"), Source = this.YAxis }; line.SetBinding(Line.StyleProperty, styleBinding); for (int a = 0; a < this.YAxis.MinorTicksCount; a++) { Line minorline = new Line(); Binding minorstyleBinding = new Binding { Path = new PropertyPath("MinorCrossLineStyle"), Source = this.YAxis }; minorline.SetBinding(Line.StyleProperty, minorstyleBinding); Binding minorshowCrossLines = new Binding { Path = new PropertyPath("ShowMinorCrossLines"), Source = this.YAxis }; minorshowCrossLines.Converter = new BooleanToVisibilityConverter(); minorline.SetBinding(Line.VisibilityProperty, minorshowCrossLines); minorline.Y1 = this.YAxis.DataToPoint((this.YAxis.MStartValue + (this.YAxis.MInterval * j)) + ((this.YAxis.MInterval / (this.YAxis.MinorTicksCount + 1)) * (a + 1))); minorline.Y2 = this.YAxis.DataToPoint((this.YAxis.MStartValue + (this.YAxis.MInterval * j)) + ((this.YAxis.MInterval / (this.YAxis.MinorTicksCount + 1)) * (a + 1))); minorline.X1 = 0; minorline.X2 = this.ActualWidth; this.Children.Add(minorline); _yMinorLines.Add(minorline); } this.Children.Add(line); this._yLines.Add(line); } } else { int offset = _yLines.Count - (this.YAxis.MLabels.Count); for (int j = 0; j < offset; j++) { for (int a = 0; a < this.YAxis.MinorTicksCount; a++) { this.Children.Remove(_yMinorLines[_yMinorLines.Count - 1]); _yMinorLines.RemoveAt(_yMinorLines.Count - 1); } this.Children.Remove(_yLines[_yLines.Count - 1]); _yLines.RemoveAt(_yLines.Count - 1); } } for (int i = 0; i < YAxis.MLabels.Count-1; i++) { Line line = _yLines[i]; line.X2 = this.ActualWidth; line.Y1 = yAxisHeightPosition; line.Y2 = yAxisHeightPosition; if (i != (this.YAxis.MLabels.Count - 1)) { for (int a = 0; a < this.YAxis.MinorTicksCount; a++) { Line minorline = _yMinorLines[yminorCount]; minorline.Y1 = this.YAxis.DataToPoint((this.YAxis.MStartValue + (this.YAxis.MInterval * i)) + ((this.YAxis.MInterval / (this.YAxis.MinorTicksCount + 1)) * (a + 1))); minorline.Y2 = this.YAxis.DataToPoint((this.YAxis.MStartValue + (this.YAxis.MInterval * i)) + ((this.YAxis.MInterval / (this.YAxis.MinorTicksCount + 1)) * (a + 1))); minorline.X1 = 0; minorline.X2 = this.ActualWidth; yminorCount++; } } yAxisHeightPosition += yAxisHeightStep; } } }
/// <summary> /// Constructor /// </summary> /// <param name="key">Unique key for line study</param> /// <param name="stroke">Stroke brush</param> /// <param name="chartPanel">Reference to chart panel where it will be placed.</param> public VerticalLine(string key, Brush stroke, ChartPanel chartPanel) : base(key, stroke, chartPanel) { _studyType = StudyTypeEnum.VerticalLine; _line = new Line(); }
UIElement CreateGraphicsElement(ExportGraphic column) { var line = new System.Windows.Shapes.Line(); line.Stroke = ConvertBrush(column.StyleDecorator.ForeColor); line.StrokeThickness = column.StyleDecorator.Thickness; var ld = column.StyleDecorator as LineDecorator; if (ld != null) { line.X1 = ld.From.X; line.Y1 = ld.From.Y; line.X2 = ld.To.X; line.Y2 = ld.To.Y; } else { line.X1 = column.StyleDecorator.Location.X; line.Y1 = column.StyleDecorator.Location.Y; line.X2 = column.StyleDecorator.DisplayRectangle.Width; line.Y2 = column.StyleDecorator.Location.Y; } return line; }
/// <summary> /// Draw an individual skeleton. /// </summary> /// <param name="skeleton">The skeleton to draw.</param> /// <param name="brush">The brush to use.</param> /// <param name="thickness">This thickness of the stroke.</param> private void DrawStickMan(Skeleton skeleton, Brush brush, int thickness) { foreach (var run in SkeletonSegmentRuns) { var next = this.GetJointPoint(skeleton, run[0]); for (var i = 1; i < run.Length; i++) { var prev = next; next = this.GetJointPoint(skeleton, run[i]); var line = new System.Windows.Shapes.Line { Stroke = brush, StrokeThickness = thickness, X1 = prev.X, Y1 = prev.Y, X2 = next.X, Y2 = next.Y, StrokeEndLineCap = PenLineCap.Round, StrokeStartLineCap = PenLineCap.Round }; StickMen.Children.Add(line); } } }
public PolyLine(System.Windows.Shapes.Line line) { lines_ = new List <System.Windows.Shapes.Line>(new System.Windows.Shapes.Line[] { line }); }
private void Initialize() { this.Children.Clear(); if (this.ActualHeight > 0 && this.ActualWidth > 0) { double xAxisWidthStep = this.ActualWidth / this.XAxis.MIntervalCount; double xAxisWidthPosition = 0; _xLines = new List<Line>(); _yLines = new List<Line>(); _xMinorLines = new List<Line>(); _yMinorLines = new List<Line>(); int k = 0; for (int i = 0; i < this.XAxis.MLabels.Count; i++) { Line line = new Line(); line.X1 = this.XAxis.DataToPoint(this.XAxis.MStartValue + (this.XAxis.MInterval * k)); line.X2 = this.XAxis.DataToPoint(this.XAxis.MStartValue + (this.XAxis.MInterval * k)); line.Y1 = 0; line.Y2 = this.ActualHeight; Binding styleBinding = new Binding {Path = new PropertyPath("CrossLineStyle"), Source = this.XAxis}; line.SetBinding(Line.StyleProperty, styleBinding); Binding showCrossLines = new Binding { Path = new PropertyPath("ShowCrossLines"), Source = this.XAxis }; showCrossLines.Converter = new BooleanToVisibilityConverter(); line.SetBinding(Line.VisibilityProperty, showCrossLines); if (i != (this.XAxis.MLabels.Count - 1)) { for (int a = 0; a < this.XAxis.MinorTicksCount; a++) { Line minorline = new Line(); Binding minorstyleBinding = new Binding { Path = new PropertyPath("MinorCrossLineStyle"), Source = this.XAxis }; minorline.SetBinding(Line.StyleProperty, minorstyleBinding); Binding minorshowCrossLines = new Binding { Path = new PropertyPath("ShowMinorCrossLines"), Source = this.XAxis }; minorshowCrossLines.Converter = new BooleanToVisibilityConverter(); minorline.SetBinding(Line.VisibilityProperty, minorshowCrossLines); minorline.X1 = this.XAxis.DataToPoint((this.XAxis.MStartValue + (this.XAxis.MInterval * k)) + ((this.XAxis.MInterval / (this.XAxis.MinorTicksCount + 1)) * (a + 1))); minorline.X2 = this.XAxis.DataToPoint((this.XAxis.MStartValue + (this.XAxis.MInterval * k)) + ((this.XAxis.MInterval / (this.XAxis.MinorTicksCount + 1)) * (a + 1))); minorline.Y1 = 0; minorline.Y2 = this.ActualHeight; this.Children.Add(minorline); _xMinorLines.Add(minorline); } } _xLines.Add(line); this.Children.Add(line); xAxisWidthPosition += xAxisWidthStep; k++; } double yAxisHeightStep = this.ActualHeight / this.YAxis.MIntervalCount; double yAxisHeightPosition = 0; int j = 0; for (int i = 0; i < YAxis.MLabels.Count; i++) { Line line = new Line(); line.X1 = 0; line.X2 = this.ActualWidth; line.Y1 = this.YAxis.DataToPoint(this.YAxis.MStartValue + (this.YAxis.MInterval * j)); line.Y2 = this.YAxis.DataToPoint(this.YAxis.MStartValue + (this.YAxis.MInterval * j)); Binding showCrossLines = new Binding { Path = new PropertyPath("ShowCrossLines"), Source = this.YAxis }; showCrossLines.Converter = new BooleanToVisibilityConverter(); line.SetBinding(Line.VisibilityProperty, showCrossLines); Binding styleBinding = new Binding {Path = new PropertyPath("CrossLineStyle"), Source = this.YAxis}; line.SetBinding(Line.StyleProperty, styleBinding); if (i != (this.YAxis.MLabels.Count - 1)) { for (int a = 0; a < this.YAxis.MinorTicksCount; a++) { Line minorline = new Line(); Binding minorstyleBinding = new Binding { Path = new PropertyPath("MinorCrossLineStyle"), Source = this.YAxis }; minorline.SetBinding(Line.StyleProperty, minorstyleBinding); Binding minorshowCrossLines = new Binding { Path = new PropertyPath("ShowMinorCrossLines"), Source = this.YAxis }; minorshowCrossLines.Converter = new BooleanToVisibilityConverter(); minorline.SetBinding(Line.VisibilityProperty, minorshowCrossLines); minorline.Y1 = this.YAxis.DataToPoint((this.YAxis.MStartValue + (this.YAxis.MInterval * j)) + ((this.YAxis.MInterval / (this.YAxis.MinorTicksCount + 1)) * (a + 1))); minorline.Y2 = this.YAxis.DataToPoint((this.YAxis.MStartValue + (this.YAxis.MInterval * j)) + ((this.YAxis.MInterval / (this.YAxis.MinorTicksCount + 1)) * (a + 1))); minorline.X1 = 0; minorline.X2 = this.ActualWidth; this.Children.Add(minorline); _yMinorLines.Add(minorline); } } this.Children.Add(line); this._yLines.Add(line); yAxisHeightPosition += yAxisHeightStep; j++; } _isInitialized = true; } }
/// <summary> /// /// </summary> /// <param name="start"></param> /// <param name="end"></param> /// <returns></returns> FrameworkElement CreateTickMark(Point start, Point end, TickLocation location) { // If no template was specified, use the default if (TickTemplate == null) { System.Windows.Shapes.Line ln = new System.Windows.Shapes.Line(); ln.Stroke = new SolidColorBrush(Colors.Black); ln.StrokeThickness = 1.0; ln.X1 = start.X; ln.Y1 = start.Y; ln.X2 = end.X; ln.Y2 = end.Y; return ln; } else { ContentPresenter cp = new ContentPresenter(); //cp.Content = "a"; cp.ContentTemplate = TickTemplate; if (location == TickLocation.Top) { cp.SetValue(Canvas.TopProperty, start.Y - cp.ActualHeight); cp.SetValue(Canvas.LeftProperty, start.X - (cp.ActualWidth / 2)); } else { cp.SetValue(Canvas.TopProperty, end.Y); cp.SetValue(Canvas.LeftProperty, start.X - (cp.ActualWidth / 2)); } return cp; } }
internal override void DrawLineStudy(Types.RectEx rect, LineStatus lineStatus) { double cy = 0; if (rect.IsZero) { return; } if (_lines.Count == 0) { for (int i = 0; i < 4; i++) { Line line = new Line { Tag = this }; Canvas.SetZIndex(line, ZIndexConstants.LineStudies1); _lines.Add(line); C.Children.Add(line); } _internalObjectCreated = true; _chartX.InvokeLineStudyCreated(new StockChartX.LineStudyCreatedEventArgs(this)); } double value = (rect.Bottom - rect.Top) / 3; rect.Bottom += 15; double b = (rect.Top - rect.Bottom) / (rect.Left - rect.Right); double c = rect.Top - b * rect.Left; double cx = C.ActualWidth; cy = (b * cx + c) + cy * 0.3; double y = rect.Top; double x = rect.Left; Utils.DrawLine(x, y, cx, cy, Stroke, StrokeType, StrokeThickness, Opacity, _lines[0]); b = ((rect.Top + value * 1) - rect.Bottom) / (rect.Left - rect.Right); c = (rect.Top + value * 1) - b * rect.Left; cx = C.ActualWidth; cy = (b * cx + c) + cy * 0.5; y = rect.Top; x = rect.Left; Utils.DrawLine(x, y, cx, cy, Stroke, StrokeType, StrokeThickness, Opacity, _lines[1]); b = (rect.Top + value * 2 - rect.Bottom) / (rect.Left - rect.Right); c = rect.Top + value * 2 - b * rect.Left; cx = C.ActualWidth; cy = (b * cx + c) + cy * 0.8; y = rect.Top; x = rect.Left; Utils.DrawLine(x, y, cx, cy, Stroke, StrokeType, StrokeThickness, Opacity, _lines[2]); rect.Bottom -= 15; Utils.DrawLine(rect.Left, rect.Top, rect.Right, rect.Bottom, Stroke, StrokeType, StrokeThickness, Opacity, _lines[3]); if (_contextLine == null) { _contextLine = new ContextLine(this); } }
public static Canvas GenerateLegendPart(int type, int column) { Canvas c = null; // 1 = Symbol if (column == 1) { c = new Canvas(); c.Width = 30; c.Height = 30; } // 2 = Explanation TextBox tb = null; if (column == 2) { c = new Canvas(); c.Width = 140; c.Height = 30; tb = new TextBox(); tb.Width = 138; tb.Height = 28; tb.TextWrapping = System.Windows.TextWrapping.Wrap; tb.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Left; tb.VerticalContentAlignment = System.Windows.VerticalAlignment.Center; tb.IsReadOnly = true; tb.BorderThickness = new System.Windows.Thickness(0); Canvas.SetLeft(tb, 0); Canvas.SetTop(tb, 0); c.Children.Add(tb); } // Self Managed if (column == 1 && c != null && type == 1) { var r = new System.Windows.Shapes.Rectangle(); r.Width = 20; r.Height = 20; r.MinWidth = 20; r.MinHeight = 20; r.Fill = ColorToBrush(AssetSelfManagedColor); r.Stroke = ColorToBrush(DefaultBorderColor); r.Width = 2.0; r.RadiusX = 5; r.RadiusY = 5; Canvas.SetLeft(r, 5); Canvas.SetTop(r, 3); c.Children.Add(r); } if (column == 2 && tb != null && type == 1) { tb.Text = "Entity (self-managed)"; } // Co Managed if (column == 1 && c != null && type == 2) { var r = new System.Windows.Shapes.Rectangle(); r.Width = 20; r.Height = 20; r.MinWidth = 20; r.MinHeight = 20; r.Fill = ColorToBrush(AssetCoManagedColor); r.Stroke = ColorToBrush(DefaultBorderColor); r.Width = 2.0; r.RadiusX = 5; r.RadiusY = 5; Canvas.SetLeft(r, 5); Canvas.SetTop(r, 3); c.Children.Add(r); } if (column == 2 && tb != null && type == 2) { tb.Text = "Entity (co-managed)"; } // Property if (column == 1 && c != null && type == 3) { var r = new System.Windows.Shapes.Rectangle(); r.Width = 20; r.Height = 20; r.MinWidth = 20; r.MinHeight = 20; r.Fill = ColorToBrush(PropertyFillColor); r.Stroke = ColorToBrush(PropertyBorderColor); r.Width = 2.0; r.RadiusX = 0; r.RadiusY = 0; Canvas.SetLeft(r, 5); Canvas.SetTop(r, 3); c.Children.Add(r); } if (column == 2 && tb != null && type == 3) { tb.Text = "Property"; } // Asset if (column == 1 && c != null && type == 4) { var r = new System.Windows.Shapes.Rectangle(); r.Width = 20; r.Height = 20; r.MinWidth = 20; r.MinHeight = 20; r.Fill = ColorToBrush(AssetFillColor); r.Stroke = ColorToBrush(AssetBorderColor); r.Width = 2.0; r.RadiusX = 0; r.RadiusY = 0; Canvas.SetLeft(r, 5); Canvas.SetTop(r, 3); c.Children.Add(r); } if (column == 2 && tb != null && type == 4) { tb.Text = "Asset"; } // Prop Rel if (column == 1 && c != null && type == 5) { var line = new System.Windows.Shapes.Line(); line.X1 = 2; line.Y1 = 15; line.X2 = 28; line.Y2 = 15; line.Stroke = ColorToBrush(PropertyBorderColor); line.StrokeThickness = 2.0; c.Children.Add(line); } if (column == 2 && tb != null && type == 5) { tb.Text = "Property \u2b64 Entity"; } // normal Rel if (column == 1 && c != null && type == 6) { var line = new System.Windows.Shapes.Line(); line.X1 = 2; line.Y1 = 15; line.X2 = 28; line.Y2 = 15; line.Stroke = ColorToBrush(DefaultBorderColor); line.StrokeThickness = 2.0; c.Children.Add(line); } if (column == 2 && tb != null && type == 6) { tb.Text = "Relation"; } // ok if (c != null) { c.Margin = new System.Windows.Thickness(2); } return(c); }
internal override void DrawLineStudy(Types.RectEx rect, LineStatus lineStatus) { if (lineStatus == LineStatus.StartPaint) { for (int i = 0; i < _lines.Length; i++) { _lines[i] = new Line { Tag = this }; Canvas.SetZIndex(_lines[i], ZIndexConstants.LineStudies1); C.Children.Add(_lines[i]); } if (_contextLine == null) { _contextLine = new ContextLine(this); _chartX.InvokeLineStudyCreated(new StockChartX.LineStudyCreatedEventArgs(this)); } return; } // **************************************************************** // *Note: This line study requires OHLC series in the owner panel!* // **************************************************************** rect.Normalize(); if (rect.Width == 0) { return; } int revX1 = (int)(_chartX.GetReverseXInternal(rect.Left) + _chartX._startIndex); int revX2 = (int)(_chartX.GetReverseXInternal(rect.Right) + _chartX._startIndex); if (revX1 < 0) { revX1 = 0; } if (revX2 < 0) { revX2 = 0; } if (revX1 == revX2) { return; } // Get the highest high of the high series. // Note: this code makes the vague assumption // that only one symbol exists on this panel. Series sHigh = GetSeriesOHLC(SeriesTypeOHLC.High); if (sHigh == null) { return; } Series sLow = GetSeriesOHLC(SeriesTypeOHLC.Low); if (sLow == null) { return; } double highestHigh = sHigh.MaxFromInterval(ref revX1, ref revX2); double lowestLow = sLow.MinFromInterval(ref revX1, ref revX2); double value = highestHigh + ((highestHigh - lowestLow) / 4); _linesSel.C = C; _linesSel.Start(); for (int i = 0; i < _lines.Length; i++) { value -= ((highestHigh - lowestLow) / 4); rect.Top = _chartPanel.GetY(value); Utils.DrawLine(rect.Left, rect.Top, rect.Right, rect.Top, Stroke, i == 2 ? LinePattern.Dot : StrokeType, StrokeThickness, Opacity, _lines[i]); } if (lineStatus == LineStatus.Moving || lineStatus == LineStatus.Painting) { Utils.DrawLine(rect.Left, 0, rect.Left, C.ActualHeight, Stroke, LinePattern.Dot, StrokeThickness, Opacity, _linesSel); Utils.DrawLine(rect.Right, 0, rect.Right, C.ActualHeight, Stroke, LinePattern.Dot, StrokeThickness, Opacity, _linesSel); } _linesSel.Stop(); _internalObjectCreated = true; _linesSel.Do(l => l.ZIndex = ZIndexConstants.LineStudies1); }
public override void PostprocessMouseMove(System.Windows.Input.MouseEventArgs e) { try { if (this._isMouseDown && (e.RightButton == System.Windows.Input.MouseButtonState.Pressed)) { string lineColor = Umc.Core.Tools.VSGesture.Services.VSGestureService.Current.VSGestureInfo.UserSettings.LineColor; string lineThickness = Umc.Core.Tools.VSGesture.Services.VSGestureService.Current.VSGestureInfo.UserSettings.LineThickness; string[] strArray = lineColor.Split(new char[] { ',' }); Point position = e.GetPosition(this._view.VisualElement); Brush brush = new SolidColorBrush(Color.FromRgb(byte.Parse(strArray[0]), byte.Parse(strArray[1]), byte.Parse(strArray[2]))); this._analyzer.Add(new System.Windows.Input.StylusPoint(position.X, position.Y)); this._layer = this._view.GetAdornmentLayer("VSGestureWindow"); var adornment = new System.Windows.Shapes.Line { X1 = this._preX, Y1 = this._preY, X2 = position.X + this._view.ViewportLeft, Y2 = position.Y + this._view.ViewportTop, StrokeThickness = (float)((Umc.Core.Tools.VSGesture.Controls.LineThicknessStyle)Enum.Parse(typeof(Umc.Core.Tools.VSGesture.Controls.LineThicknessStyle), lineThickness)), Stroke = brush }; this._layer.AddAdornment(AdornmentPositioningBehavior.ViewportRelative, null, null, adornment, null); this._preX = position.X + this._view.ViewportLeft; this._preY = position.Y + this._view.ViewportTop; } } catch (Exception exception) { MessageBox.Show(exception.Message); } base.PostprocessMouseMove(e); }