Esempio n. 1
0
        internal void Paint(object sender, System.Windows.Forms.PaintEventArgs e)
        {
            System.Drawing.Graphics g = e.Graphics;
            g.Flush(System.Drawing.Drawing2D.FlushIntention.Sync);

            float xMod       = g.VisibleClipBounds.Width / 100;
            float yMod       = g.VisibleClipBounds.Height / 60;
            float playerSize = ServerParam.Instance.Player_size * 2 * 5;
            float ballSize   = ServerParam.Instance.Ball_size * 2 * 10;

            System.Drawing.Pen pen  = new System.Drawing.Pen(System.Drawing.Brushes.White, xMod);
            System.Drawing.Pen pen2 = new System.Drawing.Pen(System.Drawing.Brushes.LightBlue, xMod); //added
            g.DrawLine(pen, xMod * 50, 0, xMod * 50, yMod * 60);
            g.DrawRectangle(pen, new System.Drawing.Rectangle((int)(xMod * 92), (int)(yMod * 23), (int)(xMod * 14), (int)(yMod * 14)));
            g.DrawRectangle(pen, new System.Drawing.Rectangle((int)(xMod * -5), (int)(yMod * 23), (int)(xMod * 14), (int)(yMod * 14)));
            g.DrawRectangle(pen2, new System.Drawing.Rectangle((int)(xMod * 43), (int)(yMod * 23), (int)(xMod * 14), (int)(yMod * 14)));//added
            g.DrawEllipse(pen, new System.Drawing.Rectangle((int)(xMod * 43), (int)(yMod * 23), (int)(xMod * 14), (int)(yMod * 14)));
            RoboCup.Geometry.Vector pos1    = new Vector(0, 0);
            RoboCup.Geometry.Vector pos2    = new Vector(0, 0);
            System.Drawing.Pen      linePen = new System.Drawing.Pen(System.Drawing.Brushes.Black, xMod);
            for (int i = 0; i < DrawPlayerList.Count; i++)
            {
                Player p = DrawPlayerList[i];
                pos1.X = (p.Position.X + 50) * xMod;
                pos2.X = (p.Position.X + 50) * xMod;
                pos1.Y = (p.Position.Y + 30) * yMod;
                pos2.Y = (p.Position.Y + 30) * yMod;

                pos1.X += (float)(Math.Cos(p.AngleBodyCommitted) * xMod * playerSize / 2);
                pos1.Y += (float)(Math.Sin(p.AngleBodyCommitted) * yMod * playerSize / 2);
                pos2.X -= (float)(Math.Cos(p.AngleBodyCommitted) * xMod * playerSize / 2);
                pos2.Y -= (float)(Math.Sin(p.AngleBodyCommitted) * yMod * playerSize / 2);


                g.FillEllipse(p.Side == "l"?System.Drawing.Brushes.Blue:p.Side == "r"?System.Drawing.Brushes.Red:System.Drawing.Brushes.Yellow, new System.Drawing.Rectangle(new System.Drawing.Point((int)Math.Round((p.Position.X + 50 - playerSize / 2) * xMod, (int)MidpointRounding.AwayFromZero), (int)Math.Round((p.Position.Y + 30 - playerSize / 2) * yMod, MidpointRounding.AwayFromZero)), new System.Drawing.Size((int)(playerSize * xMod), (int)(playerSize * yMod))));
                g.DrawLine(linePen, pos1.X, pos1.Y, pos2.X, pos2.Y);
            }

            foreach (var b in Balls)
            {
                if (b != null)
                {
                    g.FillEllipse(System.Drawing.Brushes.Gray, new System.Drawing.Rectangle(new System.Drawing.Point((int)Math.Round((b.Position.X + 50 - ballSize / 2) * xMod, (int)MidpointRounding.AwayFromZero), (int)Math.Round((b.Position.Y + 30 - ballSize / 2) * yMod, MidpointRounding.AwayFromZero)), new System.Drawing.Size((int)(ballSize * xMod), (int)(ballSize * yMod))));
                }
            }

            foreach (Referee r in Referees)
            {
                r.doPaint(sender, e);
            }
        }
Esempio n. 2
0
 public override void Draw(System.Drawing.Graphics g)
 {
     if (this.IsVisible)
     {
         g.FillEllipse(this.Color, this.Box2D);
     }
 }
