Ejemplo n.º 1
1
 public override void Draw(System.Drawing.Graphics e)
 {
     Pen pen = new Pen(Color.Blue, 2);
     e.DrawLine(pen, X, Y + Height, X + Width, Y + Height);
     e.DrawLine(pen, X, Y + Height, X + Width / 2, Y);
     e.DrawLine(pen, X + Width / 2, Y, X + Width, Y + Height);
 }
Ejemplo n.º 2
0
		protected override void RenderCell(IMapTile tile, System.Drawing.Graphics g, int x, int y)
		{
			XCMapTile mapTile = (XCMapTile)tile;
			if (!blank)
			{
				if (mapTile.Ground != null && this.g.Checked)
					g.FillPath(Brushes["GroundColor"], UpperPath(x,y));

				if (mapTile.North != null && n.Checked)
					g.DrawLine(Pens["NorthColor"], x, y, x + hWidth, y + hHeight);

				if (mapTile.West != null && w.Checked)
					g.DrawLine(Pens["WestColor"], x, y, x - hWidth, y + hHeight);

				if (mapTile.Content != null && c.Checked)
					g.FillPath(Brushes["ContentColor"], LowerPath(x,y));
			}
			else
			{
				if (!mapTile.DrawAbove)
				{
					g.FillPath(System.Drawing.Brushes.DarkGray, UpperPath(x, y));
					g.FillPath(System.Drawing.Brushes.DarkGray, LowerPath(x, y));
				}
			}
		}
