コード例 #1
3
ファイル: TestControl.cs プロジェクト: pascalfr/MPfm
        public void CreateBitmap()
        {
            int width = 100;
            int height = 100;
            int dpi = 96;

            Tracing.Log(">> CreateBitmap");
            var thread = new Thread(new ThreadStart(() => 
            {
                Tracing.Log(">> CreateBitmap - Thread start; creating drawing visual");
                //Dispatcher.Invoke(new Action(() => {
                _drawingVisual = new DrawingVisual();
                _drawingContext = _drawingVisual.RenderOpen();
                //}));

                Tracing.Log(">> CreateBitmap - Drawing to context");
                _drawingContext.DrawRectangle(new SolidColorBrush(Colors.HotPink), new Pen(), new Rect(0, 0, 50, 50));
                _drawingContext.DrawRectangle(new SolidColorBrush(Colors.Blue), new Pen(), new Rect(50, 0, 50, 50));
                _drawingContext.DrawRectangle(new SolidColorBrush(Colors.Orange), new Pen(), new Rect(0, 50, 50, 50));
                _drawingContext.DrawRectangle(new SolidColorBrush(Colors.DarkRed), new Pen(), new Rect(50, 50, 50, 50));
                _drawingContext.Close();

                Tracing.Log(">> CreateBitmap - Finished drawing; creating render target bitmap");
                _bitmap = new RenderTargetBitmap(width, height, dpi, dpi, PixelFormats.Default);
                _bitmap.Render(_drawingVisual);
                Tracing.Log(">> CreateBitmap - Finished work");
                _bitmap.Freeze();
            }));
            //thread.IsBackground = true;
            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();
        }
コード例 #2
1
		protected override void OnRender(DrawingContext drawingContext)
		{
			Size renderSize = this.RenderSize;
			TextView textView = this.TextView;
			
			if (textView != null && textView.VisualLinesValid) {
				foreach (VisualLine line in textView.VisualLines) {
					Rect rect = new Rect(0, line.VisualTop - textView.ScrollOffset.Y, 5, line.Height);
					
					LineChangeInfo info = changeWatcher.GetChange(line.FirstDocumentLine.LineNumber);
					
					switch (info.Change) {
						case ChangeType.None:
							break;
						case ChangeType.Added:
							drawingContext.DrawRectangle(Brushes.LightGreen, null, rect);
							break;
						case ChangeType.Deleted:
						case ChangeType.Modified:
							drawingContext.DrawRectangle(Brushes.LightBlue, null, rect);
							break;
						case ChangeType.Unsaved:
							drawingContext.DrawRectangle(Brushes.Yellow, null, rect);
							break;
						default:
							throw new Exception("Invalid value for ChangeType");
					}
				}
			}
		}
コード例 #3
1
        private static void RenderClippedEdges(Skeleton skeleton, DrawingContext drawingContext)
        {
            if (skeleton.ClippedEdges.HasFlag(FrameEdges.Bottom))
            {
                drawingContext.DrawRectangle(
                    Brushes.Red,
                    null,
                    new Rect(0, RenderHeight - ClipBoundsThickness, RenderWidth, ClipBoundsThickness));
            }

            if (skeleton.ClippedEdges.HasFlag(FrameEdges.Top))
            {
                drawingContext.DrawRectangle(
                    Brushes.Red,
                    null,
                    new Rect(0, 0, RenderWidth, ClipBoundsThickness));
            }

            if (skeleton.ClippedEdges.HasFlag(FrameEdges.Left))
            {
                drawingContext.DrawRectangle(
                    Brushes.Red,
                    null,
                    new Rect(0, 0, ClipBoundsThickness, RenderHeight));
            }

            if (skeleton.ClippedEdges.HasFlag(FrameEdges.Right))
            {
                drawingContext.DrawRectangle(
                    Brushes.Red,
                    null,
                    new Rect(RenderWidth - ClipBoundsThickness, 0, ClipBoundsThickness, RenderHeight));
            }
        }
コード例 #4
1
		private void DrawChanges(DrawingContext drawingContext, NormalizedSnapshotSpanCollection changes, Brush brush)
		{
			if (changes.Count > 0)
			{
				double yTop = Math.Floor(_scrollBar.GetYCoordinateOfBufferPosition(changes[0].Start)) + markerStartOffset;
				double yBottom = Math.Ceiling(_scrollBar.GetYCoordinateOfBufferPosition(changes[0].End)) + markerEndOffset;

				for (int i = 1; i < changes.Count; ++i)
				{
					double y = _scrollBar.GetYCoordinateOfBufferPosition(changes[i].Start) + markerStartOffset;
					if (yBottom < y)
					{
						drawingContext.DrawRectangle(
							brush,
							null,
							new Rect(0, yTop, markerWidth, yBottom - yTop));

						yTop = y;
					}

					yBottom = Math.Ceiling(_scrollBar.GetYCoordinateOfBufferPosition(changes[i].End)) + markerEndOffset;
				}

				drawingContext.DrawRectangle(
					brush,
					null,
					new Rect(0, yTop, markerWidth, yBottom - yTop));
			}
		}
コード例 #5
1
        protected override void OnRender(DrawingContext drawingContext)
        {
            Rect rect = new Rect(startPoint, endPoint);
            rect.Offset(-0.5d, -0.5d);

            drawingContext.DrawRectangle(fill, stroke, rect);
        }
コード例 #6
1
 protected override void DrawTile(DrawingContext dc, Rect TileRect)
 {
     if (!_tileImage.IsReady)
         dc.DrawRectangle(Brushes.LemonChiffon, null, TileRect);
     else
         dc.DrawImage(_tileImage.Image, TileRect);
 }
コード例 #7
0
        protected override void OnRender(DrawingContext drawingContext)
        {
            ScreenReplicator replicator = Visual as ScreenReplicator;
            if (replicator != null)
            {                
                if (replicator.IsRunning)
                {
                    if (replicator.IsReplicating)
                    {
                        _screenBrush = CreateImageBrush(replicator);
                    }
                    else if (replicator.BlankOnStop)
                    {
                        _screenBrush = null;
                    }

                    if (_screenBrush != null)
                    {
                        drawingContext.DrawRectangle(_screenBrush, null, _displayRect);
                    }
                }
                else
                {
                    drawingContext.DrawRectangle(null, _inactivePen, _displayRect);
                    _inactiveTextFormat.RenderText(drawingContext, _inactiveBrush, "Screen Replicator", _displayRect);
                }
            }
        }