Esempio n. 3
0
        public void Draw(Grid inGrid, System.Drawing.Graphics inGraphics, bool bPrintAgeType)
        {
            double boundRectX = inGrid.GetTopLeftX() + inGrid.GetSectionWidth() * (GetX() - GetRadius());
            int    maxY       = inGrid.GetTopLeftY() + inGrid.GetHeight();
            double boundRectY = maxY - inGrid.GetSectionHeight() * (GetY() + GetRadius());

            float plantDiameter = (float)GetDiameter();

            float rectHeight = plantDiameter * inGrid.GetSectionHeight();
            float rectiWidth = plantDiameter * inGrid.GetSectionWidth();

            System.Drawing.RectangleF boundingRect       = new System.Drawing.RectangleF((float)boundRectX, (float)boundRectY, rectHeight, rectiWidth);
            System.Drawing.Color      EllipseBorderColor = System.Drawing.Color.Red;
            System.Drawing.Pen        ellipseBorderPen   = new System.Drawing.Pen(EllipseBorderColor);

            inGraphics.DrawEllipse(ellipseBorderPen, boundingRect);
            System.Drawing.SolidBrush ellipseFillBrush = new System.Drawing.SolidBrush(GetFillColor());
            inGraphics.FillEllipse(ellipseFillBrush, boundingRect);

            if (bPrintAgeType)
            {
                System.Drawing.Font       textFont  = new System.Drawing.Font("Arial", 16);
                System.Drawing.SolidBrush textBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Black);
                float textX = (float)(inGrid.GetTopLeftX() + inGrid.GetSectionWidth() * (GetX() - GetRadius()));
                float textY = (float)(maxY - inGrid.GetSectionHeight() * (GetY() + GetRadius()));
                inGraphics.DrawString(GetAgeType().ToString(), textFont, textBrush, textX, textY);
            }

            ellipseBorderPen.Dispose();
        }
Esempio n. 4
0
 public override void FillCircle(RawColor color, Vector2f center, float radius)
 {
     using (System.Drawing.Brush brush2 = CreateBrush(color))
     {
         InternalGraphics.FillEllipse(brush2, center.X - radius, center.Y - radius, radius * 2, radius * 2);
     }
 }
Esempio n. 5
0
        public override System.Drawing.Bitmap Render(System.Drawing.Graphics g, System.Drawing.Bitmap b, params int[] options)
        {
            System.Drawing.Color     bc = DrawingBackColor;
            System.Drawing.Color     fc = DrawingForeColor;
            System.Drawing.Rectangle r  = System.Drawing.Rectangle.Empty;
            System.Drawing.Size      o  = InnerSize;
            bool vm = (AccountType)options[0] == AccountType.VendingMachine;

            System.Drawing.Size sz = vm ? new System.Drawing.Size(o.Width - 1, o.Width * 2 / 3) : new System.Drawing.Size(o.Height * 2 / 3, o.Height - 1);
            int w = (vm ? (o.Height - o.Width / 3) : (o.Width - o.Height / 3)) / options[3];

            for (int i = 0; i < (options[2] > options[3] ? options[3] : options[2]); i++)
            {
                r = vm ? new System.Drawing.Rectangle(0, i * w, sz.Width, sz.Height) : new System.Drawing.Rectangle(i * w, 0, sz.Width, sz.Height);
                g.FillEllipse(new System.Drawing.SolidBrush(bc), r);
                g.DrawEllipse(new System.Drawing.Pen(new System.Drawing.SolidBrush(fc)), r);
            }
            if (!r.IsEmpty)
            {
                string s = options[1].ToString();
                if (vm)
                {
                    r.Inflate(s.Length > 1 ? -3 : -11, -2);
                }
                else
                {
                    r.Inflate(s.Length > 1 ? 4 : -4, -8);
                }
                System.Drawing.Font fnt = new System.Drawing.Font("Microsoft Sans Serif", 12, System.Drawing.FontStyle.Bold);
                g.DrawString(s, fnt, new System.Drawing.SolidBrush(fc), r);
            }
            return(b);
        }
Esempio n. 6
0
        public override void Draw(System.Drawing.Graphics g)
        {
            if (g == null)
            {
                throw new System.ArgumentNullException("g");
            }

            if (base.Dragging)
            {
                System.Drawing.Rectangle rectangle = GetViewportRectangle();

                if (base.Brush != null)
                {
                    System.Drawing.Drawing2D.Matrix prevBrushMatrix = PathVObjectCreateDesigner.AdaptBrushToViewport(base.Brush, this.VObjectHost.HostViewer);
                    try
                    {
                        g.FillEllipse(base.Brush, rectangle);
                    }
                    finally
                    {
                        if (prevBrushMatrix != null)
                        {
                            VObjectsUtils.SetBrushMatrix(base.Brush, prevBrushMatrix);
                        }
                    }
                }

                if (base.Pen != null)
                {
                    using (System.Drawing.Pen pen = CreateViewportPen())
                        g.DrawEllipse(pen, rectangle);
                }
            }
        }