Ejemplo n.º 3
0
 public override void Draw(System.Drawing.Graphics g)
 {
     g.DrawLine(System.Drawing.SystemPens.ActiveCaptionText, (x1+(x2-x1)/2), y1, x2, (y1+(y2-y1)/2));
     g.DrawLine(System.Drawing.SystemPens.ActiveCaptionText, x2, (y1 + (y2 - y1) / 2), (x1+(x2-x1)/2), y2);
     g.DrawLine(System.Drawing.SystemPens.ActiveCaptionText, (x1 + (x2 - x1) / 2), y2, x1, (y1 + (y2 - y1) / 2));
     g.DrawLine(System.Drawing.SystemPens.ActiveCaptionText, x1, (y1 + (y2 - y1) / 2), (x1+(x2-x1)/2), y1);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Draw the gridlines.
        /// </summary>
        /// <param name="graphics">Reference to the GDI+ drawing surface.</param>
		public void Draw(System.Drawing.Graphics graphics)
		{
			using (Pen graphAreaPen = new Pen(m_ParentGraph.GridlineColor))
			{
				graphAreaPen.DashStyle = DashStyle.Dash;
				using (Brush graphAreaBrush = new SolidBrush(m_ParentGraph.GraphAreaColor))
				{
					graphics.FillRectangle(graphAreaBrush, m_ParentGraph.GraphArea);
					graphics.DrawRectangle(graphAreaPen, m_ParentGraph.GraphArea);

					if ((m_ParentGraph.Gridlines & GridStyles.Horizontal) == GridStyles.Horizontal)
					{
						graphics.SetClip(m_ParentGraph.GraphArea);

						int gridSize = m_ParentGraph.GraphArea.Height / m_ParentGraph.GraduationsY;
						for (int i = 0; i < m_ParentGraph.GraphArea.Height; i += gridSize)
						{
							graphics.DrawLine(graphAreaPen, m_ParentGraph.GraphArea.Left, m_ParentGraph.GraphArea.Top + i, m_ParentGraph.GraphArea.Right, m_ParentGraph.GraphArea.Top + i);
						}
					}

					if ((m_ParentGraph.Gridlines & GridStyles.Vertical) == GridStyles.Vertical)
					{
						graphics.SetClip(m_ParentGraph.GraphArea);

						int gridSize = m_ParentGraph.GraphArea.Width / m_ParentGraph.GraduationsX;
						for (int i = 0; i < m_ParentGraph.GraphArea.Width; i += gridSize)
						{
							graphics.DrawLine(graphAreaPen, m_ParentGraph.GraphArea.Left + i, m_ParentGraph.GraphArea.Bottom, m_ParentGraph.GraphArea.Left + i, m_ParentGraph.GraphArea.Top);
						}
					}
				}
			}
        }
Ejemplo n.º 5
0
        protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
        {
            base.OnRender(drawingContext);

            double height = element.ActualHeight;
            double width = element.ActualWidth;

            double linesHorizontal = height / LINEFACTOR;
            double linesVertical = width / LINEFACTOR;

            var pen = new Pen(Brushes.Blue, 0.1) { StartLineCap = PenLineCap.Triangle, EndLineCap = PenLineCap.Triangle };

            int offset = 0;

            for (int i = 0; i <= linesVertical; ++i)
            {
                offset = offset + LINEFACTOR;
                drawingContext.DrawLine(pen, new Point(offset, 0), new Point(offset, height));
            }

            offset = 0;

            for (int i = 0; i <= linesHorizontal; ++i)
            {
                offset = offset + LINEFACTOR;
                drawingContext.DrawLine(pen, new Point(0, offset), new Point(width, offset));
            }
        }
Ejemplo n.º 6
0
 public void DrawTriagle(System.Drawing.Graphics g,int Triagle1_x, int Triagle1_y, int Triagle2_x, int Triagle2_y, int Triagle3_x, int Triagle3_y)
 {
     System.Drawing.Pen pen1 = new System.Drawing.Pen(Color.Red, 2F);
     g.DrawLine(pen1, Triagle1_x, Triagle1_y, Triagle2_x, Triagle2_y);
     g.DrawLine(pen1, Triagle2_x, Triagle2_y, Triagle3_x, Triagle3_y);
     g.DrawLine(pen1, Triagle3_x, Triagle3_y, Triagle1_x, Triagle1_y);
 }
        public static void Draw3ColorBar(System.Drawing.Graphics dc, System.Drawing.RectangleF r, System.Windows.Forms.Orientation orientation, System.Drawing.Color c1, System.Drawing.Color c2,
            System.Drawing.Color c3)
        {
            // to draw a 3 color bar 2 gradient brushes are needed
            // one from c1 - c2 and c2 - c3
            var lr1 = r;
            var lr2 = r;
            float angle = 0;

            if (orientation == System.Windows.Forms.Orientation.Vertical)
            {
                angle = 270;

                lr1.Height = lr1.Height/2;
                lr2.Height = r.Height - lr1.Height;
                lr2.Y += lr1.Height;
            }
            if (orientation == System.Windows.Forms.Orientation.Horizontal)
            {
                angle = 0;

                lr1.Width = lr1.Width/2;
                lr2.Width = r.Width - lr1.Width;
                lr1.X = lr2.Right;
            }

            if (lr1.Height > 0 && lr1.Width > 0)
            {
                using (System.Drawing.Drawing2D.LinearGradientBrush lb2 = new System.Drawing.Drawing2D.LinearGradientBrush(lr2, c1, c2, angle, false),  lb1 = new System.Drawing.Drawing2D.LinearGradientBrush(lr1, c2, c3, angle, false) )
                {
                    dc.FillRectangle(lb1, lr1);
                    dc.FillRectangle(lb2, lr2);

                }

            }
            // with some sizes the first pixel in the gradient rectangle shows the opposite color
            // this is a workaround for that problem
            if (orientation == System.Windows.Forms.Orientation.Vertical)
            {
                using (System.Drawing.Pen pc2 = new System.Drawing.Pen(c2, 1), pc3 = new System.Drawing.Pen(c3, 1))
                {
                    dc.DrawLine(pc3, lr1.Left, lr1.Top, lr1.Right - 1, lr1.Top);
                    dc.DrawLine(pc2, lr2.Left, lr2.Top, lr2.Right - 1, lr2.Top);

                }
            }

            if (orientation == System.Windows.Forms.Orientation.Horizontal)
            {
                using (System.Drawing.Pen pc1 = new System.Drawing.Pen(c1, 1), pc2 = new System.Drawing.Pen(c2, 1), pc3 = new System.Drawing.Pen(c3, 1))
                {
                    dc.DrawLine(pc1, lr2.Left, lr2.Top, lr2.Left, lr2.Bottom - 1);
                    dc.DrawLine(pc2, lr2.Right, lr2.Top, lr2.Right, lr2.Bottom - 1);
                    dc.DrawLine(pc3, lr1.Right, lr1.Top, lr1.Right, lr1.Bottom - 1);

                }
            }
        }
Ejemplo n.º 8
0
 protected override void PreDraw(int x, int y, System.Drawing.Graphics g)
 {
     int realX = x / size * size;
     int realY = y / size * size;
     //Draw a red X
     g.DrawLine(pen, realX, realY, realX + size, realY + size);
     g.DrawLine(pen, realX + size, realY, realX, realY + size);
 }
        public void Render(System.Drawing.Graphics graphics)
        {
            Pen pen = new System.Drawing.Pen(System.Drawing.Color.Salmon);

            graphics.DrawLine(pen, 0, 0, 200, 0);
            graphics.DrawLine(pen, 0, 0, 0, 200);
            graphics.DrawRectangle(pen, 0, 0, 20, 20);
            graphics.DrawRectangle(pen, -20, -20, 20, 20);
        }
Ejemplo n.º 10
0
        protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
        {
            base.OnRender(drawingContext);

            Pen tPOut = new Pen(StrikeOutBrush, StrikeOutThickness);

            drawingContext.DrawLine(tPOut, new System.Windows.Point(this.Margin.Left, this.Margin.Top), new System.Windows.Point(this.ActualWidth - this.Margin.Right, this.ActualHeight - this.Margin.Bottom));
            drawingContext.DrawLine(tPOut, new System.Windows.Point(this.Margin.Left, this.ActualHeight - this.Margin.Bottom), new System.Windows.Point(this.ActualWidth - this.Margin.Right, this.Margin.Top));
        }
Ejemplo n.º 11
0
        private void drawPallet(System.Drawing.Graphics canvas, Pallet data)
        {
            System.Drawing.Pen pen = new System.Drawing.Pen(System.Drawing.Color.SandyBrown, 3);
            canvas.DrawLine(pen, Configuration.startX + data.start.x, Configuration.startY, Configuration.palletWidth + Configuration.startX, Configuration.startY);
            canvas.DrawLine(pen, Configuration.startX, Configuration.startY, Configuration.startX, Configuration.palletHeight + Configuration.startY);
            canvas.DrawLine(pen, Configuration.startX, Configuration.startY + Configuration.palletHeight, Configuration.palletWidth + Configuration.startX, Configuration.startY + Configuration.palletHeight);
            canvas.DrawLine(pen, Configuration.startX + Configuration.palletWidth, Configuration.startY, Configuration.palletWidth + Configuration.startX, Configuration.startY + Configuration.palletHeight);

            pen.Dispose();
        }
Ejemplo n.º 12
0
        public void Draw(System.Drawing.Graphics myGraphics)
        {
            if (m_visible)
            {
                System.Drawing.Pen myPen = new System.Drawing.Pen(m_color,m_width);

                foreach (Physic.Position pos in this.get_positions())
                {
                    myGraphics.DrawLine(myPen,pos.get_x(),pos.get_y()-m_marker_len/2,pos.get_x(),pos.get_y()+m_marker_len/2);
                    myGraphics.DrawLine(myPen,pos.get_x()-m_marker_len/2,pos.get_y(),pos.get_x()+m_marker_len/2,pos.get_y());
                }
            }
        }
Ejemplo n.º 13
0
        private void drawBox(System.Drawing.Graphics canvas, Box data)
        {
            System.Drawing.Pen pen = new System.Drawing.Pen(System.Drawing.Color.SkyBlue, 2);
            System.Drawing.Pen pen2 = new System.Drawing.Pen(System.Drawing.Color.Crimson, 2);

            canvas.DrawLine(pen, Configuration.startX + data.coordinates.x, Configuration.startY + data.coordinates.y, Configuration.startX + data.width + data.coordinates.x, Configuration.startY + data.coordinates.y);
            canvas.DrawLine(pen, Configuration.startX + data.coordinates.x, Configuration.startY + data.coordinates.y, Configuration.startX + data.coordinates.x, Configuration.startY + data.height + data.coordinates.y);
            canvas.DrawLine(pen, Configuration.startX + data.coordinates.x, Configuration.startY + data.coordinates.y + data.height, Configuration.startX + data.width + data.coordinates.x, Configuration.startY + data.coordinates.y + data.height);
            canvas.DrawLine(pen, Configuration.startX + data.coordinates.x + data.width, Configuration.startY + data.coordinates.y, Configuration.startX + data.width + data.coordinates.x, Configuration.startY + data.coordinates.y + data.height);

            int x = data.coordinates.x + Configuration.startX + data.width / 2;
            int y = data.coordinates.y + Configuration.startY + data.height / 2;
            canvas.DrawLine(pen2, x - 1, y - 1, x + 1, y + 1);
            pen.Dispose();
        }
Ejemplo n.º 14
0
        public void drawGridLines(System.Drawing.Graphics g, Pen gradepen,float interval_dis, int rango_angular,PointF startvec, PointF center, Rectangle area)
        {
            float radius_len = interval_dis;
            Point linea1 = new Point();
            Point linea2 = new Point();
            while (radius_len <= 1.01f)
            {
                PointF vec = new PointF(startvec.X, startvec.Y);
                PointF oldvec = new PointF();
                for (int ang = 0; ang <= rango_angular; ang += 10)
                {
                    PointF radiusvec = new PointF(radius_len * (vec.X - center.X), radius_len * (vec.Y - center.Y));
                    PointF radius_point = new PointF(radiusvec.X + center.X, radiusvec.Y + center.Y);

                    if (ang > 0)
                    {

                        transformMathCoordToGUICoord(oldvec, ref linea1, area);
                        transformMathCoordToGUICoord(radius_point, ref linea2, area);
                        g.DrawLine(gradepen, linea1, linea2);
                    }
                    rotatePoint(center, 10.0f, ref vec);
                    oldvec = new PointF(radius_point.X, radius_point.Y);
                }

                radius_len += interval_dis;
            }
        }
Ejemplo n.º 15
0
        protected override void DrawGraph(System.Drawing.Graphics g)
        {
            Rectangle.Height = Math.Max(80, Rectangle.Height);
            Rectangle.Width = Math.Max(40, Rectangle.Width);
            var rect = DrawRectangle.GetNormalizedRectangle(Rectangle);

            using (Pen pen = new Pen(PenColor, PenWidth))
            {
                var backRect = new Rectangle(rect.Left + 3, rect.Top + 3, rect.Width, rect.Height);
                g.FillRectangle(Brushes.LightGray, backRect);

                using (var brush = GetBrush(rect))
                {
                    var fillRect = new Rectangle(rect.Left, rect.Top, rect.Width, 20);
                    g.FillRectangle(brush, fillRect);
                }

                using (var brush = DrawRectangle.GetBackgroundBrush(rect, this.BackColor))
                {
                    var fillRect = new Rectangle(rect.Left, rect.Top + 20, rect.Width, rect.Height - 20);
                    g.FillRectangle(brush, fillRect);
                }

                var startPoint = new Point(Rectangle.Left, Rectangle.Top + 20);
                var endPoint = new Point(Rectangle.Right, Rectangle.Top + 20);
                g.DrawLine(pen, startPoint, endPoint);

                g.DrawRectangle(pen, rect);
            }
        }
Ejemplo n.º 16
0
        public bool HandlePoint(Point point, System.Drawing.Graphics graphics, Image image)
        {
            if (IsNowPartitionDrawing)
            {
                if (!isPartitionExists)
                {
                    isPartitionExists = true;
                    LastBitmap = image.Clone() as Bitmap;
                }

                if (!isBeginPointSet)
                {
                    partitionBegin.X = point.X;
                    partitionBegin.Y = point.Y;
                    isBeginPointSet = true;
                }
                else
                {
                    partitionEnd.X = point.X;
                    partitionEnd.Y = point.Y;
                    graphics.DrawLine(new Pen(partitionColor), partitionBegin, partitionEnd);
                    isBeginPointSet = false;
                    return true;
                }
            }
            return false;
        }
Ejemplo n.º 17
0
        protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
        {
            if (editorModel == null) return;

               foreach (var c in model.Chunks)
               foreach (var r in GetRects(c))
               {
                   drawingContext.DrawRectangle(fills[(int)c.Mode], borderPen, r);
                   if (c.StartsNewEpisode)
                   {
                       var p = GetCoordinate(c.StartTime);
                       drawingContext.DrawLine(episode, p, new Point(p.X, p.Y + RowHeight));
                   }
               }

               if (model.SoundIntervals != null)
               {
               foreach (var i in model.SoundIntervals)
               {
                   if (!i.HasVoice)
                       DrawLine(drawingContext, border, i.StartTime, i.EndTime, RowHeight - 3);
               }
               }

            if (editorModel.WindowState.CurrentMode == EditorModes.Border && model.Borders!=null)
                foreach (var e in model.Borders)
                {
                    DrawLine(drawingContext, border, e.StartTime, e.EndTime, 3);
                }

            if (editorModel.WindowState.CurrentMode == EditorModes.Fixes)
                foreach (var e in model.SubtitleFixes)
                    DrawLine(drawingContext, fixes, e.StartTime, e.StartTime + e.Length, RowHeight / 2);
        }
Ejemplo n.º 18
0
        public void Draw(System.Drawing.Graphics myGraphics)
        {
            System.Drawing.Pen myPen = new System.Drawing.Pen(color,width);

            if (direction.get_x()*direction.get_x()
                + direction.get_y()*direction.get_y()
             != 0) // Not null vector
            {
                myGraphics.DrawLine(myPen
                    , position.get_x()-len/2*direction.get_x()
                        /((float) System.Math.Sqrt(
                        direction.get_x()*direction.get_x()+direction.get_y()*direction.get_y()))
                    , position.get_y()-len/2*direction.get_y()
                        /((float) System.Math.Sqrt(
                        direction.get_x()*direction.get_x()+direction.get_y()*direction.get_y()))
                    , position.get_x()+len/2*direction.get_x()
                      	/((float) System.Math.Sqrt(
                        direction.get_x()*direction.get_x()+direction.get_y()*direction.get_y()))
                    , position.get_y()+len/2*direction.get_y()
                        /((float) System.Math.Sqrt(
                        direction.get_x()*direction.get_x()+direction.get_y()*direction.get_y())));
            }
            else
            {
                // dc.DrawPoint(self.x,self.y)
            }
        }
Ejemplo n.º 19
0
        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);
            }
        }
        protected override void OnPaint(System.Drawing.Graphics G)
        {
            G.DrawLine(Pens.Lime, this.Bounds.Left, this.Bounds.Top + this.Bounds.Height / 2, this.Bounds.Right - 1, this.Bounds.Top + this.Bounds.Height / 2);
            G.FillEllipse(Brushes.YellowGreen, this.Bounds.Left + (this.Value - this.MinValue) * this.Bounds.Width / (this.MaxValue - this.MinValue) - 10, this.Bounds.Top + (this.Bounds.Height - 10) / 2, 10, 10);

            base.OnPaint(G);
        }
