当前位置: 首页>>代码示例>>C#>>正文


C# Point.DataToScreen方法代码示例

本文整理汇总了C#中System.Windows.Point.DataToScreen方法的典型用法代码示例。如果您正苦于以下问题:C# Point.DataToScreen方法的具体用法?C# Point.DataToScreen怎么用?C# Point.DataToScreen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Point的用法示例。


在下文中一共展示了Point.DataToScreen方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnRenderCore

		protected override void OnRenderCore(DrawingContext dc, RenderState state)
		{
			if (DataSource == null) return;
			if (Marker == null) return;

			var transform = Plotter2D.Viewport.Transform;

			DataRect bounds = DataRect.Empty;
			using (IPointEnumerator enumerator = DataSource.GetEnumerator(GetContext()))
			{
				Point point = new Point();
				while (enumerator.MoveNext())
				{
					enumerator.GetCurrent(ref point);
					enumerator.ApplyMappings(Marker);

					//Point screenPoint = point.Transform(state.Visible, state.Output);
					Point screenPoint = point.DataToScreen(transform);

					bounds = DataRect.Union(bounds, point);
					Marker.Render(dc, screenPoint);
				}
			}

			Viewport2D.SetContentBounds(this, bounds);
		}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:26,代码来源:MarkerPointsGraph.cs

示例2: OnRenderCore

		protected override void OnRenderCore(DrawingContext dc, RenderState state)
		{
			if (DataSource == null)
			{
				markers.Clear();
				canvas.Children.Clear();
				return;
			}

			if (Marker == null) return;

			var transform = Viewport.Transform;

			if (markers.Count == 0)
			{
				Rect bounds = Rect.Empty;
				using (IPointEnumerator enumerator = DataSource.GetEnumerator(GetContext()))
				{
					Point point = new Point();
					while (enumerator.MoveNext())
					{
						enumerator.GetCurrent(ref point);
						enumerator.ApplyMappings(Marker);

						Point screenPoint = point.DataToScreen(transform);
						if (!screenPoint.IsFinite())
							continue;

						bounds = Rect.Union(bounds, point);
						UIElement marker = Marker.CreateMarker();
						Marker.SetPosition(marker, screenPoint);

						// todo было раскомментировано. Сделать хранение маркеров и добавление их на плоттер.
						canvas.Children.Add(marker);
						markers.Add(marker);
					}
				}
				ContentBounds = bounds;
			}
			else
			{
				int index = 0;
				using (IPointEnumerator enumerator = DataSource.GetEnumerator(GetContext()))
				{
					Point point = new Point();
					while (enumerator.MoveNext())
					{
						enumerator.GetCurrent(ref point);
						Point screenPoint = point.DataToScreen(transform);
						Marker.SetPosition(markers[index++], screenPoint);
					}
				}
			}
		}
开发者ID:BdGL3,项目名称:CXPortal,代码行数:54,代码来源:MarkerElementPointGraph.cs

示例3: OnRenderCore

        protected override void OnRenderCore(DrawingContext dc, RenderState state)
        {
            if (Marker == null)
                return;

            if (DataSource == null) // No data is specified
            {
                if (canvas != null)
                {
                    foreach (UIElement child in canvas.Children)
                        unused.Add(child);
                    canvas.Children.Clear();
                }
            }
            else // There is some data
            {

                int index = 0;
                var transform = GetTransform();
                using (IPointEnumerator enumerator = DataSource.GetEnumerator(GetContext()))
                {
                    Point point = new Point();

                    DataRect bounds = DataRect.Empty;

                    while (enumerator.MoveNext())
                    {
                        enumerator.GetCurrent(ref point);
                        enumerator.ApplyMappings(Marker);

                        if (index >= canvas.Children.Count)
                        {
                            UIElement newMarker;
                            if (unused.Count > 0)
                            {
                                newMarker = unused[unused.Count - 1];
                                unused.RemoveAt(unused.Count - 1);
                            }
                            else
                                newMarker = Marker.CreateMarker();
                            canvas.Children.Add(newMarker);
                        }

                        Marker.SetMarkerProperties(canvas.Children[index]);
                        bounds.Union(point);
                        Point screenPoint = point.DataToScreen(transform);
                        Marker.SetPosition(canvas.Children[index], screenPoint);
                        index++;
                    }

                    Viewport2D.SetContentBounds(this, bounds);

                    while (index < canvas.Children.Count)
                    {
                        unused.Add(canvas.Children[index]);
                        canvas.Children.RemoveAt(index);
                    }
                }
            }
        }
开发者ID:modulexcite,项目名称:DynamicDataDisplay,代码行数:60,代码来源:MarkerElementPointGraph.cs

示例4: DataChangeStatus

        void DataChangeStatus()
        {
            if (LeftIsPlaying && RightIsPlaying)
            {
                #region customizeTime
                if (RightVideo.Position.Seconds < 10)
                    DataSec = "0" + RightVideo.Position.Seconds.ToString();
                else
                    DataSec = RightVideo.Position.Seconds.ToString();
                if (RightVideo.Position.Minutes < 10)
                    DataMin = "0" + RightVideo.Position.Minutes.ToString();
                else
                    DataMin = RightVideo.Position.Minutes.ToString();

                if (RightVideo.Position.Hours < 10)
                    DataHours = "0" + RightVideo.Position.Hours.ToString();
                else
                    DataHours = RightVideo.Position.Hours.ToString();

                #endregion customizeTime

                var Transform = Plotter.Viewport.Transform;
                System.Windows.Point CurrentPosition = new System.Windows.Point(RightVideo.Position.TotalMilliseconds, 0);

                if (GraphLine.Visibility == Visibility.Hidden)
                {
                    GraphLine.Visibility = Visibility.Visible;
                }
                if (!hasTicked)
                {
                    Canvas.SetLeft(GraphLine, 113);
                    hasTicked = true;
                }
                //var mouseScreenPosition = Mouse.GetPosition(Plotter.CentralGrid);
                //var mousePositionInData = mouseScreenPosition.ScreenToData(Transform);
                double screenPos = 0;
                if (ZoomedIn)
                {
                    screenPos = ((CurrentPosition.DataToScreen(Transform).X) / 1000) - 2*Math.Abs(xMinWindowWhenZoomed);
                    //System.Diagnostics.Debug.WriteLine("ZoomedIn, position: " + screenPos + ", xclick: " + xValue + ", current: " + CurrentPosition);

                }
                else if(!ZoomedIn)
                {
                    screenPos = (CurrentPosition.DataToScreen(Transform).X) / 1000;
                    //System.Diagnostics.Debug.WriteLine("ZoomedOut, position: " + screenPos);
                }
                //Canvas.SetLeft(GraphLine, 60 + mouseScreenPosition.X);
                Canvas.SetLeft(GraphLine, 113 + screenPos);
                if (ZoomedIn)
                {
                    mouseScreenPosition.X += 12.02;
                }
                else if (!ZoomedIn)
                {
                    mouseScreenPosition.X += 6.01;
                }

                DataSeekSlider.Value = RightVideo.Position.TotalMilliseconds;
                if (RightVideo.Position.Hours == 0)
                {
                    DataCurrentTimeTextBlock.Text = DataMin + ":" + DataSec;
                }
                else
                {
                    DataCurrentTimeTextBlock.Text = DataHours + ":" + DataMin + ":" + DataSec;
                }
            }
        }
开发者ID:stiggybr0,项目名称:BiometricStoryboard,代码行数:69,代码来源:MainWindow.xaml.cs


注:本文中的System.Windows.Point.DataToScreen方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。