Esempio n. 7
0
        bool m_mouseHooker_OnMouseActivity(System.Windows.Forms.MouseButtons button, int clicks, int x, int y, int delta, WayControls.Windows.Hook.MouseHook.MouseActiveType ActiveType)
        {
            if (this.Visibility != System.Windows.Visibility.Visible)
            {
                return(true);
            }

            if (ActiveType == WayControls.Windows.Hook.MouseHook.MouseActiveType.MouseDown)
            {
                if ((DateTime.Now - m_lastPictureTime).TotalMilliseconds > 500)
                {
                    if (true)
                    {
                        //Point p = this.PointToScreen(new Point(0, 0));
                        //if (new System.Drawing.Rectangle((int)p.X, (int)p.Y, (int)this.ActualWidth, (int)this.ActualHeight).Contains(x, y))
                        //    return true;
                    }
                    if (menu.IsOpen)
                    {
                        Point p = menu.PointToScreen(new Point(0, 0));
                        if (new System.Drawing.Rectangle((int)p.X, (int)p.Y, (int)menu.ActualWidth, (int)menu.ActualHeight).Contains(x, y))
                        {
                            return(true);
                        }
                    }


                    m_lastPictureTime = DateTime.Now;
                    var bitmap = new System.Drawing.Bitmap((int)SystemParameters.PrimaryScreenWidth, (int)SystemParameters.PrimaryScreenHeight, System.Drawing.Imaging.PixelFormat.Format24bppRgb);

                    using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmap))
                    {
                        g.CopyFromScreen(0, 0, 0, 0, bitmap.Size, System.Drawing.CopyPixelOperation.SourceCopy);

                        g.FillEllipse(BRUSH, new System.Drawing.Rectangle(x - 30, y - 30, 60, 60));

                        System.Drawing.Point     p    = System.Windows.Forms.Cursors.Default.HotSpot;
                        System.Drawing.Rectangle rect = new System.Drawing.Rectangle(new System.Drawing.Point(x - p.X, y - p.Y), System.Windows.Forms.Cursors.Default.Size);
                        System.Windows.Forms.Cursors.Default.Draw(g, rect);
                    }
                    string filename = AppDomain.CurrentDomain.BaseDirectory + "BugPics\\" + Guid.NewGuid().ToString() + ".png";
                    bitmap.Save(filename, System.Drawing.Imaging.ImageFormat.Png);
                    bitmap.Dispose();
                    m_histories.Add(filename);
                    if (m_histories.Count > 50)
                    {
                        try
                        {
                            File.Delete(m_histories[0]);
                        }
                        catch
                        {
                        }
                        m_histories.RemoveAt(0);
                    }
                }
            }
            return(true);
        }
Esempio n. 8
0
        protected static void drawBuffer(System.Drawing.Graphics g)
        {
            //base.OnPaint(e);


            g.Clear(System.Drawing.Color.Black);

            wuerfel.punkte = Matrix.multiplizieren(wuerfel.punkte, dmy);
            wuerfel.punkte = Matrix.multiplizieren(wuerfel.punkte, dmz);
            wuerfel.punkte = Matrix.multiplizieren(wuerfel.punkte, dmz);
            wuerfel.punkte = Matrix.multiplizieren(wuerfel.punkte, dmx);
            double[][] punkte = Matrix.skalarMultiplizieren(wuerfel.punkte, 1.3 * System.Math.Cos(i * 0.04));


            for (int k = 0; k < 8; k++)
            {
                g.FillEllipse(bluebrush, (int)(center[0] - 2 + punkte[k][0] + (punkte[k][2] * 0.1)), (int)(center[1] - 2 + (punkte[k][1] + punkte[k][2] * 0.1)), 10, 10);
                //g.DrawLine(blue,center[0]+(int)punkte[k][0]+(int)(punkte[k][2]*0.1),(int)center[1]+(int)(punkte[k][1]+punkte[k][2]*0.1),0,0);
                //g.DrawLine(blue,center[0]+(int)punkte[k][0]+(int)(punkte[k][2]*0.1),(int)center[1]+(int)(punkte[k][1]+punkte[k][2]*0.1),0,0);
                //g.DrawLine(blue,center[0]+(int)punkte[k][0]+(int)(punkte[k][2]*0.1),(int)center[1]+(int)(punkte[k][1]+punkte[k][2]*0.1),0,70);
                //g.DrawLine(blue,center[0]+(int)punkte[k][0]+(int)(punkte[k][2]*0.1),(int)center[1]+(int)(punkte[k][1]+punkte[k][2]*0.1),100,0);
            }
            for (int l = 0; l < wuerfel.W.Length; l++)
            {
                wuerfel.W[l] = Matrix.multiplizieren(wuerfel.W[l], dmy);
                wuerfel.W[l] = Matrix.multiplizieren(wuerfel.W[l], dmz);
                wuerfel.W[l] = Matrix.multiplizieren(wuerfel.W[l], dmx);

                g.DrawLine(new System.Drawing.Pen(System.Drawing.Color.Aquamarine), (float)(center[0] + wuerfel.W[l][0][0] + wuerfel.W[l][0][2] * 0.1), (float)(center[1] + wuerfel.W[l][0][1] + wuerfel.W[l][0][2] * 0.1), (float)(center[0] + wuerfel.W[l][1][0] + wuerfel.W[l][1][2] * 0.1), (float)(center[1] + wuerfel.W[l][1][1] + wuerfel.W[l][1][2] * 0.1));
            }


            char[] sa = s.ToCharArray();
            if (cursor < s.Length)
            {
                cur = "";
            }



            for (int l = 0; l < cursor % s.Length; l++)
            {
                if (cursor < s.Length)
                {
                    cur += sa[l];
                }
            }

            /*if(s.Length>cursor) if(last!=cur.Length)
             * {
             *      last=cur.Length;
             *      sp.Play();
             * } */
            g.DrawString(cur, new System.Drawing.Font("Arial Bold", 8), new System.Drawing.SolidBrush(System.Drawing.Color.White), 143, 30, new System.Drawing.StringFormat(System.Drawing.StringFormat.GenericTypographic));
            if (cursor > s.Length)
            {
                g.DrawString(hp, new System.Drawing.Font("Arial Bold", 8), new System.Drawing.SolidBrush(System.Drawing.Color.Blue), 143, 105, new System.Drawing.StringFormat(System.Drawing.StringFormat.GenericTypographic));
            }
        }