コード例 #8
0
 protected override void OnRender(DrawingContext drawingContext)
 {
     var torrent = DataContext as PeriodicTorrent;
     if (torrent == null)
     {
         drawingContext.DrawRectangle(null, new Pen(Brushes.DarkGray, 1), new Rect(0, 0, this.ActualWidth, this.ActualHeight));
         return;
     }
     var pieces = torrent.RecievedPieces;
     if (pieces == null)
     {
         drawingContext.DrawRectangle(null, new Pen(Brushes.DarkGray, 1), new Rect(0, 0, this.ActualWidth, this.ActualHeight));
         return;
     }
     double width = ActualWidth / pieces.Length;
     int increment = (int)(1 / width);
     if (increment == 0) increment = 1;
     for (int i = 0; i < pieces.Length; i += increment)
     {
         if (pieces[i])
         {
             drawingContext.DrawRectangle(Brushes.LightGreen, null,
                 new Rect(Math.Ceiling(i * width), 0, Math.Ceiling(width), ActualHeight));
         }
         else
             drawingContext.DrawRectangle(Background, null,
                 new Rect(Math.Ceiling(i * width), 0, Math.Ceiling(width), ActualHeight));
     }
     drawingContext.DrawRectangle(null, new Pen(Brushes.DarkGray, 1), new Rect(0, 0, this.ActualWidth, this.ActualHeight));
     base.OnRender(drawingContext);
 }
コード例 #9
0
ファイル: DropAdorner.cs プロジェクト: BadKarmaZen/WireMe
        protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
        {
            //if (!(_target is IScreen))
            {
                if (_isOpening)
                {
                    SolidColorBrush fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#2200FF00"));
                    drawingContext.DrawRectangle(fill, null, new Rect(0, 0, ActualWidth, ActualHeight));
                }
                else
                {
                    SolidColorBrush fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#050000FF"));
                    drawingContext.DrawRectangle(fill, null, new Rect(0, 0, ActualWidth, ActualHeight));
                }

                if (_canDrop)
                {
                    SolidColorBrush border = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#CCFFFFFF"));
                    SolidColorBrush dot    = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#CC0000FF"));

                    RenderOptions.SetEdgeMode(this, EdgeMode.Unspecified);
                    drawingContext.DrawEllipse(border, null, new Point(0, 0), RADIUS + BORDER, RADIUS + BORDER);
                    drawingContext.DrawEllipse(border, null, new Point(0, ActualHeight), RADIUS + BORDER, RADIUS + BORDER);
                    drawingContext.DrawEllipse(border, null, new Point(ActualWidth, 0), RADIUS + BORDER, RADIUS + BORDER);
                    drawingContext.DrawEllipse(border, null, new Point(ActualWidth, ActualHeight), RADIUS + BORDER, RADIUS + BORDER);

                    drawingContext.DrawEllipse(dot, null, new Point(0, 0), RADIUS, RADIUS);
                    drawingContext.DrawEllipse(dot, null, new Point(0, ActualHeight), RADIUS, RADIUS);
                    drawingContext.DrawEllipse(dot, null, new Point(ActualWidth, 0), RADIUS, RADIUS);
                    drawingContext.DrawEllipse(dot, null, new Point(ActualWidth, ActualHeight), RADIUS, RADIUS);
                }
            }
        }
コード例 #10
0
ファイル: HpBarView.cs プロジェクト: MadBuldog/lokpok
 protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
 {
     base.OnRender(drawingContext);
     drawingContext.DrawRectangle(new SolidColorBrush(Colors.Red), new Pen(new SolidColorBrush(Colors.Black), 1), new Rect(new Size(this.Width, this.Height)));
     drawingContext.DrawRectangle(new SolidColorBrush(Colors.Green), new Pen(new SolidColorBrush(Colors.Black), 1), new Rect(new Size(this.Width * Health, this.Height)));
     drawingContext.DrawText(new FormattedText(_name, System.Globalization.CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface("Arial"), 10, new SolidColorBrush(Colors.White)), new Point(0, 0));
 }
コード例 #11
0
 protected override void OnRender(DrawingContext dc)
 {
     base.OnRender(dc);
     dc.DrawRectangle(Brushes.Transparent, null, new Rect(RenderSize));
     if (this.startPoint.HasValue && this.endPoint.HasValue)
         dc.DrawRectangle(Brushes.Transparent, rubberbandPen, new Rect(this.startPoint.Value, this.endPoint.Value));
 }
コード例 #12
0
 protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
 {
     drawingContext.DrawRectangle(Brushes.Red, null, new System.Windows.Rect(0, 0, 5, 5));
     drawingContext.DrawRectangle(Brushes.Red, null, new System.Windows.Rect(0, ActualHeight - 5, 5, 5));
     drawingContext.DrawRectangle(Brushes.Red, null, new System.Windows.Rect(ActualWidth - 5, 0, 5, 5));
     drawingContext.DrawRectangle(Brushes.Red, null, new System.Windows.Rect(ActualWidth - 5, ActualHeight - 5, 5, 5));
 }
