FillPolygon() public method

public FillPolygon ( Brush brush, Point points, FillMode fillMode = FillMode.Alternate ) : void
brush Brush
points Point
fillMode FillMode
return void
		static protected void DrawBrick (Graphics graphics, Brush b1, Brush b2, Brush b3)
		{
			if (graphics == null) return;
			graphics.FillPolygon (b1, brickPoints1);
			graphics.FillPolygon (b2, brickPoints2);
			graphics.FillPolygon (b3, brickPoints3);
		}
        public static void RepertoryImage(Graphics drawDestination)
        {
            StringFormat itemStringFormat = new StringFormat();
            RectangleF itemBox = new RectangleF(10, 30, 42, 10);
            RectangleF itemBox2 = new RectangleF(60, 48, 10, 10);
            itemStringFormat.Alignment = StringAlignment.Center;
            itemStringFormat.LineAlignment = StringAlignment.Far;
            drawDestination.DrawLine(Pens.LightGray,10,10,10,70);
            if (mMscStyle == MscStyle.SDL){
                PointF[] capPolygon = new PointF[3];
                capPolygon[0] = new PointF(61, 40);
                capPolygon[1] = new PointF(53, 44);
                capPolygon[2] = new PointF(53, 36);
                drawDestination.FillPolygon(Brushes.Black,capPolygon);
                drawDestination.DrawString("Lost",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
                drawDestination.DrawString("g",new Font("Arial",8),Brushes.Black,itemBox2,itemStringFormat);
                drawDestination.DrawLine(Pens.Black,10, 40, 60,40);
                drawDestination.FillEllipse(Brushes.Black, new RectangleF(60,35, 10,10));
            }
            else if(mMscStyle == MscStyle.UML2){

                drawDestination.DrawString("Lost",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
                drawDestination.DrawString("g",new Font("Arial",8),Brushes.Black,itemBox2,itemStringFormat);
                drawDestination.DrawLine(Pens.Black,10, 40, 60,40);
                drawDestination.DrawLine(Pens.Black,60, 40, 54,43);
                drawDestination.DrawLine(Pens.Black,60, 40, 54,37);
                drawDestination.FillEllipse(Brushes.Black, new RectangleF(60,35, 10,10));

            }
            itemStringFormat.Dispose();
        }
Example #3
1
		internal override void Draw(Graphics g)
		{
			IsInvalidated = false;

			Rectangle r = BaseElement.GetUnsignedRectangle(new Rectangle(location, size));

			Point[] points = new Point[5];
			points[0] = new Point(r.X + 0, r.Y + 0);
			points[1] = new Point(r.X + 0, r.Y + r.Height);
			points[2] = new Point(r.X + r.Width, r.Y + r.Height);

			//Fold
			points[3] = new Point(r.X + r.Width, r.Y + foldSize.Height);
			points[4] = new Point(r.X + r.Width - foldSize.Width, r.Y + 0);

			//foreach(Point p in points) p.Offset(location.X, location.Y);

			g.FillPolygon(GetBrush(r), points, FillMode.Alternate);
			g.DrawPolygon(new Pen(borderColor, borderWidth), points);

			g.DrawLine(new Pen(borderColor, borderWidth),
			           new Point(r.X + r.Width - foldSize.Width, r.Y + foldSize.Height),
			           new Point(r.X + r.Width, r.Y + foldSize.Height));

			g.DrawLine(new Pen(borderColor, borderWidth),
			           new Point(r.X + r.Width - foldSize.Width, r.Y + 0),
			           new Point(r.X + r.Width - foldSize.Width, r.Y + 0 + foldSize.Height));
		}
        public void DrawIsometricView(Graphics g)
        {
            Point3[] ptsBottom = CircleCoordinates (-h / 2);
            var ptaBottom = new PointF[ptsBottom.Length];
            Point3[] ptsTop = CircleCoordinates (h / 2);
            var ptaTop = new PointF[ptsTop.Length];
            Matrix3 m = Matrix3.Axonometric (35.26f, -45);
            for (int i = 0; i < ptsBottom.Length; i++) {
                ptsBottom [i].Transform (m);
                ptaBottom [i] = Point2D (new CGPoint (ptsBottom [i].X, ptsBottom [i].Y));
                ptsTop [i].Transform (m);
                ptaTop [i] = Point2D (new CGPoint (ptsTop [i].X, ptsTop [i].Y));
            }

            var ptf = new PointF[4];
            for (int i = 1; i < ptsTop.Length; i++) {
                ptf [0] = ptaBottom [i - 1];
                ptf [1] = ptaTop [i - 1];
                ptf [2] = ptaTop [i];
                ptf [3] = ptaBottom [i];
                if (i < 5 || i > ptsTop.Length - 12) {
                    g.FillPolygon (Brushes.White, ptf);
                    g.DrawPolygon (Pens.Black, ptf);
                }
            }

            g.FillPolygon (Brushes.White, ptaTop);
            g.DrawPolygon (Pens.Black, ptaTop);
        }
Example #5
0
        Bitmap drawBattleDice(Graphics gDice, Bitmap diceBitmap, Pen myPen, Brush myBrush, int level, int randomNumber)
        {
            gDice.Clear(Color.Transparent);
            PointF[] Verticies;
                Verticies = new PointF[3];
                Verticies[0] = new PointF(0, pbDice.Height - 1);
                Verticies[1] = new PointF(pbDice.Width - 1, pbDice.Height - 1);
                Verticies[2] = new PointF(pbDice.Width / 2.0f, (float)(pbDice.Height - 1 - pbDice.Height / 2 * Math.Sqrt(3)));

                if (level == 1)
                    gDice.FillPolygon(new SolidBrush(Color.Green), Verticies);
                else if(level==2)
                    gDice.FillPolygon(new SolidBrush(Color.Red), Verticies);
                else if (level == 3)
                    gDice.FillPolygon(new SolidBrush(Color.Blue), Verticies);
                else if (level == 4)
                    gDice.FillPolygon(new SolidBrush(Color.Purple), Verticies);
                myPen.Color = Color.Black;
                gDice.DrawPolygon(myPen, Verticies);
            Font font = new Font("Times New Roman", 16, FontStyle.Bold);
            StringFormat format = new StringFormat();
            Brush whiteBrush = new SolidBrush(Color.White);
            format.Alignment = StringAlignment.Center;
            RectangleF rect = new RectangleF(pbDice.Width / 2 - 20 , pbDice.Height / 2 - 4 , 40 , 25);
            if (randomNumber == 0)
            {
                rect.Y = pbDice.Height / 2 + 6;
                gDice.DrawString("Roll", new Font("Times New Roman", 14, FontStyle.Italic), whiteBrush, rect, format);
            }
            else
            {
                gDice.DrawString(randomNumber.ToString(), font, whiteBrush, rect, format);
            }
            return diceBitmap;
        }
        public override void Draw(Graphics g, TimeRuler ruler)
        {
            if (ruler.Orientation == enumOrientation.orHorizontal)
            {
                int iSecondPos = ruler.ScaleValueToPixel((double) _StartMillisecond);
                int x = iSecondPos - 1;
                int y1 = ruler.HeaderOffset/2, y2 = ruler.Height;
                g.DrawLine(new Pen(new SolidBrush(this.Color), 3), x, y1, x, y2);

                Point left = new Point(iSecondPos - y1, 1);
                Point right = new Point(iSecondPos + y1, 1);
                Point bottom = new Point(iSecondPos, ruler.HeaderOffset/2);
                Point[] trianglePoints = {left, right, bottom};
                g.FillPolygon(new SolidBrush(this.Color), trianglePoints, System.Drawing.Drawing2D.FillMode.Winding);

                g.DrawPolygon(new Pen(new SolidBrush(ruler.ForeColor)), trianglePoints);
            }
            else
            {
                int iSecondPos = ruler.ScaleValueToPixel((double) _StartMillisecond);
                int y = iSecondPos - 1;
                int x1 = ruler.HeaderOffset/2, x2 = ruler.Height;
                g.DrawLine(new Pen(new SolidBrush(this.Color), 3), x1, y, x2, y);

                Point left = new Point(1, iSecondPos - x1);
                Point right = new Point(1, iSecondPos + x1);
                Point bottom = new Point(ruler.HeaderOffset/2, iSecondPos);
                Point[] trianglePoints = {left, right, bottom};
                g.FillPolygon(new SolidBrush(this.Color), trianglePoints, System.Drawing.Drawing2D.FillMode.Winding);

                g.DrawPolygon(new Pen(new SolidBrush(ruler.ForeColor)), trianglePoints);
            }
        }
Example #7
0
		public override void Draw(Graphics graphics)
		{
			if (graphics == null) return;
			graphics.FillPolygon (Brushes.DarkGoldenrod, lightningPoints2);
			graphics.FillPolygon (Brushes.DarkGoldenrod, lightningPoints3);
			graphics.FillPolygon (Brushes.DarkGoldenrod, lightningPoints4);
			graphics.FillPolygon (Brushes.Gold, lightningPoints1);
		}
Example #8
0
 public static void RepertoryImage(Graphics drawDestination, MessageStyle style, MscStyle style2)
 {
     StringFormat itemStringFormat = new StringFormat();
     RectangleF itemBox = new RectangleF(10, 28, 60, 15);
     Pen pen = new Pen(Color.Black);
     float[] pattern = {3f,3f};
     itemStringFormat.Alignment = StringAlignment.Center;
     drawDestination.DrawString("Message",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
     drawDestination.DrawLine(Pens.DarkGray,5,10,5,70);
     drawDestination.DrawLine(Pens.DarkGray,75,10,75,70);
     if (style2 == MscStyle.SDL){
         if((style == MessageStyle.Normal)||(style == MessageStyle.Synchron)){
             drawDestination.DrawLine(Pens.Black,5,40,75,40);
             PointF[] messagePolygon = new PointF[3];
             messagePolygon[0] = new PointF(5, 40);
             messagePolygon[1] = new PointF(5+8, 40-4);
             messagePolygon[2] = new PointF(5+8, 40+4);
             drawDestination.FillPolygon(Brushes.Black,messagePolygon);
         }
         else if (style == MessageStyle.Dashed){
             pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom;
             pen.DashPattern = pattern;
             drawDestination.DrawLine(pen,5,40,75,40);
             PointF[] messagePolygon = new PointF[3];
             messagePolygon[0] = new PointF(5, 40);
             messagePolygon[1] = new PointF(5+8, 40-4);
             messagePolygon[2] = new PointF(5+8, 40+4);
             drawDestination.FillPolygon(Brushes.Black,messagePolygon);
             pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
         }
     }
     else if(style2 == MscStyle.UML2){
         if( style == MessageStyle.Normal){
             drawDestination.DrawLine(Pens.Black,5,40,75,40);
             drawDestination.DrawLine(Pens.Black,5,40,5+8, 40-4);
             drawDestination.DrawLine(Pens.Black,5,40,5+8, 40+4);
         }
         else if( style == MessageStyle.Dashed){
             pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom;
             pen.DashPattern = pattern;
             drawDestination.DrawLine(pen,5,40,75,40);
             pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
             drawDestination.DrawLine(Pens.Black,5,40,5+8, 40-4);
             drawDestination.DrawLine(Pens.Black,5,40,5+8, 40+4);
         }
         else if( style == MessageStyle.Synchron){
             drawDestination.DrawLine(Pens.Black,5,40,75,40);
             PointF[] messagePolygon = new PointF[3];
             messagePolygon[0] = new PointF(5, 40);
             messagePolygon[1] = new PointF(5+8, 40-4);
             messagePolygon[2] = new PointF(5+8, 40+4);
             drawDestination.FillPolygon(Brushes.Black,messagePolygon);
         }
     }
     pen.Dispose();
     itemStringFormat.Dispose();
 }
Example #9
0
        public static void Draw(Graphics g)
        {
            Point[] p = { new Point(240, 110), new Point(440, 110), new Point(510, 150), new Point(300, 150) };
            TextureBrush tBrush = new TextureBrush(Image.FromFile(@"Images\0073.jpg"));
            g.FillPolygon(tBrush, p);

            Point[] p1 = { new Point(240, 110), new Point(300, 150), new Point(300, 360), new Point(240, 310) };
            HatchBrush hBrush = new HatchBrush(HatchStyle.DashedDownwardDiagonal, Color.Violet, Color.White);
            g.FillPolygon(hBrush, p1);
        }
Example #10
0
        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            g = e.Graphics;

            Point[] Triangle =
            {
                new Point (100, 5),
                new Point(33, 108),
                new Point(167, 108),
            };
            g.DrawPolygon(p, Triangle);
            g.FillPolygon(b, Triangle);

            g.DrawRectangle(p, 33, 108, 134, 100);
            g.FillRectangle(b, 33, 108, 134, 100);
            
            g.FillEllipse(new SolidBrush(Color.Red), 85, 68, 30, 30);

            Point[] Door =
            {
                new Point(124, 167),
                new Point(124, 208),
                new Point(167, 167),
                new Point (167, 208),
            };
            g.DrawRectangle(p, 124, 167, 42, 41);
            g.FillRectangle(new SolidBrush (Color.Gray), 124, 167, 42, 41);

            g.DrawLine(p, 145, 190, 150, 190);

            g.DrawRectangle(p, 33, 130, 35, 35);
            g.FillRectangle(new SolidBrush(Color.White), 33, 130, 35, 35);
            g.DrawLine(p, 33, 148, 68, 148);
            g.DrawLine(p, 51, 130, 51, 165);

            g.DrawLine(p2, 334, 210, 334, 165);

            Point[] PolyPoints =
            {
                new Point (334, 165),
                new Point (334, 125),
                new Point (354, 136),
                new Point (354, 156),
                new Point (334, 165),
                new Point (314, 156),
                new Point (314, 136),
                new Point (334, 125),
            };
            g.DrawPolygon(p, PolyPoints);
            g.FillPolygon(new SolidBrush(Color.Yellow), PolyPoints);
            g.DrawPolygon(new Pen(Color.Red, 3), PolyPoints);

            g.DrawLine(new Pen (Color.Red, 3), 314, 136, 354, 156);
            g.DrawLine(new Pen(Color.Red, 3), 314, 156, 354, 136);
        }
        /// <summary>
        /// Draw Function.</summary>
        /// <param name="g">Graphics for Drawing</param>
        public void Draw(Graphics g)
        {
            g.FillRectangle(Brushes.Yellow, centerIndicator);
            g.DrawRectangle(Pens.Black, centerIndicator);

            g.FillPolygon(Brushes.Yellow, leftIndicator);
            g.DrawPolygon(Pens.Black, leftIndicator);

            g.FillPolygon(Brushes.Yellow, rightIndicator);
            g.DrawPolygon(Pens.Black, rightIndicator);
        }
Example #12
0
        public static void DrawBone(Bone b, Graphics graph, PointF rootPos, bool selected = false)
        {
            if (b.IsRoot)
            {
                if (selected)
                {
                    graph.DrawEllipse(Pens.Orange, rootPos.X - 30, rootPos.Y - 30, 60, 60);
                }
                else
                {
                    graph.DrawEllipse(Pens.Black, rootPos.X - 30, rootPos.Y - 30, 60, 60);
                }
            }
            else
            {
                PointV p0 = new PointV(b.StartPoint);
                PointV p3 = new PointV(b.EndPoint);
                PointV p1 = p3 - p0;
                PointV p2 = p1.Rotate(-0.2745);
                p1 = p1.Rotate(0.2745);
                p2.Length = p2.Length * 0.2;
                p1.Length = p1.Length * 0.2;
                p2 = p2 + p0;
                p1 = p1 + p0;
                Pen pen0 = new Pen(Color.Black);
                Brush brush0 = new SolidBrush(Color.FromArgb(180, Color.DarkGray));
                Pen pen1 = new Pen(Color.Black);
                pen1.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
                PointF[] pts = new PointF[] { p0.Add(rootPos).Point, p1.Add(rootPos).Point,
                        p3.Add(rootPos).Point, p2.Add(rootPos).Point };
                if (selected)
                {
                    brush0 = new SolidBrush(Color.FromArgb(180, Color.Orange));
                    pen1.Color = Color.Orange;
                    pen0.Color = Color.Orange;
                    graph.DrawPolygon(pen0, pts);
                    graph.FillPolygon(brush0, pts);
                    graph.DrawLine(pen1, PointV.Add(rootPos, b.StartPoint), PointV.Add(rootPos, b.Parent.EndPoint));

                }
                else
                {
                    graph.DrawPolygon(pen0, pts);
                    graph.FillPolygon(brush0, pts);
                    graph.DrawLine(pen1, PointV.Add(rootPos, b.StartPoint), PointV.Add(rootPos, b.Parent.EndPoint));
                }

            }
        }
 public static void RepertoryImage(Graphics drawDestination)
 {
     StringFormat itemStringFormat = new StringFormat();
     RectangleF itemBox = new RectangleF(5, 15, 30, 15);
     RectangleF itemBox2 = new RectangleF(5, 35, 70, 15);
     itemStringFormat.Alignment = StringAlignment.Near;
     itemStringFormat.LineAlignment = StringAlignment.Near;
     PointF[] statePolygon = new PointF[5];
     statePolygon[0] = new PointF(5,15);
     statePolygon[1] = new PointF(40,15);
     statePolygon[2] = new PointF(40,25);
     statePolygon[3] = new PointF(35,30);
     statePolygon[4] = new PointF(5,30);
     drawDestination.FillPolygon(Brushes.White,statePolygon);
     drawDestination.DrawPolygon(Pens.LightGray,statePolygon);
     drawDestination.DrawRectangle(Pens.LightGray,5,15,70,50);
     drawDestination.DrawString("frag",new Font("Arial",8,FontStyle.Regular),Brushes.LightGray,itemBox,itemStringFormat);
     Pen rPen = new Pen(Color.Black);
     float[] pattern = {4f,4f};
     rPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom;
     rPen.DashPattern = pattern;
     itemStringFormat.Alignment = StringAlignment.Center;
     drawDestination.DrawString("separator",new Font("Arial",8,FontStyle.Italic),Brushes.Black,itemBox2,itemStringFormat);
     drawDestination.DrawLine(rPen, 5, 50, 75, 50);
     rPen.Dispose();
     itemStringFormat.Dispose();
 }
Example #14
0
		public void DrawGlyph(Graphics g)
		{
			if (isMouseOver)
			{
				Color fill = renderer.ColorTable.ButtonSelectedHighlight; //Color.FromArgb(35, SystemColors.Highlight);
				g.FillRectangle(new SolidBrush(fill), glyphRect);
				Rectangle borderRect = glyphRect;

				borderRect.Width--;
				borderRect.Height--;

				g.DrawRectangle(SystemPens.Highlight, borderRect);
			}

			SmoothingMode bak = g.SmoothingMode;

			g.SmoothingMode = SmoothingMode.Default;

			using (Pen pen = new Pen(Color.Black))
			{
				pen.Width = 2;

				g.DrawLine(pen, new Point(glyphRect.Left + (glyphRect.Width / 3) - 2, glyphRect.Height / 2 - 1),
					new Point(glyphRect.Right - (glyphRect.Width / 3), glyphRect.Height / 2 - 1));
			}

			g.FillPolygon(Brushes.Black, new Point[]{
                new Point(glyphRect.Left + (glyphRect.Width / 3)-2, glyphRect.Height / 2+2),
                new Point(glyphRect.Right - (glyphRect.Width / 3), glyphRect.Height / 2+2),
                new Point(glyphRect.Left + glyphRect.Width / 2-1,glyphRect.Bottom-4)});

			g.SmoothingMode = bak;
		}
Example #15
0
File: Star.cs Project: AtanasK/VP
 public override void Draw(Graphics g)
 {
     Brush brush = new SolidBrush(Color.Yellow);
     Rectangle rect = new Rectangle(Position.X - WIDTH / 2, Position.Y - WIDTH / 2, WIDTH,WIDTH);
     g.FillPolygon(brush, StarPoints(5, rect));
     brush.Dispose();
 }
Example #16
0
        public void draw(Graphics g)
        {
            SolidBrush brush = new SolidBrush(color);
            Point[] p = {p1, p2, p3 };

            g.FillPolygon(brush, p, System.Drawing.Drawing2D.FillMode.Alternate);
        }
 public static void RepertoryImage(Graphics drawDestination, MscStyle style)
 {
     StringFormat itemStringFormat = new StringFormat();
     RectangleF itemBox = new RectangleF(10, 20, 60, 20);
     float[] pattern = {4f,4f};
     Pen rPen = new Pen(Color.Black);
     rPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom;
     rPen.DashPattern = pattern;
     itemStringFormat.Alignment = StringAlignment.Center;
     itemStringFormat.LineAlignment = StringAlignment.Center;
     drawDestination.DrawLine(Pens.LightGray,10,10,10,70);
     drawDestination.DrawLine(Pens.LightGray,55,50,55,70);
     drawDestination.DrawLine(Pens.Black,10,45,40,45);
     if (style==MscStyle.SDL){
         PointF[] messagePolygon = new PointF[3];
         messagePolygon[0] = new PointF(40, 45);
         messagePolygon[1] = new PointF(40-8, 45-4);
         messagePolygon[2] = new PointF(40-8, 45+4);
         drawDestination.FillPolygon(Brushes.Black,messagePolygon);
     }
     else if (style==MscStyle.UML2){
         drawDestination.DrawLine(Pens.Black,40, 45,40-8, 45-4);
         drawDestination.DrawLine(Pens.Black,40, 45,40-8, 45+4);
     }
     drawDestination.DrawRectangle(Pens.Black, 40,40,30,10);
     drawDestination.DrawString("Create",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
     rPen.Dispose();
     itemStringFormat.Dispose();
 }
Example #18
0
        /// <summary>
        /// Draw position marker
        /// </summary>
        /// <param name="grfx">The frame</param>
        /// <param name="time"></param>
        public override void Draw(Graphics grfx, float time)
        {
            // TODO: Add custom immage
            GPSData gps = GPSData.GetData();
            ProjectSettings settings = ProjectSettings.GetSettings();

            PointF position = gps.ToPixelCoordinate(gps.GetPosition(time), GetSize(), settings.WholeTrackLineWidth);
            position.X += GetPosition().X;
            position.Y = GetPosition().Y + position.Y;

            float size = settings.PositionMarkerSize;
            Vector[] coordinateSystem = gps.GetOrientation(time, size);

            Vector fwd = coordinateSystem[0];
            Vector side = coordinateSystem[1]; // perpendicular
            PointF[] markerPoints =
            {
                new PointF((float)fwd.X + position.X, -(float)fwd.Y + position.Y),
                new PointF((float)side.X / 3 + position.X, -(float)side.Y / 3 + position.Y),
                new PointF(-(float)side.X / 3 + position.X, +(float)side.Y / 3 + position.Y)
            };

            Brush brush = new SolidBrush(settings.PositionMarkerColor);
            grfx.FillPolygon(brush, markerPoints);
        }
Example #19
0
        public void DrawGlyph(Graphics g)
        {
            if (isMouseOver)
              {
            gbrush = new LinearGradientBrush(glyphRect, Color.White, Color.FromArgb(224, 221, 206), LinearGradientMode.Vertical);
            g.FillRectangle(gbrush, glyphRect);
            Rectangle borderRect = glyphRect;

            borderRect.Width--;
            borderRect.Height--;

            g.DrawRectangle(new Pen(Color.Silver), borderRect);
              }

              g.SmoothingMode = SmoothingMode.Default;

              using (Pen pen = new Pen(Color.Gray))
              {
            pen.Width = 2;

            g.DrawLine(pen, new Point(glyphRect.Left + (glyphRect.Width / 3) - 2, glyphRect.Height / 2 - 1),
            new Point(glyphRect.Right - (glyphRect.Width / 3), (glyphRect.Height / 2) -1));
              }

              g.FillPolygon(Brushes.Black, new Point[]{
                new Point(glyphRect.Left + (glyphRect.Width / 3)-2, glyphRect.Height / 2+2),
                new Point(glyphRect.Right - (glyphRect.Width / 3), glyphRect.Height / 2+2),
                new Point(glyphRect.Left + glyphRect.Width / 2-1,glyphRect.Bottom-4)});
        }
 public static void RepertoryImage(Graphics drawDestination)
 {
     StringFormat itemStringFormat = new StringFormat();
     RectangleF itemBox = new RectangleF(5, 20, 70, 20);
     itemStringFormat.Alignment = StringAlignment.Center;
     drawDestination.DrawString("Message",new Font("Arial",8),Brushes.Black,itemBox,itemStringFormat);
     if (mMscStyle == MscStyle.SDL){
         drawDestination.DrawLine(Pens.Black,5,55,40,55);
         drawDestination.DrawLine(Pens.Black,40,35,40,55);
         drawDestination.DrawLine(Pens.Black,40,35,75,35);
         PointF[] messagePolygon = new PointF[3];
         messagePolygon[0] = new PointF(5, 55);
         messagePolygon[1] = new PointF(5+8, 55-4);
         messagePolygon[2] = new PointF(5+8, 55+4);
         drawDestination.FillPolygon(Brushes.Black,messagePolygon);
     }
     else if(mMscStyle == MscStyle.UML2){
         drawDestination.DrawLine(Pens.Black,5,55,40,55);
         drawDestination.DrawLine(Pens.Black,40,35,40,55);
         drawDestination.DrawLine(Pens.Black,40,35,75,35);
         drawDestination.DrawLine(Pens.Black,5,55,5+8, 55-4);
         drawDestination.DrawLine(Pens.Black,5,55,5+8, 55+4);
     }
     itemStringFormat.Dispose();
 }
        public override void Redraw(Graphics g)
        {
            if (txt == null)
                return;

            Point position = txt.GetPositionFromCharIndex(startIndex);
            Point centerPos = new Point(position.X, (int)(position.Y + (txt.Font.Size * 0.75)));
            float thirdFontSize = txt.Font.Size / 3;

            centerPos.Offset((int)thirdFontSize, 0);
            centerPos.Offset((int)thirdFontSize, 0);
            Brush brush = new SolidBrush(BrushColor);
            Pen pen = new Pen(brush);

            //the horizontal line
            Point lineEnd = new Point((int)(centerPos.X + thirdFontSize), centerPos.Y);
            g.DrawLine(pen, centerPos, lineEnd);

            //the verical line from top
            PointF verticalLineStart = new PointF(lineEnd.X, (lineEnd.Y - thirdFontSize));
            g.DrawLine(pen, verticalLineStart, lineEnd);

            //the arrow on the left pointing left
            PointF topArrowHead = new PointF(centerPos.X, (centerPos.Y - thirdFontSize));
            PointF bottomArrowHead = new PointF(centerPos.X, (centerPos.Y + thirdFontSize));
            PointF middleArrowHead = new PointF(centerPos.X - thirdFontSize, centerPos.Y);

            g.DrawPolygon(pen, new PointF[] { topArrowHead, bottomArrowHead, middleArrowHead });
            g.FillPolygon(brush, new PointF[] { topArrowHead, bottomArrowHead, middleArrowHead });
        }
        public override void OnRender(Graphics g)
        {
            #if !PocketPC
             if(!Bearing.HasValue)
             {
            g.DrawImageUnscaled(Resources.shadow50, LocalPosition.X, LocalPosition.Y);
             }
             g.TranslateTransform(ToolTipPosition.X, ToolTipPosition.Y);

             if(Bearing.HasValue)
             {
            g.RotateTransform(Bearing.Value - Overlay.Control.Bearing);
            g.FillPolygon(Brushes.Lime, Arrow);
             }

             g.ResetTransform();

             if(!Bearing.HasValue)
             {
            g.DrawImageUnscaled(Resources.bigMarkerGreen, LocalPosition.X, LocalPosition.Y);
             }
            #else
            DrawImageUnscaled(g, Resources.shadow50, LocalPosition.X, LocalPosition.Y);
            DrawImageUnscaled(g, Resources.marker, LocalPosition.X, LocalPosition.Y);
            #endif
        }
Example #23
0
        public override void DrawSelf(Graphics gfx, Pen pen)
        {
            base.DrawSelf(gfx, pen);

            PointF a = new PointF(Center.X + Width / 2, Center.Y);
            PointF b = new PointF(Center.X - Width / 2, Center.Y + Height / 2);
            PointF c = new PointF(Center.X - Width / 2, Center.Y - Height / 2);

            PointF a1 = Calc.RotatePoint(Center, a, Angle);
            PointF b1 = Calc.RotatePoint(Center, b, Angle);
            PointF c1 = Calc.RotatePoint(Center, c, Angle);

            Brush brush = Brushes.Blue;
            gfx.FillPolygon(brush, new PointF[4] { a1, b1, c1, a1 });
            gfx.DrawPolygon(pen, new PointF[4] { a1, b1, c1, a1 });

            if (!Dummy)
            {

                Pen penn = new Pen(Color.LightBlue, 1);
                gfx.DrawEllipse(penn, Center.X - Range, Center.Y - Range, Range * 2, Range * 2);
            }
            if (Dummy)
            {
                gfx.DrawString((1000 / FireDelayMilis * TeslaBullet.DamageDefault).ToString(), new Font("Arial", 7), Brushes.Black, Center.X - (Width / 2), Center.Y - 15);
            }
        }
Example #24
0
 public override void Draw(Graphics g)
 {
     if (Game.DebugView)
     {
         g.FillPolygon(new SolidBrush(Color.FromArgb(100, Color.Green)), Vector2.ToPointArray(Vectors));
     }
 }
Example #25
0
 public void Draw(Graphics graphics, int offsetX, int offsetY)
 {
     int avgX = (int)Points.Average(x => x.X);
     int avgY = (int)Points.Average(x => x.Y);
     var offsetPoints = Points.Select(x => new Point(x.X + offsetX - avgX, x.Y + offsetY - avgY)).ToArray();
     graphics.FillPolygon(new SolidBrush(Color), offsetPoints);
 }
Example #26
0
        public static void DrawTrees(Graphics g, byte[,] effectValues, int tickCount)
        {
            using (var solidBrush = new SolidBrush(Color.Black)) {
                solidBrush.Color = Color.FromArgb(effectValues[0, tickCount], Color.Red);
                g.FillPolygon(solidBrush, new[] {new Point(22, 36), new Point(37, 91), new Point(7, 91)});

                solidBrush.Color = Color.FromArgb(effectValues[1, tickCount], Color.Green);
                g.FillPolygon(solidBrush, new[] {new Point(67, 36), new Point(82, 91), new Point(52, 91)});

                solidBrush.Color = Color.FromArgb(effectValues[2, tickCount], Color.Blue);
                g.FillPolygon(solidBrush, new[] {new Point(112, 36), new Point(127, 91), new Point(97, 91)});

                solidBrush.Color = Color.FromArgb(effectValues[3, tickCount], Color.White);
                g.FillPolygon(solidBrush, new[] {new Point(157, 36), new Point(172, 91), new Point(142, 91)});
            }
        }
Example #27
0
 public override void DrawTo(Graphics graphics)
 {
     if (!ShouldDraw ())
         return;
     base.DrawTo (graphics);
     graphics.FillPolygon (BorderBrush, new[] { l, End, r, l });
 }
Example #28
0
		public override void Draw(Graphics graphics)
		{
			if (graphics == null) return;
			base.Draw(graphics);
			graphics.FillPolygon (fill , plusPoints);
			graphics.DrawPolygon (stroke, plusPoints);
		}
Example #29
0
        //функција за испртување на скалилото
        public void Draw(Graphics g)
        {
            Point p1 = new Point(20, 200);
            Point p2 = new Point(20, 220);
            Point p3 = new Point(560, 220);
            Point p4 = new Point(560, 50);

            Point p7 = new Point(21, 200);
            Point p8 = new Point(21, 220);
            Point p5 = new Point(Xcoef, Ycoef);
            Point p6 = new Point(Xcoef, 220);

            Brush brush = new SolidBrush(Color.Black);
            Brush brush2 = new SolidBrush(Color);

            Pen pen = new Pen(brush);

            Point[] points1 = { p1, p2, p3, p4 };
            Point[] points2 = { p7, p8, p6, p5 };

            g.DrawPolygon(pen, points1);
            g.FillPolygon(brush2, points2);

            brush.Dispose();
            brush2.Dispose();
        }
Example #30
0
        /// <summary>
        /// Renders the key in the specified surface.
        /// </summary>
        /// <param name="g">The GDI+ surface to render on.</param>
        /// <param name="scrollCount">The number of times the direction has been scrolled within the timeout.</param>
        public void Render(Graphics g, int scrollCount)
        {
            var pressed = scrollCount > 0;
            var style = GlobalSettings.CurrentStyle.TryGetElementStyle<KeyStyle>(this.Id)
                            ?? GlobalSettings.CurrentStyle.DefaultKeyStyle;
            var defaultStyle = GlobalSettings.CurrentStyle.DefaultKeyStyle;
            var subStyle = pressed ? style?.Pressed ?? defaultStyle.Pressed : style?.Loose ?? defaultStyle.Loose;

            var text = pressed ? scrollCount.ToString() : this.Text;
            var txtSize = g.MeasureString(text, subStyle.Font);
            var txtPoint = new TPoint(
                this.TextPosition.X - (int)(txtSize.Width / 2),
                this.TextPosition.Y - (int)(txtSize.Height / 2));

            // Draw the background
            var backgroundBrush = this.GetBackgroundBrush(subStyle, pressed);
            g.FillPolygon(backgroundBrush, this.Boundaries.ConvertAll<Point>(x => x).ToArray());

            // Draw the text
            g.SetClip(this.GetBoundingBox());
            g.DrawString(text, subStyle.Font, new SolidBrush(subStyle.Text), (Point)txtPoint);
            g.ResetClip();

            // Draw the outline.
            if (subStyle.ShowOutline)
                g.DrawPolygon(new Pen(subStyle.Outline, 1), this.Boundaries.ConvertAll<Point>(x => x).ToArray());
        }