Esempio n. 9
0
 public void BoldSegmentsInArea(List <Point> segments)
 {
     //выделение на pictureBox входящих в область отрезков
     _bitmap = new System.Drawing.Bitmap(pictureBox.Image);
     using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(_bitmap))
     {
         g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
         for (int i = 0; i < segments.Count - 1; i += 2)
         {
             Point p1 = segments[i];
             Point p2 = segments[i + 1];
             g.FillEllipse(System.Drawing.Brushes.Red, p1.X - 6 / 2, p1.Y - 6 / 2, 6, 6);
             g.FillEllipse(System.Drawing.Brushes.Red, p2.X - 6 / 2, p2.Y - 6 / 2, 6, 6);
             g.DrawLine(new System.Drawing.Pen(System.Drawing.Brushes.Red, 2), p1.X, p1.Y, p2.X, p2.Y);
         }
     }
     pictureBox.Refresh();
 }
Esempio n. 10
0
 public virtual void  paint(System.Drawing.Graphics gHintergrund)
 {
     if (m_Mode == 2)
     {
         SupportClass.GraphicsManager.Manager.SetColor(gHintergrund, m_Color);
         gHintergrund.FillEllipse(SupportClass.GraphicsManager.Manager.GetBrush(gHintergrund), m_Startpunkt.X, m_Startpunkt.Y, m_xRadius, m_yRadius);
         m_Mode = 3;
     }
 }
Esempio n. 11
0
        private void Draw_Point(System.Windows.Forms.PictureBox pictureBox, System.Drawing.Graphics g, System.Windows.Point pa)
        {
            float x1, y1;

            WorldToStreen(pictureBox, pa.X, pa.Y, out x1, out y1);

            g.DrawEllipse(RedPen, (float)(x1 - PiexlPoint * 0.5), (float)(y1 - PiexlPoint * 0.5), PiexlPoint, PiexlPoint);
            g.FillEllipse(RedBrush, (float)(x1 - PiexlPoint * 0.5), (float)(y1 - PiexlPoint * 0.5), PiexlPoint, PiexlPoint);
        }
Esempio n. 12
0
 public void draw()
 {
     //if (parent == null)
     //    return;
     System.Drawing.SolidBrush myBrush      = new System.Drawing.SolidBrush((type == CircleType.RED)?System.Drawing.Color.Red : System.Drawing.Color.Yellow);
     System.Drawing.Graphics   formGraphics = parent.CreateGraphics();
     formGraphics.FillEllipse(myBrush, new System.Drawing.Rectangle(x, y, width, height));
     myBrush.Dispose();
     formGraphics.Dispose();
 }
Esempio n. 13
0
 private void Representation_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
 {
     System.Drawing.Graphics g = e.Graphics;
     g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
     System.Drawing.Pen        p   = new System.Drawing.Pen(System.Drawing.Color.Tomato, 2);
     System.Drawing.SolidBrush myb = new System.Drawing.SolidBrush(System.Drawing.Color.White);
     g.DrawEllipse(p, 1, 1, 17, 17);
     g.FillEllipse(myb, 1, 1, 17, 17);
     p.Dispose();
 }
Esempio n. 14
0
        //TODO add this to DrawLines.
        private static void DrawPoints(System.Drawing.Graphics graphics, System.Drawing.Brush pointBrush, System.Drawing.PointF[] points, float radius)
        {
            float diameter = radius + radius;

            for (int i = 0; i < points.Length; i++)
            {
                System.Drawing.PointF point = points[i];
                graphics.FillEllipse(pointBrush, point.X - radius, point.Y - radius, diameter, diameter);
            }
        }