Ejemplo n.º 21
0
        public override void Draw(System.Drawing.Graphics g)
        {
            GraphicsState gs = g.Save();

            PointF[] transformedPoints = this.getScreenBoundsInWorldCoordinates(g);

            g.DrawLine(axisPen, new PointF(base.Position.X, transformedPoints[0].Y), new PointF(base.Position.X, transformedPoints[1].Y));
            g.DrawLine(axisPen, new PointF(transformedPoints[0].X, base.Position.Y), new PointF(transformedPoints[1].X, base.Position.Y));
            #if DEBUG
            g.FillEllipse(Brushes.Maroon, base.Position.X, transformedPoints[0].Y, 10, 10);
            g.FillEllipse(Brushes.Maroon, base.Position.X, transformedPoints[1].Y, -10, -10);
            g.FillEllipse(Brushes.Maroon, transformedPoints[0].X, base.Position.Y, 10, 10);
            g.FillEllipse(Brushes.Maroon, transformedPoints[1].X, base.Position.Y, -10, -10);
            #endif
            g.Restore(gs);
        }
Ejemplo n.º 22
0
Archivo: Line.cs Proyecto: nikoir/GIS
 public override void Draw(ref System.Drawing.Graphics g)
 {
     if (Check())
     {
         System.Drawing.Point p1 = CurrentLayer.CurrentMap.MapToScreen(GeoPointBegin);
         System.Drawing.Point p2 = CurrentLayer.CurrentMap.MapToScreen(GeoPointEnd);
         if (Selected)
         {
              Pen InvertPen = new Pen(Color.FromArgb(Pen.Color.A, 0xFF - Pen.Color.R, 0xFF - Pen.Color.G, 0xFF - Pen.Color.B), Pen.Width);
              g.DrawLine(InvertPen, p1, p2);
         }
         else
             g.DrawLine(Pen, p1, p2);
     }
     else
         return;
 }