コード例 #13
0
ファイル: TilesetCanvas.cs プロジェクト: chubbyerror/Gibbo2D
        protected override void OnRender(System.Windows.Media.DrawingContext dc)
        {
            base.OnRender(dc);

            try
            {
                int cx = (int)Width / brushSizeX;
                int cy = (int)Height / brushSizeY;

                // draw vertical lines:
                for (int i = 0; i <= cx; i++)
                {
                    dc.DrawLine(penGrid, new Point(i * brushSizeX, 0), new Point(i * brushSizeX, Height));
                }

                // draw horizontal lines:
                for (int i = 0; i <= cy; i++)
                {
                    dc.DrawLine(penGrid, new Point(0, i * brushSizeY), new Point(Width, i * brushSizeY));
                }

                // draw selection:
                if (selection.Width > 0 && selection.Height > 0)
                {
                    dc.DrawRectangle(Brushes.Transparent, penBlack, selection);
                    dc.DrawRectangle(Brushes.Transparent, penWhite, selection);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
コード例 #14
0
ファイル: PointMatrix.cs プロジェクト: ppiotrowicz/Pomidoro
        protected override void OnRender(DrawingContext dc)
        {
            var inColumns = PointsInColumn();
            var inRows = PointsInRow();

            var noOfPoints = inColumns*inRows;

            int finishedPoints = (int) (Progress*noOfPoints);
            int currentPoint = 0;

            for (int rowIndex = 0; rowIndex < inRows; rowIndex++)
            {
                for (int columnIndex = 0; columnIndex < inColumns; columnIndex++)
                {
                    currentPoint++;

                    var point = new Point((columnIndex + 1)*Spacing + columnIndex*PointSize, Spacing * (rowIndex+1) + rowIndex*PointSize);
                    if (currentPoint > finishedPoints)
                    {
                        dc.DrawRectangle(PendingBrush, null, new Rect(point, new Size(PointSize, PointSize)));
                    }
                    else
                    {
                        dc.DrawRectangle(FinishedBrush, null, new Rect(point, new Size(PointSize, PointSize)));
                    }
                }
            }
        }
コード例 #15
0
 protected override void OnRender(DrawingContext drawingContext)
 {
     Rect rect = new Rect(-1, -1, this.ActualWidth + 2.0, this.ActualHeight + 2.0);
     drawingContext.DrawRectangle(Background, null, rect);
     rect = new Rect(1.0, 1.0, this.ActualWidth + 2.0, this.ActualHeight + 2.0);
     drawingContext.DrawRectangle(Shadow, null, rect);
 }
コード例 #16
0
 static void DrawConnectionPoint(ConnectionPoint connPoint, Point actualLocation, Brush renderBrush, Pen renderPen, DrawingContext drawingContext)
 {
     // actualLocation is the point on the Edge with respect to the coordinate system defined by the top left corner of the adorned element
     // We will need this transparent rectangle to make sure OnMouseOver event can be triggered, for hit test.
     drawingContext.DrawRectangle(Brushes.Transparent, new Pen(Brushes.Transparent, 0),
         new Rect(actualLocation + connPoint.HitTestOffset, connPoint.HitTestSize));
     drawingContext.DrawRectangle(renderBrush, renderPen,
         new Rect(actualLocation + connPoint.DrawingOffset, connPoint.DrawingSize));
 }
コード例 #17
0
 protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
 {
     System.Windows.Media.Media3D.Size3D size = (agentBase as BusAgent).Size;
     drawingContext.PushTransform(new TranslateTransform(Location.X - size.X / 4, Location.Y));
     drawingContext.PushTransform(new RotateTransform((agentBase as BusAgent).Angle));
     drawingContext.DrawRectangle(GetGroupColor(agentBase.Group), null, new Rect(-size.X / 4, -size.Y / 2, size.X, size.Y));
     drawingContext.DrawRectangle(Brushes.LightBlue, null, new Rect(size.X / 4 * 3 - 2, -size.Y / 2, 2, size.Y));
     drawingContext.Pop();
     drawingContext.Pop();
 }
コード例 #18
0
ファイル: DrawUtil.cs プロジェクト: kunukn/single-detect
        public static void RedrawDots(DrawingContext dc, ICollection<IP> dots, Rectangle rect, ShapeType t = ShapeType.Default)
        {
            if (!IsDrawEnabled) return;

            foreach (var p in dots.Where(p => p != null))
            {
                dc.DrawRectangle(Pens.BackgroundColor, null, GetShape(p, rect, t));
                dc.DrawRectangle(GetColor(p, ShapeType.Default), null, GetShape(p, rect, ShapeType.Default));
            }
        }
コード例 #19
0
		public static void PaintBackground(this Altaxo.Worksheet.ColumnStyle thiss, DrawingContext dc, RectangleD2D cellRectangle, bool bSelected)
		{
			var cellRect = cellRectangle.ToWpf();
			if (bSelected)
				dc.DrawRectangle(thiss.DefaultSelectedBackgroundBrush.ToWpf(), null, cellRect);
			else
				dc.DrawRectangle(thiss.BackgroundBrush.ToWpf(), null, cellRect);

			dc.DrawLine(thiss.CellBorder.ToWpf(), cellRect.BottomLeft, cellRect.BottomRight);
			dc.DrawLine(thiss.CellBorder.ToWpf(), cellRect.BottomRight, cellRect.TopRight);
		}
コード例 #20
0
ファイル: PongGame.cs プロジェクト: itsbth/E2Edit
 protected override void OnRender(DrawingContext drawingContext)
 {
     drawingContext.DrawRectangle(Brushes.Red, new Pen(), new Rect(5, _playerPaddlePos - 20, 10, 40));
     drawingContext.DrawRectangle(Brushes.Red, new Pen(),
                                  new Rect(RenderSize.Width - 7.5, _computerPaddlePos - 20, 10, 40));
     drawingContext.DrawEllipse(Brushes.WhiteSmoke, new Pen(), _ballPos, 5, 5);
     drawingContext.DrawText(
         new FormattedText(String.Format("{0} - {1}", _playerScore, _computerScore), CultureInfo.CurrentCulture, FlowDirection.LeftToRight,
                           new Typeface("Courier New"), 12, Brushes.White), new Point(RenderSize.Width / 2, 10));
     base.OnRender(drawingContext);
 }
コード例 #21
0
 protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
 {
     if (_before)
     {
         drawingContext.DrawRectangle(System.Windows.Media.Brushes.Gray, null, new System.Windows.Rect(0, 0, ActualWidth, 3));
     }
     else
     {
         drawingContext.DrawRectangle(System.Windows.Media.Brushes.Gray, null, new System.Windows.Rect(0, ActualHeight - 3, ActualWidth, 3));
     }
 }
コード例 #22
0
ファイル: RubberbandAdorner.cs プロジェクト: ssickles/archive
        protected override void OnRender(DrawingContext dc)
        {
            base.OnRender(dc);

            // without a background the OnMouseMove event would not be fired!
            // Alternative: implement a Canvas as a child of this adorner, like
            // the ConnectionAdorner does.
            dc.DrawRectangle(Brushes.Transparent, null, new Rect(RenderSize));

            if (this.startPoint.HasValue && this.endPoint.HasValue)
                dc.DrawRectangle(Brushes.Transparent, rubberbandPen, new Rect(this.startPoint.Value, this.endPoint.Value));
        }
コード例 #23
0
ファイル: MyCanvas.cs プロジェクト: Yariki/ShareScreen
 protected override void OnRender(DrawingContext drawingContext)
 {
     base.OnRender(drawingContext);
     drawingContext.DrawRectangle(Brushes.Red, new Pen(Brushes.Blue, 2), new Rect(new Point(10, 10), new Size(100, 100)));
     if (_startPoint.HasValue && _endPoint.HasValue)
     {
         drawingContext.DrawRectangle(Brushes.Aqua, new Pen(Brushes.Blue, 1), new Rect(_startPoint.Value, _endPoint.Value));
         System.Diagnostics.Debug.WriteLine("Render");
         System.Diagnostics.Debug.WriteLine(_startPoint.Value.ToString() + " : " + _endPoint.Value.ToString());
     }
     System.Diagnostics.Debug.WriteLine("Render");
 }
コード例 #24
0
        protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
        {
            if (!SkipFill && _backgroundFillBrush != null)
            {
                drawingContext.DrawRectangle(_backgroundFillBrush, null, _monitorRect);
            }

            if (_backgroundImageBrush != null)
            {
                drawingContext.DrawRectangle(_backgroundImageBrush, null, _monitorRect);
            }
        }
コード例 #25
0
        protected override void OnRender(DrawingContext dc)
        {
            base.OnRender(dc);

            // Without a background the OnMouseMove event would not be fired!
            // Alternative: implement a Canvas as a child of this adorner, like
            // the ConnectionAdorner does.
            dc.DrawRectangle(Brushes.Transparent, null, new Rect(RenderSize));

            if (this.startPoint.HasValue && this.endPoint.HasValue)
                dc.DrawRectangle(new SolidColorBrush(new Color() {R = 0, G = 122, B = 204, A = 25}), selectionBoxPen,
                                 new Rect(this.startPoint.Value, this.endPoint.Value));
        }
コード例 #26
0
        protected override void OnRender(DrawingContext dc)
        {
            Console.WriteLine("OnRender");

            dc.DrawRectangle(Brushes.White, null, new Rect(0, 0, ActualWidth, ActualHeight));

            var intersection = OldSize;
            intersection.Intersect(NewSize);

            dc.DrawRectangle(Brushes.LightGreen, null, NewSize);
            dc.DrawRectangle(Brushes.Gray, null, intersection);
            dc.DrawRectangle(Brushes.Pink, null, OldSize);
        }
コード例 #27
0
		protected override void OnRender(DrawingContext drawingContext)
		{
			Size renderSize = this.RenderSize;
			TextView textView = this.TextView;
			
			if (textView != null && textView.VisualLinesValid) {
				foreach (VisualLine line in textView.VisualLines) {
					Rect rect = new Rect(0, line.VisualTop - textView.ScrollOffset.Y, 5, line.Height);
					
					LineChangeInfo info = changeWatcher.GetChange(line.FirstDocumentLine.LineNumber);
					
					switch (info.Change) {
						case ChangeType.None:
							break;
						case ChangeType.Added:
							drawingContext.DrawRectangle(Brushes.LightGreen, null, rect);
							break;
						case ChangeType.Modified:
							drawingContext.DrawRectangle(Brushes.LightBlue, null, rect);
							break;
						case ChangeType.Unsaved:
							drawingContext.DrawRectangle(Brushes.Yellow, null, rect);
							break;
						default:
							throw new Exception("Invalid value for ChangeType");
					}
					
//					if (!string.IsNullOrEmpty(info.DeletedLinesAfterThisLine)) {
//						Point pt1 = new Point(5,  line.VisualTop + line.Height - textView.ScrollOffset.Y - 4);
//						Point pt2 = new Point(10, line.VisualTop + line.Height - textView.ScrollOffset.Y);
//						Point pt3 = new Point(5,  line.VisualTop + line.Height - textView.ScrollOffset.Y + 4);
//
//						drawingContext.DrawGeometry(Brushes.Red, null, new PathGeometry(new List<PathFigure>() { CreateNAngle(pt1, pt2, pt3) }));
//					}
//
//					// special case for line 0
//					if (line.FirstDocumentLine.LineNumber == 1) {
//						info = changeWatcher.GetChange(0);
//
//						if (!string.IsNullOrEmpty(info.DeletedLinesAfterThisLine)) {
//							Point pt1 = new Point(5,  line.VisualTop - textView.ScrollOffset.Y - 4);
//							Point pt2 = new Point(10, line.VisualTop - textView.ScrollOffset.Y);
//							Point pt3 = new Point(5,  line.VisualTop - textView.ScrollOffset.Y + 4);
//
//							drawingContext.DrawGeometry(Brushes.Red, null, new PathGeometry(new List<PathFigure>() { CreateNAngle(pt1, pt2, pt3) }));
//						}
//					}
				}
			}
		}
コード例 #28
0
        /// <summary>
        /// Participates in rendering operations.
        /// </summary>
        /// <param name="drawingContext">The drawing instructions for a specific element. This context is provided to the layout system.</param>
        protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
        {
            base.OnRender(drawingContext);

            // Border
            Rect r = new Rect(0, 0, ColumnCount * CellLength, RowCount * CellLength);

            drawingContext.DrawRectangle(LightFill, _darkPen, r);

            StreamGeometry darkGeometry = new StreamGeometry();

            // StreamGeometry lightGeometry = new StreamGeometry();
            using (StreamGeometryContext darkContext = darkGeometry.Open())
            {
                // using (StreamGeometryContext lightContext = lightGeometry.Open())
                for (int i = 0; i < ColumnCount; i++)
                {
                    for (int j = 0; j < RowCount; j++)
                    {
                        if (((i % 2 == 0) && (j % 2 == 0)) ||
                            ((i % 2 == 1) && (j % 2 == 1)))
                        {
                            CreateFigure(i * CellLength, j * CellLength, darkContext);
                        }
                        //else
                        //{
                        //    CreateFigure(i * CellLength, j * CellLength, lightContext);
                        //}
                    }
                }
            }
            darkGeometry.Freeze();
            drawingContext.DrawGeometry(DarkFill, null, darkGeometry);
        }
コード例 #29
0
        protected override void OnRender(DrawingContext dc)
        {
            Point p = _location;
            p.Offset(-_offset.X, -_offset.Y);

            dc.DrawRectangle(_vbrush, null, new Rect(p, this.RenderSize));
        }
コード例 #30
0
        public void Draw(TextView textView, DrawingContext drawingContext)
        {
            textView.EnsureVisualLines();

            #region Highlight Error Tokens

            var errorsToVisualize = _solution.ErrorService.GetErrorsFromDocument(_codeitem);

            foreach(var err in errorsToVisualize) {
                if(err.Range != null) {
                    foreach(Rect r in BackgroundGeometryBuilder.GetRectsForSegment(textView, err.Range)) {
                        //drawingContext.DrawRectangle(null, _errorPen, r);
                        drawingContext.DrawLine(_errorPen, r.BottomLeft, r.BottomRight);
                    }
                } else {

                    var line = _editor.Document.GetLineByNumber(err.StartLine);
                    if(line != null) {
                        var segment = new TextSegment { StartOffset = line.Offset, EndOffset = line.EndOffset };

                        foreach(Rect r in BackgroundGeometryBuilder.GetRectsForSegment(textView, segment)) {
                            drawingContext.DrawRectangle(_errorBrush, _errorPen, r);
                        }
                    }
                }
            }

            #endregion
        }
コード例 #31
0
ファイル: UniverseView.xaml.cs プロジェクト: ismaweb/evolvers
        protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
        {
            base.OnRender(drawingContext);

            SolidColorBrush blackBrush = new SolidColorBrush(Color.FromRgb(0, 0, 0));
            SolidColorBrush greenBrush = new SolidColorBrush(Color.FromRgb(0, 128, 0));
            SolidColorBrush redBrush   = new SolidColorBrush(Color.FromRgb(200, 0, 0));
            Pen             blackPen   = new Pen(blackBrush, 1);
            Pen             greenPen   = new Pen(greenBrush, 1);
            Pen             redPen     = new Pen(redBrush, 1);

            drawingContext.DrawRectangle(null, blackPen, _size);



            if (Universe == null)
            {
                return;
            }

            foreach (FoodElement element in Universe.Food)
            {
                drawingContext.DrawEllipse(null, greenPen, new Point(element.CenterX, element.CenterY), element.Width, element.Width);
            }

            foreach (CreatureElement creature in Universe.Creatures)
            {
                drawingContext.DrawEllipse(null, redPen, new Point(creature.CenterX, creature.CenterY), creature.Width, creature.Width);
            }
        }
コード例 #32
0
        /// <summary>
        /// Draw the legend item
        /// </summary>
        /// <param name="dc">DrawingContext on which to draw</param>
        /// <param name="position">The position on the drawing context to draw relative to.</param>
        public override void Draw(System.Windows.Media.DrawingContext dc, System.Windows.Point position)
        {
            Pen linePen = new Pen(Brushes.Black, 1.0);

            dc.DrawRectangle(_fill, linePen, new Rect((int)position.X + 2, (int)position.Y + 2, 28, (int)Dimensions.Height - 4));
            dc.DrawText(_formattedText, new Point(38 + position.X, 2 + position.Y));
        }
コード例 #33
0
        protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
        {
            RotarySwitch rotarySwitch = Visual as RotarySwitch;

            if (rotarySwitch != null)
            {
                if (rotarySwitch.DrawLines)
                {
                    drawingContext.DrawDrawing(_lines);
                }
                foreach (SwitchPositionLabel label in _labels)
                {
                    drawingContext.DrawText(label.Text, label.Location);
                }

                drawingContext.PushTransform(new RotateTransform(rotarySwitch.KnobRotation, _center.X, _center.Y));
                drawingContext.DrawRectangle(_imageBrush, null, _imageRect);
                if (rotarySwitch.VisualizeDragging)
                {
                    double length = (rotarySwitch.DragPoint - _center).Length;
                    drawingContext.DrawLine(HeadingPen, _center, _center + new Vector(0d, -length));
                }
                drawingContext.Pop();

                if (rotarySwitch.VisualizeDragging)
                {
                    drawingContext.DrawLine(DragPen, _center, rotarySwitch.DragPoint);
                }
            }
        }
コード例 #34
0
        void RenderSelectedScopes(System.Windows.Media.DrawingContext drawingContext)
        {
            foreach (SelectedScope scope in selectedScopes)
            {
                if (Math.Abs(scope.Start - scope.Finish) < 1e-6)
                {
                    continue;
                }

                double pos0 = Math.Min(scope.Start, scope.Finish);
                double pos1 = Math.Max(scope.Start, scope.Finish);

                double posStart  = TimeLineToDrawSpace(pos0);
                double posFinish = TimeLineToDrawSpace(pos1);

                //drawingContext.DrawRectangle(Brushes.Gray, selectionScopePen, new Rect(new Point(posStart, HeaderHeight), new Point(posFinish, Extent.Height)));

                double midHeight = Extent.Height / 2;

                Rect area = new Rect(new Point(posStart, HeaderHeight), new Point(posFinish, Extent.Height));
                drawingContext.DrawRectangle(selectionScopeBackground, null, area);

                drawingContext.DrawLine(selectionScopePen, new Point(posStart, HeaderHeight), new Point(posStart, Extent.Height));
                drawingContext.DrawLine(selectionScopePen, new Point(posFinish, HeaderHeight), new Point(posFinish, Extent.Height));

                FormattedText durationText = new FormattedText(String.Format("{0:0.000}ms", pos1 - pos0).Replace(',', '.'), culture, FlowDirection.LeftToRight, fontDuration, 18, Brushes.White);
                durationText.MaxTextWidth = area.Width;
                durationText.Trimming     = TextTrimming.None;
                durationText.MaxLineCount = 1;
                drawingContext.DrawText(durationText, new Point((posStart + posFinish) / 2 - durationText.Width / 2, (Extent.Height + HeaderHeight) / 2 - durationText.Height / 2));
            }
        }
コード例 #35
0
ファイル: OverlayAdorner.cs プロジェクト: Zino2201/Cosmos
        protected override void OnRender(DrawingContext drawingContext)
        {
            lock (_text)
            {
                if (RegularFont == null || FixedWidthFont == null) return;
                foreach (var at in _text)
                {

                    FontInfo f = RegularFont;
                    if (at.DisplayInfo.Font == ZFont.FIXED_WIDTH_FONT || at.DisplayInfo.ImplementsStyle(ZStyles.FIXED_WIDTH_STYLE))
                    {
                        f = FixedWidthFont;
                    }
                    Brush b = ZColorCheck.ZColorToBrush(at.DisplayInfo.ForegroundColor, Support.ColorType.Foreground);
                    FormattedText ft = new FormattedText(at.Text,
                        System.Globalization.CultureInfo.CurrentCulture,
                        FlowDirection.LeftToRight, f.Typeface, f.PointSize, b,
                        new NumberSubstitution(), TextFormattingMode.Display);

                    if (at.DisplayInfo.ImplementsStyle(ZStyles.REVERSE_STYLE))
                    {
                        drawingContext.DrawRectangle(b, null, new Rect(at.X + 2, at.Y + 2, ft.WidthIncludingTrailingWhitespace, Math.Max(ft.Height, FontHeight)));
                        ft.SetForegroundBrush(ZColorCheck.ZColorToBrush(at.DisplayInfo.BackgroundColor, Support.ColorType.Background));
                    }
                    drawingContext.DrawText(ft, new Point(at.X + 2, at.Y + 2));
                    // Note: Offsetting positions by 2 to get everything to line up correctly
                }
            }
        }
コード例 #36
0
        protected override void DrawCore(DrawingContext drawingContext, DrawingAttributes drawingAttributes)
        {
            if (drawingContext == null)
            {
                throw new ArgumentNullException("drawingContext");
            }
            if (null == drawingAttributes)
            {
                throw new ArgumentNullException("drawingAttributes");
            }
            Pen pen = new Pen
            {
                StartLineCap = PenLineCap.Round,
                EndLineCap = PenLineCap.Round,
                Brush = new SolidColorBrush(drawingAttributes.Color),
                Thickness = drawingAttributes.Width
            };

            BrushConverter bc = new BrushConverter();
            Brush BackGround = (Brush)bc.ConvertFromString(drawingAttributes.GetPropertyData(DrawAttributesGuid.BackgroundColor).ToString());

            drawingContext.DrawRectangle(
                BackGround,
                pen,
                new Rect(new Point(StylusPoints[0].X, StylusPoints[0].Y),
                    new Point(StylusPoints[1].X, StylusPoints[1].Y)));
        }
コード例 #37
0
 protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
 {
     if (!MbRect.IsEmpty)
     {
         drawingContext.DrawRectangle(m_Brush, m_Pen, m_MbRect);
     }
 }
コード例 #38
0
 /// <summary>
 /// Renders the highlight in the scroll bar.
 /// </summary>
 protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
 {
     if (!handler.IsHighlightInViewPort(bodyHighlight))//works for fldv and ?tb?
     {
         drawingContext.DrawRectangle(handler.RenderBrush, null, handler.GetAdornerPosition(bodyHighlight));
     }
 }
コード例 #39
0
        protected override void OnRender(System.Windows.Media.DrawingContext dc)
        {
            if (Double.IsNaN(Width) || Double.IsNaN(Height))
            {
                return;
            }
            BackBrush          = new SolidColorBrush(Colors.AntiqueWhite);
            BackCursorBrush    = new SolidColorBrush(Colors.Yellow);
            ForeBrush          = new SolidColorBrush(Colors.Black);
            BorderBrush        = new SolidColorBrush(Colors.Chocolate);
            BackHighBrush      = new SolidColorBrush(Colors.Red);
            ForeHighBrush      = new SolidColorBrush(Colors.Yellow);
            BorderPen          = new Pen(BorderBrush, 1);
            InsideBrush        = new SolidColorBrush(Colors.Beige);
            SelectedForeBrush  = new SolidColorBrush(Colors.White);
            SelectedBackBrush  = new SolidColorBrush(Colors.DarkBlue);
            NonErrorReplyBrush = new SolidColorBrush(Colors.Chocolate);
            ErrorReplyBrush    = new SolidColorBrush(Colors.Red);

            bottomOffset = LineHeight / 3;
            topOffset    = 2 * LineHeight / 3;

            dc.DrawRectangle(BackBrush, null, new Rect(0, 0, Width, Height));
            DrawBorders(dc);
            DrawText(dc);
        }
コード例 #40
0
ファイル: BarChart.cs プロジェクト: borkaborka/gmit
 private void _drawBar(DrawingContext dc, Brush fill, double x0, double y0, double x1, double y1) {
    var dw = Math.Abs(x1 - x0);
    var dh = Math.Abs(y1 - y0);
    if (x0 > x1) x0 = x1;
    if (y0 > y1) y0 = y1;
    dc.DrawRectangle(fill, null, new Rect(x0, y0, dw, dh));
 }
コード例 #41
0
    protected override void OnRender(DrawingContext drawingContext) {
      base.OnRender(drawingContext);
      if (packing == null) return;
      // the container should fill the whole size
      var scalingX = renderSize.Width / Packing.BinShape.Width;
      var scalingY = renderSize.Height / Packing.BinShape.Width;
      // draw container
      drawingContext.DrawRectangle(Brushes.LightGray, new Pen(Brushes.Black, 1), new Rect(new Point(0, 0), renderSize));

      var selectedBrush = Brushes.MediumSeaGreen;
      var unselectedBrush = selectedItemKey < 0 ? selectedBrush : Brushes.DarkGray;

      foreach (var t in Packing.Items) {
        var key = t.Key;
        var item = t.Value;
        var pos = Packing.Positions[key];

        var scaledPos = new Point(pos.X * scalingX, pos.Y * scalingY);

        var scaledSize = pos.Rotated ?
          new Size(item.Height * scalingX, item.Width * scalingY) :
          new Size(item.Width * scalingX, item.Height * scalingY);

        var brush = key == selectedItemKey ? selectedBrush : unselectedBrush;
        drawingContext.DrawRectangle(brush, new Pen(Brushes.Black, 1), new Rect(scaledPos, scaledSize));
      }
    }
コード例 #42
0
ファイル: WPFControl.cs プロジェクト: miyamot0/ReoGrid
        /// <summary>
        /// Handle repaint event to draw component.
        /// </summary>
        /// <param name="dc">Platform independence drawing context.</param>
        protected override void OnRender(System.Windows.Media.DrawingContext dc)
        {
#if DEBUG
            Stopwatch watch = Stopwatch.StartNew();
#endif

            if (this.currentWorksheet != null &&
                this.currentWorksheet.workbook != null &&
                this.currentWorksheet.controlAdapter != null)
            {
                dc.DrawRectangle(Brushes.White, null, new Rect(0, 0, this.RenderSize.Width, this.RenderSize.Height));

                this.renderer.Reset();

                ((WPFRenderer)this.renderer).SetPlatformGraphics(dc);

                var rgdc = new CellDrawingContext(this.currentWorksheet, DrawMode.View, this.renderer);
                this.currentWorksheet.ViewportController.Draw(rgdc);
            }

#if DEBUG
            watch.Stop();
            long ms = watch.ElapsedMilliseconds;
            if (ms > 30)
            {
                Debug.WriteLine(string.Format("end draw: {0} ms.", watch.ElapsedMilliseconds));
            }
#endif
        }
コード例 #43
0
        protected void DrawPiece( DrawingContext drawingContext, int x, int y, TetrisPieceColor tetrisPieceColor )
        {
            if ( m_nPieceSize <= 0 )
            return;

             int nX = x * m_nPieceSize;
             int nY = ((m_Board.GetHeight()-1) * m_nPieceSize) - y * m_nPieceSize;
             Brush b;
             switch(tetrisPieceColor)
             {
            default:
            case TetrisPieceColor.Red:
               b = Brushes.Red;
               break;
            case TetrisPieceColor.Yellow:
               b = Brushes.Yellow;
               break;
            case TetrisPieceColor.Purple:
               b = Brushes.Purple;
               break;
            case TetrisPieceColor.LtGray:
               b = Brushes.LightGray;
               break;
            case TetrisPieceColor.LtBlue:
               b = Brushes.LightBlue;
               break;
            case TetrisPieceColor.Green:
               b = Brushes.Green;
               break;
            case TetrisPieceColor.Blue:
               b = Brushes.Blue;
               break;
             }
             drawingContext.DrawRectangle( b, new Pen( Brushes.Black, 1d ), new Rect( nX, nY, m_nPieceSize, m_nPieceSize ) );
        }
コード例 #44
0
ファイル: Fader.cs プロジェクト: MartyIX/SoTh
 protected override void OnRender(DrawingContext drawingContext)
 {
     drawingContext.DrawRectangle(brush, pen, new Rect(corner, DesiredSize));
     center = new Point((DesiredSize.Width - formattedText.Width)/2, (DesiredSize.Height - formattedText.Height)/2);
     drawingContext.DrawText(formattedText, center);
     base.OnRender(drawingContext);
 }
コード例 #45
0
ファイル: Map.cs プロジェクト: MatejHrlec/OculusView
        /// <summary>
        /// any custom drawing here
        /// </summary>
        /// <param name="drawingContext"></param>
        protected override void OnRender(DrawingContext drawingContext)
        {
            base.OnRender(drawingContext);
            if (selectedDirection != null && hasDirection == true)
            {
                //start = DateTime.Now;



                //end = DateTime.Now;
                //delta = (int)(end - start).TotalMilliseconds;

                //FormattedText text = new FormattedText(string.Format(CultureInfo.InvariantCulture, "{0:0.0}", Zoom) + "z, " + MapProvider + ", refresh: " + counter++ + ", load: " + ElapsedMilliseconds + "ms, render: " + delta + "ms", CultureInfo.InvariantCulture, fd, tf, 20, Brushes.Blue);
                //drawingContext.DrawText(text, new Point(text.Height, text.Height));
                //text = null;


                SolidColorBrush brush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF072527"));
                FormattedText text = new FormattedText("End location: " + selectedDirection.EndAddress + ".\nStart location: " + selectedDirection.StartAddress + ".\nDistance: " + selectedDirection.Distance + ", duration: " + selectedDirection.Duration, CultureInfo.InvariantCulture, fd, tf, 20, brush);

                SolidColorBrush boxy = new SolidColorBrush(Color.FromArgb(130, 180, 180, 180));
                drawingContext.DrawRectangle(boxy, new Pen(), new Rect(new Point(text.Height, text.Height), new Point(text.Height + text.Width, text.Height * 2)));


                drawingContext.DrawText(text, new Point(text.Height, text.Height));

                text = null;
            }
        }
コード例 #46
0
		protected override void OnRender(DrawingContext drawingContext)
		{
			Pen blackPen = new Pen(Brushes.Black, 1);
			blackPen.StartLineCap = PenLineCap.Square;
			blackPen.EndLineCap = PenLineCap.Square;
			Size pixelSize = PixelSnapHelpers.GetPixelSize(this);
			Rect rect = new Rect(pixelSize.Width / 2,
			                     pixelSize.Height / 2,
			                     this.RenderSize.Width - pixelSize.Width,
			                     this.RenderSize.Height - pixelSize.Height);
			drawingContext.DrawRectangle(Brushes.White,
			                             IsMouseDirectlyOver ? blackPen : new Pen(Brushes.Gray, 1),
			                             rect);
			double middleX = rect.Left + rect.Width / 2;
			double middleY = rect.Top + rect.Height / 2;
			double space = PixelSnapHelpers.Round(rect.Width / 8, pixelSize.Width) + pixelSize.Width;
			drawingContext.DrawLine(blackPen,
			                        new Point(rect.Left + space, middleY),
			                        new Point(rect.Right - space, middleY));
			if (!isExpanded) {
				drawingContext.DrawLine(blackPen,
				                        new Point(middleX, rect.Top + space),
				                        new Point(middleX, rect.Bottom - space));
			}
		}
コード例 #47
0
 protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
 {
     for (int i = 0; i < Steps + 1; ++i)
     {
         var value    = (Maximum - Minimum) / Steps * i + Minimum;
         var location = (MaximumAngle - MinimumAngle) / Steps * i + MinimumAngle;
         var rad      = (90 - location) * Math.PI / 180;
         while (rad > Math.PI * 2)
         {
             rad -= Math.PI * 2;
         }
         while (rad < 0)
         {
             rad += Math.PI * 2;
         }
         var point = new Point(
             ActualWidth / 2 + ActualWidth / 2 * Math.Cos(rad),
             ActualHeight / 2 - ActualHeight / 2 * Math.Sin(rad));
         drawingContext.DrawRectangle(Brushes.Red, null, new Rect(point.X - 2, point.Y - 2, 4, 4));
         var ft = new FormattedText(value.ToString(ScaleFormat),
                                    CultureInfo.CurrentCulture, System.Windows.FlowDirection.LeftToRight,
                                    new Typeface("Arial"), 15, Brushes.Red);
         if (Math.Abs(point.X - ActualWidth / 2) < 1)
         {
             point = new Point(point.X - ft.Width / 2, point.Y);
         }
         else if (point.X > ActualWidth / 2)
         {
             point = new Point(point.X - ft.Width, point.Y);
         }
         drawingContext.DrawText(ft, point);
     }
 }
コード例 #48
0
        /// <summary>
        /// Creates a new System.Windows.Media.ImageSource of a specified FontAwesomeIcon and foreground System.Windows.Media.Brush.
        /// </summary>
        /// <param name="icon">The FontAwesome icon to be drawn.</param>
        /// <param name="foregroundBrush">The System.Windows.Media.Brush to be used as the foreground.</param>
        /// <returns>A new System.Windows.Media.ImageSource</returns>

        public static System.Windows.Media.ImageSource GetImageSource(int icon, System.Windows.Media.Brush foregroundBrush, double emSize = 100, double margin = 0)
        {
            string charIcon = char.ConvertFromUtf32(icon);

            if (_Typeface == null)
            {
                _Typeface = new System.Windows.Media.Typeface(FontFamily, System.Windows.FontStyles.Normal, System.Windows.FontWeights.Normal, System.Windows.FontStretches.Normal);
            }
            ;

            System.Windows.Media.DrawingVisual visual = new System.Windows.Media.DrawingVisual();

            using (System.Windows.Media.DrawingContext drawingContext = visual.RenderOpen())
            {
                FormattedText ft = new System.Windows.Media.FormattedText(
                    charIcon,
                    System.Globalization.CultureInfo.InvariantCulture,
                    System.Windows.FlowDirection.LeftToRight,
                    _Typeface, emSize - (2 * margin), foregroundBrush);

                ft.TextAlignment = System.Windows.TextAlignment.Center;

                drawingContext.DrawRectangle(null, new Pen(Brushes.Black, 0), new System.Windows.Rect(0, 0, emSize, emSize));
                drawingContext.DrawText(ft, new System.Windows.Point(emSize / 2, margin));
            };

            return(new System.Windows.Media.DrawingImage(visual.Drawing));
        }
コード例 #49
0
        protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
        {
            double height = SystemParameters.PrimaryScreenHeight;
            double width  = SystemParameters.PrimaryScreenWidth;

            drawingContext.DrawRectangle(Brushes.Gray, new Pen(Brushes.Gray, 1), new Rect(new Size(width, height)));
            base.OnRender(drawingContext);
        }
コード例 #50
0
ファイル: MenuKillerItem.cs プロジェクト: tablesmit/Yuhan
        // Can't use Conditional on overrides
#if DEBUG
        protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
        {
            base.OnRender(drawingContext);

            drawingContext.DrawRectangle(null, new Pen(Brushes.DarkBlue, 3.0), new Rect(0, 0, DesiredSize.Width - Margin.Left - Margin.Right, DesiredSize.Height - Margin.Top - Margin.Bottom));
            // show the visual center
            drawingContext.DrawEllipse(Brushes.Red, null, AlignReferencePoint, 3, 3);
        }
コード例 #51
0
        /// <summary>
        /// Called to draw on screen
        /// </summary>
        /// <param name="drawingContext">The drawind context in which we can draw</param>
        protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
        {
            FormattedText text = new FormattedText(OverlayedText, Thread.CurrentThread.CurrentUICulture, FlowDirection.LeftToRight, Typeface, FontSize, ForeGround);

            drawingContext.DrawText(text, new Point(DesiredSize.Width / 2 - text.Width / 2, DesiredSize.Height / 2));
            drawingContext.DrawRectangle(Color, Border, new Rect(new Point(0, 0), DesiredSize));
            base.OnRender(drawingContext);
        }
コード例 #52
0
        protected override void OnRender(System.Windows.Media.DrawingContext dc)
        {
            base.OnRender(dc);


            if (this.playground == null)
            {
                return;
            }

            var xlength = this.playground.GetLength(1);
            var ylength = this.playground.GetLength(0);


            if (ylength == 0 || xlength == 0)
            {
                return;
            }

            double cellHeight = ActualHeight / xlength;
            double cellWidth  = ActualWidth / ylength;


            cellHeight = Math.Floor(cellHeight);
            cellWidth  = Math.Floor(cellWidth);

            if (cellHeight == 0 || cellWidth == 0)
            {
                FormattedText text = new FormattedText("Auflösung falsch gewählt", CultureInfo.InvariantCulture, FlowDirection.LeftToRight, new Typeface("Arial"), 12, Brushes.Black);
                dc.DrawText(text, new Point(25, 25));
                return;
            }

            for (int x = 0; x < ylength; x++)
            {
                for (int y = 0; y < xlength; y++)
                {
                    var rect = new Rect(x * cellWidth, y * cellHeight, cellWidth, cellHeight);
                    if (this.playground[x, y] == true)
                    {
                        dc.DrawRectangle(Brushes.Blue, new Pen(), rect);
                    }
                }
            }

            for (int x = 0; x <= ylength; x++)
            {
                var drawingWidth = ylength * cellWidth;
                dc.DrawLine(new Pen(Brushes.LightGray, 1), new Point(0, x * cellHeight), new Point(drawingWidth, x * cellHeight));
            }

            for (int y = 0; y <= xlength; y++)
            {
                var drawingLength = xlength * cellHeight;
                dc.DrawLine(new Pen(Brushes.LightGray, 1), new Point(y * cellWidth, 0), new Point(y * cellWidth, drawingLength));
            }
        }
コード例 #53
0
 protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
 {
     if (_display != null)
     {
         if (_display.TextureMemory != null && _display.TextureMemory.IsDataAvailable)
         {
             drawingContext.DrawRectangle(CreateImageBrush(), null, _displayRect);
         }
         else if (_display.IsRunning)
         {
             drawingContext.DrawRectangle(Brushes.Black, null, _displayRect);
         }
         else if (_defaultImage != null)
         {
             drawingContext.DrawRectangle(_defaultImage, null, _displayRect);
         }
     }
 }
コード例 #54
0
ファイル: MFDRenderer.cs プロジェクト: BlueFinBima/Helios14
        protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
        {
            MFD mfd = Visual as MFD;

            if (mfd != null)
            {
                drawingContext.DrawRectangle(_bezel, null, _bezelRectangle);
            }
        }
コード例 #55
0
        protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
        {
            AV8BDevice _av8bdevice = Visual as AV8BDevice;

            if (_av8bdevice != null)
            {
                drawingContext.DrawRectangle(_bezel, null, _bezelRectangle);
            }
        }
コード例 #56
0
ファイル: ShadingAdorner.cs プロジェクト: zaieda/TemPOS
        /// <summary>
        /// Called to draw on screen
        /// </summary>
        /// <param name="drawingContext">The drawind context in which we can draw</param>
        protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
        {
            Size size = new Size(
                (DesiredSize.Width / ConfigurationManager.ProgramScale),
                (DesiredSize.Height / ConfigurationManager.ProgramScale));

            drawingContext.DrawRectangle(Color, Border, new Rect(startPoint, size));
            base.OnRender(drawingContext);
        }
コード例 #57
0
        protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
        {
            TextDecoration profileText = Visual as TextDecoration;

            if (profileText.FillBackground && profileText.BackgroundColor.A > 0)
            {
                drawingContext.DrawRectangle(_backgroundBrush, null, _rectangle);
            }
            profileText.Format.RenderText(drawingContext, _fontBrush, profileText.Text, _rectangle);
        }
コード例 #58
0
 //static readonly ILog _log = LogManager.GetLogger(typeof(BorderAdorner));
 //if (_log.IsDebugEnabled) { _log.DebugFormat("Starting {0}", MethodBase.GetCurrentMethod().ToString()); }
 //if (_log.IsDebugEnabled) { _log.DebugFormat("Ending {0}", MethodBase.GetCurrentMethod().ToString()); }
 protected override void OnRender(
     System.Windows.Media.DrawingContext drawingContext)
 {
     if (drawingContext != null)
     {
         drawingContext.DrawRectangle(null, new Pen(Brushes.AliceBlue, 1),
                                      new Rect(new Point(0, 0), DesiredSize));
         base.OnRender(drawingContext);
     }
 }
コード例 #59
0
 protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
 {
     drawingContext.DrawRectangle(background, new Pen(Brushes.White, 1), new Rect(new Point(0, 0), DesiredSize));
     drawingContext.DrawText(new FormattedText(this.Message, CultureInfo.CurrentUICulture, FlowDirection.LeftToRight,
                                               new Typeface("SegoeUI"),
                                               20.0,
                                               foreground),
                             new Point(10, 10));
     base.OnRender(drawingContext);
 }
コード例 #60
0
 protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
 {
     base.OnRender(drawingContext);
     drawingContext.DrawRectangle(Background, null, new Rect(0, 0, ActualWidth, ActualHeight));
     if (writeableBitmap != null)
     {
         drawingContext.DrawDrawing(new ImageDrawing(writeableBitmap,
                                                     new Rect(0, 0, writeableBitmap.PixelWidth, writeableBitmap.PixelHeight)));
     }
 }