Esempio n. 15
0
        public override void Draw(System.Drawing.Graphics drawArea)
        {
            System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Yellow);
            drawArea.FillEllipse(myBrush, posX, posY, radius * 2, radius * 2);
            myBrush.Dispose();

            System.Drawing.Pen myPen = new System.Drawing.Pen(System.Drawing.Color.DarkOrange);
            myPen.Width = 5;
            drawArea.DrawEllipse(myPen, posX, posY, radius * 2, radius * 2);
            myPen.Dispose();
        }
Esempio n. 16
0
        /// <summary>
        /// Make the bitmap for the wheel.
        /// </summary>
        private void _makeBitmap()
        {
            // If there already is a bitmap then dispose it.
            if (null != _bitmap)
            {
                _bitmap.Dispose();
            }

            // Get the size.
            int w = this.ClientRectangle.Width;
            int h = this.ClientRectangle.Height;

            // If the size is too small then punt.
            if (w <= 0 || h <= 0)
            {
                return;
            }

            // The number of points we use is a function of radius.
            int num = (360 * this.Radius) / 100;

            // Never go below this many points.
            num = System.Math.Max(num, 10);

            // Make the points around the perimeter.
            float radius = this.RadiusF;

            System.Drawing.PointF[] points = CadKit.Color.Wheel._makePoints(this.CenterF, radius, num);

            // Make the circle.
            using (System.Drawing.Drawing2D.PathGradientBrush brush = new System.Drawing.Drawing2D.PathGradientBrush(points))
            {
                CadKit.Color.HSV currentHSV = new HSV(this.Color);
                RGB grayscale = new RGB(new HSV(0, 0, currentHSV.v));
                brush.CenterColor    = System.Drawing.Color.FromArgb(255, grayscale.r, grayscale.g, grayscale.b);
                brush.CenterPoint    = this.CenterF;
                brush.SurroundColors = CadKit.Color.Wheel._makeColors(num, currentHSV.v);

                // Make new bitmap.
                float diameter = radius * 2;
                _bitmap = new System.Drawing.Bitmap(w, h, System.Drawing.Imaging.PixelFormat.Format32bppArgb);

                // Make a new graphic from the bitmap.
                using (System.Drawing.Graphics graphic = System.Drawing.Graphics.FromImage(_bitmap))
                {
                    // This writes to the bitmap.
                    graphic.FillEllipse(brush, this.ClientRectangle);
                }
            }
        }
Esempio n. 17
0
 /// <summary>
 /// Draws the when normal.
 /// </summary>
 /// <param name="image">The image.</param>
 protected override void DrawWhenNormal(System.Drawing.Graphics image)
 {
     if (brushGreen == null && brushRed == null && brushYellow == null)
     {
         brushGreen  = System.Drawing.Brushes.White;
         brushRed    = System.Drawing.Brushes.White;
         brushYellow = System.Drawing.Brushes.White;
     }
     if (this.Position == 1 || this.Position == 4)
     {
         this.intervalX = this.X - 22;
         this.intervalY = this.Y + 10;
     }
     else
     {
         this.intervalX = this.X + 22;
         this.intervalY = this.Y + 10;
     }
     image.DrawString(this.GreenSeconds.ToString(), new System.Drawing.Font(System.Drawing.FontFamily.GenericSansSerif, 14), System.Drawing.Brushes.Black, this.intervalX, this.intervalY);
     image.FillRectangle(System.Drawing.Brushes.Black, this.X + 2, this.Y + 2, 16, 46);
     image.FillEllipse(brushRed, this.X + 3, this.Y + 4, 12, 12);
     image.FillEllipse(brushYellow, this.X + 3, this.Y + 19, 12, 12);
     image.FillEllipse(brushGreen, this.X + 3, this.Y + 34, 12, 12);
 }
Esempio n. 18
0
        /// <summary>
        /// 绘制坐标系
        /// </summary>
        /// <param name="g"></param>
        private void Draw_CoordinateSystem(System.Windows.Forms.PictureBox pictureBox, System.Drawing.Graphics g)
        {
            float x1, y1;
            var   pa = new System.Drawing.PointF();
            var   pb = new System.Drawing.PointF();

            // 绘制原点
            {
                WorldToStreen(pictureBox, 0, 0, out x1, out y1);

                g.DrawEllipse(RedPen, (float)(x1 - PiexlPoint * 0.5), (float)(y1 - PiexlPoint * 0.5), PiexlPoint, PiexlPoint);
                g.FillEllipse(RedBrush, (float)(x1 - PiexlPoint * 0.5), (float)(y1 - PiexlPoint * 0.5), PiexlPoint, PiexlPoint);
            }

            // 绘制 X 轴
            {
                pa.X = 0;
                pa.Y = 0;
                WorldToStreen(pictureBox, pa.X, pa.Y, out x1, out y1);
                pa.X = x1;
                pa.Y = y1;

                pb.X = 30;
                pb.Y = 0;
                WorldToStreen(pictureBox, pb.X, pb.Y, out x1, out y1);
                pb.X = x1;
                pb.Y = y1;

                g.DrawLine(RedPen, pa, pb);
            }

            // 绘制 Y 轴
            {
                pa.X = 0;
                pa.Y = 0;
                WorldToStreen(pictureBox, pa.X, pa.Y, out x1, out y1);
                pa.X = x1;
                pa.Y = y1;

                pb.X = 0;
                pb.Y = 30;
                WorldToStreen(pictureBox, pb.X, pb.Y, out x1, out y1);
                pb.X = x1;
                pb.Y = y1;

                g.DrawLine(BluePen, pa, pb);
            }
        }