Ejemplo n.º 23
0
        /// <summary>
        /// 绘制方法
        /// </summary>
        /// <param name="g"></param>
        /// <param name="center"></param>
        /// <param name="zoom"></param>
        /// <param name="screen_size"></param>
        public override void Draw(System.Drawing.Graphics g, LatLngPoint center, int zoom, System.Drawing.Size screen_size)
        {
            if (Points != null && Points.Count >= 2)
            {
                g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                List<Point> l = new List<Point>();
                foreach (LatLngPoint p in Points)
                {
                    l.Add(MapHelper.GetScreenLocationByLatLng(p, center, zoom, screen_size));  //屏幕坐标
                }
                
                double total = 0; double step = 0;
                using (Pen pen = new Pen(Color.FromArgb(150, Color.OrangeRed), 4))
                {
                    for (int i = 0; i < l.Count - 1; ++i)
                    {
                        g.DrawLine(pen, l[i], l[i + 1]);
                        g.FillEllipse(Brushes.White, new Rectangle(new Point(l[i].X - 4, l[i].Y - 4), new Size(8, 8)));
                        g.DrawEllipse(Pens.OrangeRed, new Rectangle(new Point(l[i].X - 4, l[i].Y - 4), new Size(8, 8)));

                        if (i == 0)  //起点
                        {
                            g.FillRectangle(Brushes.White, new Rectangle(l[i].X + 3, l[i].Y, 35, 20));
                            g.DrawRectangle(Pens.DarkGray, new Rectangle(l[i].X + 3, l[i].Y, 35, 20));
                            g.DrawString("起点", new Font("微软雅黑", 9), Brushes.OrangeRed, new PointF(l[i].X + 6, l[i].Y + 2));

                            if (i == l.Count - 2)  //终点 只有两点的时候
                            {
                                step = MapHelper.GetDistanceByLatLng(Points[i], Points[i + 1]);
                                total += step;

                                g.FillRectangle(Brushes.White, new Rectangle(l[i + 1].X + 3, l[i + 1].Y, 90, 20));
                                g.DrawRectangle(Pens.DarkGray, new Rectangle(l[i + 1].X + 3, l[i + 1].Y, 90, 20));
                                g.DrawString("总长:" + Math.Round(total,2) + "公里", new Font("微软雅黑", 9), Brushes.OrangeRed, new PointF(l[i + 1].X + 10, l[i + 1].Y + 2));
                            }
                        }
                        else //其它点
                        {
                            step = MapHelper.GetDistanceByLatLng(Points[i-1], Points[i]);
                            total += step;

                            g.FillRectangle(Brushes.White, new Rectangle(l[i].X + 3, l[i].Y, 70, 20));
                            g.DrawRectangle(Pens.DarkGray, new Rectangle(l[i].X + 3, l[i].Y, 70, 20));
                            g.DrawString(Math.Round(step,2) + "公里", new Font("微软雅黑", 9), Brushes.OrangeRed, new PointF(l[i].X + 10, l[i].Y + 2));

                            if (i == l.Count - 2)  //终点
                            {
                                step = MapHelper.GetDistanceByLatLng(Points[i], Points[i + 1]);
                                total += step;
                                g.FillRectangle(Brushes.White, new Rectangle(l[i + 1].X + 3, l[i + 1].Y, 100, 20));
                                g.DrawRectangle(Pens.DarkGray, new Rectangle(l[i + 1].X + 3, l[i + 1].Y, 100, 20));
                                g.DrawString("总长:" + Math.Round(total, 2) + "公里", new Font("微软雅黑", 9), Brushes.OrangeRed, new PointF(l[i + 1].X + 10, l[i + 1].Y + 2));
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 24
0
        protected override void PaintTabGroupBackground(System.Drawing.Graphics g, Office2007RibbonTabGroupColorTable colorTable, System.Drawing.Rectangle bounds, System.Drawing.Rectangle groupBounds, bool glassEnabled)
        {
            if (colorTable == null)
                return;

            // Draw title rectangle part of the group
            Rectangle r = bounds;
            r.Height -= 2;

            // GDI+ bug
            Rectangle rFill = r;
            rFill.Width--;
            rFill.Height--;

            // First draw background
            DisplayHelp.FillRectangle(g, rFill, colorTable.Background);//.Start, colorTable.Background.End, 90, new float[] { 0f, 1f, 1f }, new float[] { 0f, .4f, 1f });

            r = bounds;
            SmoothingMode sm = g.SmoothingMode;
            g.SmoothingMode = SmoothingMode.Default;

            Rectangle rAll = groupBounds;

            if (!colorTable.Border.IsEmpty)
            {
                r.Height += 18;
                using (SolidBrush brush = new SolidBrush(colorTable.Border.Start))
                {
                    // Draw border top
                    g.FillRectangle(brush, rAll.X+1, rAll.Y, rAll.Width-2, 4);
                }

                // Draw border ... Left first
                DisplayHelp.FillRectangle(g, new Rectangle(rAll.X+1, r.Y, 1, r.Height), colorTable.Border);
                // Then right
                DisplayHelp.FillRectangle(g, new Rectangle(rAll.Right - 1, r.Y, 1, r.Height), colorTable.Border);
                
                using (Pen pen = new Pen(Color.FromArgb(92, Color.White)))
                {
                    g.DrawLine(pen, rAll.X, r.Y, rAll.X, r.Height - 2);
                    g.DrawLine(pen, rAll.Right, r.Y, rAll.Right, r.Height - 2);
                }
            }
            g.SmoothingMode = sm;
        }
Ejemplo n.º 25
0
 protected override void Draw(object sender, System.Windows.Media.DrawingContext g)
 {
     if (State == SelectionState.Shaping)
     {
         g.DrawLine(new Pen(Brushes.Gray, 1), shapeData.origin, currentPoint);
         g.DrawEllipse(Brushes.CornflowerBlue, new Pen(Brushes.DarkBlue, 1), shapeData.origin, 2, 2);
         g.DrawEllipse(Brushes.CornflowerBlue, new Pen(Brushes.DarkBlue, 1), currentPoint, 5, 5);
     }
 }
Ejemplo n.º 26
0
 public override void Draw(System.Drawing.Graphics G)
 {
     SFPoint P1, P2;
     Color RealColor = DXFConst.EntColor(this, Converter.FParams.Insert);
     P1 = Converter.GetPoint(Point1);
     P2 = Converter.GetPoint(Point2);
     if (FVisible)
         G.DrawLine(new Pen(RealColor, 1), P1.X, P1.Y, P2.X, P2.Y);
 }
Ejemplo n.º 27
0
 private void DrawLine(System.Windows.Media.DrawingContext drawingContext,Point start, Point end)
 {
     Vector startDir = end - start;
     startDir.Normalize();
     Point endPoint = end - (startDir * ArrowHeadLength);
     Point startPoint = endPoint - (startDir * ArrowHeadLength);
     Pen pen = new Pen(ShapeBrush, DrawPen.Thickness);
     drawingContext.DrawLine(pen, startPoint, endPoint);
 }
Ejemplo n.º 28
0
        public override void DibujarElemento(System.Drawing.Graphics grafico)
        {
            Pen p = new Pen(Color, 2);
            p.StartCap = LineCap.Triangle;
            int mitadX = (_conexion.PosicionMundoPuerto1.X + _conexion.PosicionMundoPuerto2.X) / 2;
            int mitadY = (_conexion.PosicionMundoPuerto1.Y + _conexion.PosicionMundoPuerto2.Y) / 2;
            grafico.DrawLine(p, mitadX, mitadY, mitadX + 30, mitadY - 30);
            grafico.FillEllipse(new SolidBrush(Color), mitadX + 20, mitadY - 30, 10, 10);
            grafico.DrawString(Nombre, new Font("Arial", 8, FontStyle.Regular), Brushes.White, new PointF(mitadX + 30, mitadY - 30));

        }
        public override void DibujarElemento(System.Drawing.Graphics grafico)
        {
            Pen p = new Pen(Color, 2);
            p.StartCap = LineCap.Triangle;
            int mitadX = _puerto.DimensionMundo.Centro.X;
            int mitadY = _puerto.DimensionMundo.Centro.Y;
            grafico.DrawLine(p, mitadX, mitadY, mitadX + 30, mitadY - 30);
            grafico.FillEllipse(new SolidBrush(Color), mitadX + 20, mitadY - 30, 10, 10);
            grafico.DrawString(Nombre, new Font("Arial", 8, FontStyle.Regular), Brushes.White, new PointF(mitadX + 30, mitadY - 30));

        }
Ejemplo n.º 30
0
		public void Draw(TextView textView, System.Windows.Media.DrawingContext drawingContext)
		{
			if (column < 1) return;
			double offset = textView.WideSpaceWidth * column;
			Size pixelSize = PixelSnapHelpers.GetPixelSize(textView);
			double markerXPos = PixelSnapHelpers.PixelAlign(offset, pixelSize.Width);
			Point start = new Point(markerXPos, 0);
			Point end = new Point(markerXPos, Math.Max(textView.DocumentHeight, textView.ActualHeight));
			
			drawingContext.DrawLine(pen, start, end);
		}