Esempio n. 19
0
        internal void Draw(Transformation trans, System.Drawing.Graphics g)
        {
            if (!IsVisible)
            {
                return;
            }
            if (Location.X == 0 && Location.Y == 0)
            {
                return;
            }

            System.Drawing.Point p = trans.CalculatePixel(Location);

            System.Drawing.RectangleF rect = new System.Drawing.RectangleF(p.X - 5, p.Y - 5, 10, 10);
            g.FillEllipse(new System.Drawing.SolidBrush(StyleManager.CarriageDefaultColor), rect);
        }
 /// <summary>
 /// Code to dynamically generate icons by Joshua Flanagan on CodeProject.com
 /// https://www.codeproject.com/Articles/7122/Dynamically-Generating-Icons-safely
 /// </summary>
 public System.Drawing.Icon CreateIcon(System.String text, System.Drawing.Brush fgcolor, System.Drawing.Brush bgcolor)
 {
     System.Drawing.Icon   icon   = null;
     System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(16, 16);
     System.Drawing.Font   font   = new System.Drawing.Font(System.Drawing.FontFamily.GenericSansSerif, 8F, System.Drawing.FontStyle.Bold);
     using (System.Drawing.Graphics graphic = System.Drawing.Graphics.FromImage(bitmap))
     {
         graphic.FillEllipse(bgcolor, 0, 0, 16, 16);
         System.Drawing.SizeF textsize = graphic.MeasureString(text, font);
         System.Single        x        = System.Convert.ToSingle(System.Math.Floor((bitmap.Width - textsize.Width) / 2));
         System.Single        y        = System.Convert.ToSingle(System.Math.Ceiling((bitmap.Height - textsize.Height) / 2));
         graphic.DrawString(text, font, fgcolor, x, y, System.Drawing.StringFormat.GenericDefault);
         icon = System.Drawing.Icon.FromHandle(bitmap.GetHicon( ));
     }
     return(icon);
 }
        public void metodoRecursivo(System.Drawing.Graphics g)
        {
            if (this.met < this.cs.Length)
            {
                g.FillEllipse(
                    new System.Drawing.SolidBrush(System.Drawing.Color.Red),
                    new System.Drawing.Rectangle(this.escala + cs[this.met].X * this.multiplicadorx,
                                                 (int)((380 - cs[this.met].Y * this.multiplicador) / divisor),
                                                 5, 5));
                this.poligono[this.lpoligono++] = new System.Drawing.Point(
                    //poligono[this.lpoligono++] = new System.Drawing.Point(
                    this.escala + cs[this.met].X * this.multiplicadorx,
                    (int)((380 - cs[this.met++].Y * this.multiplicador) / divisor));

                metodoRecursivo(g);
            }
        }
Esempio n. 22
0
        // Draw an individual point on the screen as a small filled circle
        //  with diameter of 1 logical unit
        public void DrawPoint(Point p)
        {
            System.Drawing.Graphics g         = this;
            System.Drawing.Point    scrCenter = viewportToScreen(p);
            Point scrRadii = scaleToScreen(new Point(.5, .5));

            System.Drawing.Rectangle boundingRec = new System.Drawing.Rectangle(
                (int)Math.Round(scrCenter.X - scrRadii.X), (int)Math.Round(scrCenter.Y - scrRadii.Y),
                (int)Math.Round(2 * scrRadii.X), (int)Math.Round(2 * scrRadii.Y));
            //g.DrawEllipse(CurrentPen as System.Drawing.Pen, boundingRec);
            System.Drawing.Brush b = CurrentBrush as System.Drawing.Brush;
            if (p.Color != null)
            {
                b = new System.Drawing.SolidBrush(ToSysColor(p.Color));
            }
            g.FillEllipse(b, boundingRec);
        }
Esempio n. 23
0
 public void ShowPoints(List <Point> points, IClippingWindow window)
 {
     _bitmap = new System.Drawing.Bitmap(pictureBox.Size.Width, pictureBox.Size.Height);
     using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(_bitmap))
     {
         g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
         for (int i = 0; i < points.Count; i++)
         {
             g.FillEllipse(System.Drawing.Brushes.Black, points[i].X - 5 / 2, points[i].Y - 5 / 2, 5, 5);
             if (i > 0)
             {
                 g.DrawLine(new System.Drawing.Pen(System.Drawing.Brushes.Black, 1), points[i - 1].X, points[i - 1].Y, points[i].X, points[i].Y);
             }
         }
         DrawClippingWindow(window, g);
     }
     pictureBox.Refresh();
 }
Esempio n. 24
0
        public override System.Drawing.Bitmap Render(System.Drawing.Graphics g, System.Drawing.Bitmap b, params int[] options)
        {
            System.Drawing.Color     bc = DrawingBackColor;
            System.Drawing.Color     fc = DrawingForeColor;
            System.Drawing.Rectangle r  = new System.Drawing.Rectangle()
            {
                Height = b.Height, Width = b.Width
            };
            r.Inflate(-1, -1);
            g.Clear(System.Drawing.Color.White);
            g.FillEllipse(new System.Drawing.SolidBrush(bc), r);
            g.DrawEllipse(new System.Drawing.Pen(fc), r);
            string s = options[0].ToString();

            r.Inflate(s.Length > 1 ? 4 : -4, -2);
            System.Drawing.Font fnt = new System.Drawing.Font("Microsoft Sans Serif", 12, System.Drawing.FontStyle.Bold);
            g.DrawString(s, fnt, new System.Drawing.SolidBrush(fc), r);
            b.MakeTransparent(System.Drawing.Color.White);
            return(b);
        }
Esempio n. 25
0
        // implement Draw() (step 5)
        public void Draw(System.Drawing.Graphics image)
        {
            System.Drawing.Brush brush = new System.Drawing.SolidBrush(color);
            System.Drawing.Pen   pen   = new System.Drawing.Pen(color);

            // Determine if circle, since use [upperLeft, width, height, !vertices] only
            if (name.Equals("Circle"))
            {
                image.DrawEllipse(pen, UpperLeft.X, UpperLeft.Y, Height, Width);
                image.FillEllipse(brush, new System.Drawing.Rectangle(UpperLeft.X, UpperLeft.Y, Width, Height));
            }
            else
            {
                image.DrawPolygon(pen, Vertices);
                image.FillPolygon(brush, Vertices);
            }

            brush.Dispose();
            pen.Dispose();
        }
Esempio n. 26
0
        internal void Draw(Transformation trans, System.Drawing.Graphics g)
        {
            if (!IsVisible)
            {
                return;
            }

            if (Location.X == 0 && Location.Y == 0)
            {
                DrawTrack(trans, g);
                return;
            }
            System.Drawing.Point p = trans.CalculatePixel(Location);

            int size = 5;

            if (IsHighlighted)
            {
                size = StyleManager.PassengerHightlightSize;
            }
            else
            {
                size = StyleManager.PassengerSize;
            }

            System.Drawing.RectangleF rect = new System.Drawing.RectangleF(p.X - size, p.Y - size, size * 2, size * 2);
            g.FillEllipse(new System.Drawing.SolidBrush(StyleManager.GetPassengerColor(Status, IsHighlighted)), rect);

            if (IsHighlighted)
            {
                g.DrawEllipse(new System.Drawing.Pen(new System.Drawing.SolidBrush(System.Drawing.Color.White), 2), rect);
            }

            DrawID(trans, g);
            DrawTrack(trans, g);
        }
Esempio n. 27
0
 public override void FillCircle(double x, double y, double radius)
 {
     _gfx.FillEllipse(_currentFillBrush, (float)x, (float)y, (float)(radius + radius), (float)(radius + radius));
 }
Esempio n. 28
0
 public void fillOval(int x, int y, int width, int height)
 {
     nativeGraphics.FillEllipse(brush, x, y, width, height);
 }
Esempio n. 29
0
    private void GenerateImage()
    {
        System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap
                                           (this.width, this.height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
        System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmap);
        g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
        System.Drawing.Rectangle            rect       = new System.Drawing.Rectangle(0, 0, this.width, this.height);
        System.Drawing.Drawing2D.HatchBrush hatchBrush =
            new System.Drawing.Drawing2D.HatchBrush(
                System.Drawing.Drawing2D.HatchStyle.SmallConfetti,
                System.Drawing.Color.LightGray, System.Drawing.Color.White);
        g.FillRectangle(hatchBrush, rect);
        System.Drawing.SizeF size;
        float fontSize = rect.Height + 1;

        System.Drawing.Font font;

        do
        {
            fontSize--;
            font = new System.Drawing.Font(System.Drawing.FontFamily.GenericSansSerif, fontSize, System.Drawing.FontStyle.Bold);
            size = g.MeasureString(this.text, font);
        } while (size.Width > rect.Width);
        System.Drawing.StringFormat format = new System.Drawing.StringFormat();
        format.Alignment     = System.Drawing.StringAlignment.Center;
        format.LineAlignment = System.Drawing.StringAlignment.Center;
        System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
        //path.AddString(this.text, font.FontFamily, (int) font.Style,
        //    font.Size, rect, format);
        path.AddString(this.text, font.FontFamily, (int)font.Style, 75, rect, format);
        float v = 4F;

        System.Drawing.PointF[] points =
        {
            new System.Drawing.PointF(this.random.Next(rect.Width) / v, this.random.Next(
                                          rect.Height) / v),
            new System.Drawing.PointF(rect.Width - this.random.Next(rect.Width) / v,
                                      this.random.Next(rect.Height) / v),
            new System.Drawing.PointF(this.random.Next(rect.Width) / v,
                                      rect.Height - this.random.Next(rect.Height) / v),
            new System.Drawing.PointF(rect.Width - this.random.Next(rect.Width) / v,
                                      rect.Height - this.random.Next(rect.Height) / v)
        };
        System.Drawing.Drawing2D.Matrix matrix = new System.Drawing.Drawing2D.Matrix();
        matrix.Translate(0F, 0F);
        path.Warp(points, rect, matrix, System.Drawing.Drawing2D.WarpMode.Perspective, 0F);
        hatchBrush = new System.Drawing.Drawing2D.HatchBrush(
            System.Drawing.Drawing2D.HatchStyle.Percent10
            , System.Drawing.Color.Black, System.Drawing.Color.SkyBlue);
        g.FillPath(hatchBrush, path);
        int m = System.Math.Max(rect.Width, rect.Height);

        for (int i = 0; i < (int)(rect.Width * rect.Height / 30F); i++)
        {
            int x = this.random.Next(rect.Width);
            int y = this.random.Next(rect.Height);
            int w = this.random.Next(m / 50);
            int h = this.random.Next(m / 50);
            g.FillEllipse(hatchBrush, x, y, w, h);
        }
        font.Dispose();
        hatchBrush.Dispose();
        g.Dispose();
        this.image = bitmap;
    }
Esempio n. 30
0
        public void DrawCircle(Point c, double r, UInt32?edgeColor = null, UInt32?fillColor = null)
        {
            System.Drawing.Graphics g         = this;
            System.Drawing.Point    scrCenter = viewportToScreen(c);
            Point scrRadii = scaleToScreen(new Point(r, r));

            System.Drawing.Rectangle boundingRec = new System.Drawing.Rectangle(
                (int)Math.Round(scrCenter.X - scrRadii.X), (int)Math.Round(scrCenter.Y - scrRadii.Y),
                (int)Math.Round(2 * scrRadii.X), (int)Math.Round(2 * scrRadii.Y));
            System.Drawing.Pen p = CurrentPen as System.Drawing.Pen;
            if (edgeColor != null)
            {
                p = new System.Drawing.Pen(ToSysColor(edgeColor));
            }
            g.DrawEllipse(p, boundingRec);
            if (fillColor != null)
            {
                System.Drawing.Brush b = new System.Drawing.SolidBrush(ToSysColor(fillColor));
                g.FillEllipse(b, boundingRec);
            }

            // Point[] circle = new Point[circularTessellation];
            // Point[] quarterCircle = new Point[circularTessellation/4];
            // double deltaAngle = (2 * Math.PI) / circularTessellation;
            // // first half quadrent
            // for (int idx = 0; idx < circularTessellation / 8; idx++)
            // {
            //     double angle = (deltaAngle * idx) + (deltaAngle/2);
            //     double x = Math.Sin(angle) * r;
            //     double y = Math.Cos(angle) * r;
            //     quarterCircle[idx] = new Point(x, y);
            //     circle[idx] = quarterCircle[idx].Translate(c);
            // }
            // //DrawPolygon(g, circle);
            // // second half quadrent
            // for (int idx = 0; idx < circularTessellation / 8; idx++)
            // {
            //     quarterCircle[idx + circularTessellation / 8] =
            //         new Point(quarterCircle[(circularTessellation / 8) - idx - 1].Y,
            //                     quarterCircle[(circularTessellation / 8) - idx - 1].X);
            //     circle[idx + circularTessellation / 8] = quarterCircle[idx + circularTessellation / 8].Translate(c);
            // }
            // //DrawPolygon(g, circle);
            // // second quadrant
            // for (int idx = 0; idx < circularTessellation / 4; idx++)
            // {
            //     circle[idx + circularTessellation / 4] = quarterCircle[circularTessellation / 4 - idx - 1].Scale(1, -1).Translate(c);
            // }
            // //DrawPolygon(g, circle);
            // // third quadrent
            // for (int idx = 0; idx < circularTessellation / 4; idx++)
            // {
            //     circle[idx + circularTessellation / 2] = quarterCircle[idx].Scale(-1, -1).Translate(c);
            // }
            // //DrawPolygon(g, circle);
            //// fourth quadrent
            // for (int idx = 0; idx < circularTessellation / 4; idx++)
            // {
            //     circle[idx + ((circularTessellation * 3) / 4)] = quarterCircle[circularTessellation / 4 - idx - 1].Scale(-1, 1).Translate(c);
            // }
            // DrawPolygon(g, circle);
        }