EndContainer() public method

public EndContainer ( GraphicsContainer container ) : void
container GraphicsContainer
return void
Example #1
1
		public void Draw(Graphics g)
		{
			g.FillRectangle(SystemBrushes.AppWorkspace, Bounds);

			g.DrawRectangle(Pens.Black, mCanvasMarginWidth - 1, mCanvasMarginHeight - 1, 800 + 1, 600 + 1);

			g.TranslateTransform(mCanvasMarginWidth, mCanvasMarginHeight);
			GraphicsContainer containerState = g.BeginContainer();
			g.SmoothingMode = SmoothingMode.HighQuality;

			DrawCanvas(g);

			g.SmoothingMode = SmoothingMode.Default;
			g.EndContainer(containerState);
			g.TranslateTransform(-mCanvasMarginWidth, -mCanvasMarginHeight);


			//mCanvasBufferGraphics.FillRectangle(SystemBrushes.AppWorkspace, Bounds);

			//mCanvasBufferGraphics.DrawRectangle(Pens.Black, mCanvasMarginWidth - 1, mCanvasMarginHeight - 1, 800 + 1, 600 + 1);

			//DrawCanvas(mCanvasBufferGraphics);


			//Rectangle src = Bounds;
			//Rectangle dest = new Rectangle(0, 0, (int)(Bounds.Width * mScale), (int)(Bounds.Height * mScale));
			//dest.X = (Bounds.Width / 2) - (dest.Width / 2);
			//dest.Y = (Bounds.Height / 2) - (dest.Height / 2);

			//g.DrawImage(mCanvasBufferImage, dest, src, GraphicsUnit.Pixel);
		}
        public override void DrawRegionRepresentation(Graphics gc, Render.RenderParameter r, Render.IDrawVisitor drawMethods, PointD mousePosition)
        {
            if (m_Param.Path.PointCount > 0)
            {
                GraphicsPath fill = new GraphicsPath();
                RectangleF rect = m_Param.Path.GetBounds();
                PointD refPt = (PointD)rect.Location + ((PointD)rect.Size.ToPointF()) / 2;
                // this will draw beyond the shape's location
                for (double i = -rect.Height; i < rect.Height; i++)
                {
                    PointD pt1 = refPt + PointD.Orthogonal(m_Param.V) * i * drawMethods.Spacing(m_Param.C);
                    PointD pt2 = pt1 + m_Param.V * rect.Width * rect.Height;
                    PointD pt3 = pt1 - m_Param.V * rect.Width * rect.Height;

                    fill.StartFigure();
                    fill.AddLine((Point)pt2, (Point)pt3);

                }

                GraphicsContainer c = gc.BeginContainer();
                gc.SetClip((Tools.Model.VectorPath)m_Param.Path);
                gc.DrawPath(r.RegionGuides, fill);
                gc.EndContainer(c);

            }
        }
Example #3
0
        public void DrawTile(Graphics graph)
        {
            var pointsByColors = this.GetAllBordersPoints();

            var containerState = graph.BeginContainer();
            graph.RotateTransform(90 * (int)this.Rotation);

            this.DrawPoints(graph, pointsByColors);
            this.DrawText(graph);

            graph.EndContainer(containerState);
        }
        /// <summary>
        /// Paints the entity using the given graphics object
        /// </summary>
        /// <param name="g"></param>
        public override void Paint(Graphics g)
        {
            if(!Visible)
                return;

            if(mIcon != null)
            {
                GraphicsContainer cto = g.BeginContainer();
                g.SetClip(Shape.Rectangle);
                g.DrawImage(mIcon, Rectangle);
                g.EndContainer(cto);
            }
        }
        public override void Paint(Graphics g, TerrainMap tm)
        {
            if (tm.IsOnboard(Coords) && tm.Los[Coords])
            {
                var container = g.BeginContainer();

                tm.TranslateGraphicsToHex(g, Coords);
                g.DrawImage(_bmp, tm.BoardHexes[Coords].Board.HexgridPath.GetBounds());
                if (tm.ShowHexgrid) g.DrawPath(Pens.Black, tm.HexgridPath);

                g.EndContainer(container);
            }
        }
Example #6
0
 public override void OnRender(Graphics g)
 {
    //g.DrawRectangle(Pen, new System.Drawing.Rectangle(LocalPosition.X, LocalPosition.Y, Size.Width, Size.Height));
    {
       g.TranslateTransform(ToolTipPosition.X, ToolTipPosition.Y);
       var c = g.BeginContainer();
       {                 
          g.RotateTransform(Bearing - Overlay.Control.Bearing);            
          g.ScaleTransform(Scale, Scale);
          
          g.FillPolygon(Fill, Arrow);               
       }                                                                
       g.EndContainer(c);
       g.TranslateTransform(-ToolTipPosition.X, -ToolTipPosition.Y);
    }
 }
        public static void DrawReverseString( Graphics g, string drawText, Font drawFont, Rectangle drawRect, Brush drawBrush, StringFormat drawFormat )
        {
            GraphicsContainer container = g.BeginContainer();

              // The text will be rotated around the origin (0,0) and so needs moving
              // back into position by using a transform
              g.TranslateTransform(drawRect.Left * 2 + drawRect.Width,
            drawRect.Top * 2 + drawRect.Height);

              // Rotate the text by 180 degress to reverse the direction
              g.RotateTransform(180);

              // Draw the string as normal and let then transforms do the work
              g.DrawString(drawText, drawFont, drawBrush, drawRect, drawFormat);

              g.EndContainer(container);
        }
        private void BeginContainerVoid(Graphics g)
        {
            // Begin graphics container.
            GraphicsContainer containerState = g.BeginContainer();

            // Translate world transformation.
            g.TranslateTransform(100.0F, 100.0F);

            // Fill translated rectangle in container with red.
            g.FillRectangle(new SolidBrush(Color.Red), 0, 0, 200, 200);

            // End graphics container.
            g.EndContainer(containerState);

            // Fill untransformed rectangle with green.
            g.FillRectangle(new SolidBrush(Color.Green), 0, 0, 200, 200);
        }
        protected virtual void FillShadow(Graphics g, RectangleF r)
        {
            Color sc = Color.FromArgb(100,
                this.ShadowColor.R,
                this.ShadowColor.G,
                this.ShadowColor.B
                );
            SolidBrush brush = new SolidBrush(sc);

            SmoothingMode m = g.SmoothingMode;
            g.SmoothingMode = SmoothingMode.AntiAlias;

            GraphicsContainer cont = g.BeginContainer();
                g.TranslateTransform(this.ShadowWidth,this.ShadowWidth);
                g.FillRectangle(brush,r.X,r.Y,r.Width,r.Height);
            g.EndContainer(cont);
            g.SmoothingMode = m;
        }
 public override void Draw(Graphics graphics)
 {
     GraphicsContainer container = graphics.BeginContainer();
     Rectangle bounds = base.Bounds;
     using (Region region = new Region(new Rectangle(bounds.X, bounds.Y, bounds.Width + 1, bounds.Height + 1)))
     {
         graphics.Clip = region;
         base.itemStrip.Draw(graphics);
         if (base.itemStrip.ScrollPosition > 0)
         {
             this.DrawButton(graphics, (base.Orientation == Orientation.Horizontal) ? ScrollButton.Left : ScrollButton.Up);
         }
         if ((base.itemStrip.ScrollPosition + base.itemStrip.MaxVisibleItems) < base.itemStrip.Items.Count)
         {
             this.DrawButton(graphics, (base.Orientation == Orientation.Horizontal) ? ScrollButton.Right : ScrollButton.Down);
         }
     }
     graphics.EndContainer(container);
 }
Example #11
0
        public void DrawInBox(Graphics g, RectangleF box,GraphicsUnit gu)
        {
            if (box.IsEmpty)return;
            GraphicsContainer gc = g.BeginContainer(box,this.GPath.GetBounds(),gu);
            SvgElementCollection.ISvgElementEnumerator enumerator1 = base.GraphList.GetEnumerator();
            Matrix matrix1 = base.GraphTransform.Matrix.Clone();
            while (enumerator1.MoveNext())
            {
                IGraph graph1 = (IGraph) enumerator1.Current;
                Matrix matrix2 = graph1.GraphTransform.Matrix;

                graph1.GraphTransform.Matrix =new Matrix();

                graph1.Draw(g, 0);
            }
            g.EndContainer(gc);
        }
        public override void Draw(Graphics g)
        {
            base.Draw(g);

            System.Drawing.Drawing2D.GraphicsContainer gc1 = g.BeginContainer(); {

                g.TranslateTransform((int)this.X,(int)this.Y);

                // Color
                int alpha = (int)( (1.0 - (double)this.Age/(double)_maxAge) * 255 );
                if(alpha > 255) alpha = 255;
                Color c = Color.FromArgb(alpha,Color.White);

                // Focus Circle
                g.DrawEllipse(new Pen(c),
                              (int)(-this.Radius),
                              (int)(-this.Radius),
                              (int)(this.Radius*2),
                              (int)(this.Radius*2) );

                // Draw message
                g.DrawString(this.Contents.ToString(), Config.DisplayTextFont, new SolidBrush(c), new PointF(-Config.DisplayTextFont.Size/2,this.Radius-Config.DisplayTextFont.Size*2));

            } g.EndContainer(gc1);
        }
 internal static void DrawDropShadow(Graphics graphics, Rectangle shadowSourceRectangle, Color baseColor, int shadowDepth, LightSourcePosition lightSourcePosition, float lightSourceIntensity, bool roundEdges)
 {
     if (graphics == null)
     {
         throw new ArgumentNullException("graphics");
     }
     if ((shadowSourceRectangle.IsEmpty || (shadowSourceRectangle.Width < 0)) || (shadowSourceRectangle.Height < 0))
     {
         throw new ArgumentException(SR.GetString("Error_InvalidShadowRectangle"), "shadowRectangle");
     }
     if ((shadowDepth < 1) || (shadowDepth > 12))
     {
         throw new ArgumentException(SR.GetString("Error_InvalidShadowDepth"), "shadowDepth");
     }
     if ((lightSourceIntensity <= 0f) || (lightSourceIntensity > 1f))
     {
         throw new ArgumentException(SR.GetString("Error_InvalidLightSource"), "lightSourceIntensity");
     }
     Rectangle rectangle = shadowSourceRectangle;
     Size empty = Size.Empty;
     if ((lightSourcePosition & LightSourcePosition.Center) > 0)
     {
         rectangle.Inflate(shadowDepth, shadowDepth);
     }
     if ((lightSourcePosition & LightSourcePosition.Left) > 0)
     {
         empty.Width += shadowDepth + 1;
     }
     else if ((lightSourcePosition & LightSourcePosition.Right) > 0)
     {
         empty.Width -= shadowDepth + 1;
     }
     if ((lightSourcePosition & LightSourcePosition.Top) > 0)
     {
         empty.Height += shadowDepth + 1;
     }
     else if ((lightSourcePosition & LightSourcePosition.Bottom) > 0)
     {
         empty.Height -= shadowDepth + 1;
     }
     rectangle.Offset(empty.Width, empty.Height);
     GraphicsContainer container = graphics.BeginContainer();
     GraphicsPath path = new GraphicsPath();
     if (roundEdges)
     {
         path.AddPath(GetRoundedRectanglePath(shadowSourceRectangle, 8), true);
     }
     else
     {
         path.AddRectangle(shadowSourceRectangle);
     }
     try
     {
         using (Region region = new Region(path))
         {
             graphics.SmoothingMode = SmoothingMode.AntiAlias;
             graphics.ExcludeClip(region);
             Color color = Color.FromArgb(Convert.ToInt32((float) (40f * lightSourceIntensity)), baseColor);
             int num = Math.Max(40 / shadowDepth, 2);
             for (int i = 0; i < shadowDepth; i++)
             {
                 rectangle.Inflate(-1, -1);
                 using (Brush brush = new SolidBrush(color))
                 {
                     using (GraphicsPath path2 = new GraphicsPath())
                     {
                         if (roundEdges)
                         {
                             path2.AddPath(GetRoundedRectanglePath(rectangle, 8), true);
                         }
                         else
                         {
                             path2.AddRectangle(rectangle);
                         }
                         graphics.FillPath(brush, path2);
                     }
                 }
                 color = Color.FromArgb(color.A + num, color.R, color.G, color.B);
             }
         }
     }
     finally
     {
         graphics.EndContainer(container);
     }
 }
Example #14
0
        /// <summary>
        /// ��·
        /// </summary>
        /// <param name="g"></param>
        /// <param name="time"></param>
        private void Draw2(Graphics g, int time)
        {
            if (base.DrawVisible) {
                Matrix matrix1 = base.Transform.Matrix.Clone();

                GraphicsContainer container1 = g.BeginContainer();

                g.SmoothingMode = base.OwnerDocument.SmoothingMode;

                Matrix matrix2 = base.GraphTransform.Matrix.Clone();
                base.GraphTransform.Matrix.Multiply(matrix1, MatrixOrder.Prepend);

                ClipAndMask.ClipPath.Clip(g, time, this);
                bool flag1 = base.Visible;
                if (!base.Visible) {
                    g.SetClip(Rectangle.Empty);
                }
                float single1 = this.StrokeOpacity;
                if (this.svgAnimAttributes.ContainsKey("fill-opacity")) {
                    single1 = Math.Min(single1, (float)this.svgAnimAttributes["fill-opacity"]);
                }
                ISvgBrush brush1 = this.GraphBrush;
                using (GraphicsPath path1 = (GraphicsPath)this.GPath.Clone()) {
                    path1.Transform(base.GraphTransform.Matrix);
                    if (!base.ShowBound) {

                        float width1 = Width * GraphTransform.Matrix.Elements[0];
                        Stroke stroke = Stroke.GetStroke(this);
                        Color color1 = Color.FromArgb(75, 75, 75);
                        if (stroke.StrokeColor.ToArgb()!=Color.Black.ToArgb()) color1 = stroke.StrokeColor;
                        using (Pen p = new Pen(Color.FromArgb((int)(single1 * 255), color1))) {
                            p.Width = width1;
                            g.DrawPath(p, path1);
                        }
                        if (LineType == "3") {
                            using (Pen p = new Pen(Color.Yellow)) {
                                if (width1 > 30)
                                    p.Width = 2;
                                else
                                    p.Width = 1;
                                //p.DashPattern = new float[] { 10, 10 };
                                g.DrawPath(p, path1);
                            }
                        } else {
                            //using (Pen p = new Pen(Color.Yellow)) {
                            //    if (width1 > 30)
                            //        p.Width = 2;
                            //    else
                            //        p.Width = 1;
                            //    g.DrawPath(p, path1);
                            //}
                        }
                        if (LineType == "4") {

                            using (Pen p =  new Pen(Color.FromArgb((int)(single1*255),color1))) {
                                p.Width = width1;
                                float f22 = width1 / 4f;
                                ImageAttributes imageAttributes = new ImageAttributes();
                                ColorMatrix cmatrix1 = new ColorMatrix();
                                cmatrix1.Matrix00 = 1f;
                                cmatrix1.Matrix11 = 1f;
                                cmatrix1.Matrix22 = 1f;
                                cmatrix1.Matrix33 = single1;//͸����
                                cmatrix1.Matrix44 = 1f;
                                //����͸����
                                imageAttributes.SetColorMatrix(cmatrix1, ColorMatrixFlag.Default, ColorAdjustType.Default);
                                if (BackgroundImage == null) BackgroundImageFile = "road.png";
                                TextureBrush tbush = new TextureBrush(BackgroundImage,new Rectangle(0,0,BackgroundImage.Width,BackgroundImage.Height),imageAttributes);
                                tbush.WrapMode = WrapMode.Tile;
                                for (int i = 0; i < path1.PointCount - 1;i++ ) {
                                    float k = (path1.PathPoints[i+1].Y - path1.PathPoints[i].Y) / (path1.PathPoints[i+1].X - path1.PathPoints[i].X);

                                    float y1 = path1.PathPoints[i].Y - path1.PathPoints[i+1].Y;
                                    float y2 = path1.PathPoints[i].X - path1.PathPoints[i+1].X;
                                    float k2 = (float)Math.Abs(k);
                                    float angle = (float)Math.Atan(k2) * 180 / (float)Math.PI;
                                    if (k < 0) {  angle = 360-angle; }

                                    PointF[] pts = new PointF[] { new PointF(path1.PathPoints[i].X, path1.PathPoints[i].Y - 26) };
                                    Matrix matrix11 = new Matrix();
                                    matrix11.RotateAt(angle, path1.PathPoints[i]);
                                    matrix11.Translate(path1.PathPoints[i].X, path1.PathPoints[i].Y);
                                    matrix11.Scale(width1 / 50, width1 / 50);
                                    //tbush.ScaleTransform(width1 / 50, width1 / 50, MatrixOrder.Append);
                                    //tbush.RotateTransform(angle, MatrixOrder.Append);
                                    //tbush.TranslateTransform(path1.PathPoints[i].X, path1.PathPoints[i].Y , MatrixOrder.Append);
                                    tbush.Transform = matrix11;

                                    p.Brush = tbush.Clone() as TextureBrush;
                                    p.Alignment = PenAlignment.Center;

                                    g.DrawLine(p, path1.PathPoints[i], path1.PathPoints[i + 1]);
                                    tbush.ResetTransform();
                                }
                            }
                            if (BackgroundImageFile == "road.png") {
                                using (Pen p = new Pen(Color.Yellow)) {
                                    if (width1 > 30)
                                        p.Width = 2;
                                    else
                                        p.Width = 1;
                                    g.DrawPath(p, path1);
                                }
                            }
                        }

                    } else {
                        g.DrawPath(new Pen(base.BoundColor), path1);
                    }
                    this.DrawConnect(g);
                }
                matrix1.Dispose();
                ClipAndMask.ClipPath.DrawClip(g, time, this);
                g.EndContainer(container1);
                this.pretime = time;
            }
        }
Example #15
0
        protected void PaintMarkers(Graphics g)
        {
            string markerStartUrl = extractMarkerUrl(this.GetAttribute("marker-start"));
            string markerEndUrl = extractMarkerUrl(this.GetAttribute("marker-end"));
            PointF[] points1 = this.Points.Clone() as PointF[];
            int num1 = 0;
            int num11 = 1;

            int num3 = 0;
            int num33 = 1;

            if (points1.Length > 3) {
                num33 = points1.Length - 1;
                num3 = num33 - 1;
            }

            base.GraphTransform.Matrix.TransformPoints(points1);

            float angle = 0f;//(float)(180*Math.Atan2(points1[1].Y - points1[0].Y,points1[1].X-points1[0].X)/Math.PI);

            GraphicsContainer container1 = g.BeginContainer();

            Marker element1;
            if (markerStartUrl.Length > 0) {
                angle = (float)(180 * Math.Atan2(points1[num11].Y - points1[num1].Y, points1[num11].X - points1[num1].X) / Math.PI);

                element1 = (Marker)NodeFunc.GetRefNode(markerStartUrl, this.OwnerDocument);
                if (element1 is Marker) {
                    ((Marker)element1).GraphTransform.Matrix = new Matrix();
                    Matrix matrix1 = ((Marker)element1).MarkerTransForm;

                    matrix1.Rotate(angle);
                    matrix1.Translate(points1[num1].X, points1[num1].Y, MatrixOrder.Append);
                    element1.GraphStroke = this.GraphStroke;
                    element1.IsMarkerChild = true;
                    ((Marker)element1).Draw(g, 0);
                }
            }

            if (markerEndUrl.Length > 0) {
                angle = (float)(180 * Math.Atan2(points1[num33].Y - points1[num3].Y, points1[num33].X - points1[num3].X) / Math.PI);

                element1 = (Marker)NodeFunc.GetRefNode(markerEndUrl, this.OwnerDocument);
                if (element1 is Marker) {
                    ((Marker)element1).GraphTransform.Matrix = new Matrix();
                    Matrix matrix1 = ((Marker)element1).MarkerTransForm;

                    matrix1.Rotate(angle);
                    matrix1.Translate(points1[num33].X, points1[num33].Y, MatrixOrder.Append);
                    element1.GraphStroke = this.GraphStroke;
                    element1.IsMarkerChild = true;
                    ((Marker)element1).Draw(g, 0);
                }
            }
            g.EndContainer(container1);
        }
        public void Draw(Graphics g)
        {
            // Init
            Lifelet lifeToHighlight = _highlightedLifelet;
            if(_selectedLifelet != null) lifeToHighlight = _selectedLifelet;

            // Background
            g.Clear(Color.Black);

            // Food
            foreach(Food food in _food) {
                food.Draw(g);
            }

            // Loop life forms
            foreach(Lifelet life in _lifelets) {
                // Tell life to draw
                life.Draw(g);

                // Debugging?
                if(Config.Debug) {

                }

                // Highlight / debugging infos
                if(life == lifeToHighlight || Config.Debug) {

                    System.Drawing.Drawing2D.GraphicsContainer gc1 = g.BeginContainer(); {

                        g.TranslateTransform((int)life.X,(int)life.Y);

                        // Draw a crosshair
                        Pen pen = new Pen( life == lifeToHighlight ? Color.White : life.Color );
                        int crosshairSize = life == lifeToHighlight ? (int)(Config.DisplayCrosshairSize*1.5) : Config.DisplayCrosshairSize;
                        g.DrawLine(pen,0,-crosshairSize,0,crosshairSize);
                        g.DrawLine(pen,-crosshairSize,0,crosshairSize,0);

                        // Focus Circle
                        g.DrawEllipse(new Pen(Color.White),
                                      (int)(-life.Visibility),
                                      (int)(-life.Visibility),
                                      (int)(life.Visibility*2),
                                      (int)(life.Visibility*2) );

                        // Health bar
                        g.FillRectangle(Brushes.Red,
                                        0,
                                        -(Config.DisplayCrosshairSize*3),
                                        (int)((life.Health/100.0) * Config.DisplayPseudoPercentBarSize),
                                        2 );

                        // Energy bar
                        g.FillRectangle(Brushes.Yellow,
                                        0,
                                        -(Config.DisplayCrosshairSize*3) - 4,
                                        (int)((life.Energy/100.0) * Config.DisplayPseudoPercentBarSize),
                                        2 );

                    } g.EndContainer(gc1);
                }
            }

            // Message
            foreach(Message message in _messages) {
                message.Draw(g);
            }

            // Highlight infos
            string infos = "";
            if(lifeToHighlight != null) {

                // Infos via reflection. We only show information for properties. Note that
                // we do this operation on the virtual type, not the Life type, so any
                // properties in an implemented life are also shown.
                Type t = lifeToHighlight.GetType();
                foreach(System.Reflection.PropertyInfo p in t.GetProperties()) {
                    object val = p.GetValue(lifeToHighlight,null);
                    if(val != null) infos += p.Name + ": " + val.ToString() + "\n";
                }
                infos += "\n";
            }

            // Show debug infos
            if(Config.Debug) {
                // World...
                infos += "Cursor: " + _cursor + "\n";

                // Statistics
                foreach(object k in _stats.Keys) {
                    infos += k + ": " + _stats[k] + "\n";
                }
                infos += "\n";
            }

            // Draw world boundaries
            if(Config.Debug) {
                Pen pen = new Pen(Color.White);
                g.DrawLine(pen,0,-Config.DisplayCrosshairSize*3,0,Config.DisplayCrosshairSize*3);
                g.DrawLine(pen,-Config.DisplayCrosshairSize*3,0,Config.DisplayCrosshairSize*3,0);
                g.DrawEllipse(pen,-Config.WorldRadius,-Config.WorldRadius,Config.WorldRadius*2,Config.WorldRadius*2);
            }

            // Draw debug infos - no world drawing after this
            if (infos != "") {
                g.ResetTransform(); //NOTE: On Windows this doesnt reset through all the containers, so we do it in the current container and restrict any drawing after
                System.Drawing.Drawing2D.GraphicsContainer gc2 = g.BeginContainer();
                {
                    // g.ResetTransform();
                    g.DrawString(infos, Config.DisplayTextFont, Config.DisplayTextBrush, new PointF(30, 30));
                } g.EndContainer(gc2);
            }
        }
Example #17
0
 internal void Draw(Graphics g, Matrix matrix1)
 {
     GraphicsContainer container1 = g.BeginContainer();
     g.Transform=matrix1;
     this.symbolElement.Draw(g,0);
     g.EndContainer(container1);
     //			g.DrawPath(Pens.Black,path);
 }
Example #18
0
 private void DrawTitleBox(Graphics g)
 {
     GraphicsContainer container = g.BeginContainer();
     Rectangle titleBorderRect = TitleBorderRect;
     g.SetClip(new Rectangle(titleBorderRect.X, titleBorderRect.Y, titleBorderRect.Width,
                             titleBorderRect.Bottom + 1));
     int upHeight = titleBorderRect.Height/2,
         downHeight = titleBorderRect.Height - upHeight;
     var upBox = new Rectangle(titleBorderRect.X, titleBorderRect.Y, titleBorderRect.Width, upHeight);
     var downBox = new Rectangle(titleBorderRect.X, titleBorderRect.Y + upHeight, titleBorderRect.Width,
                                 downHeight);
     if (Chart.visualSettings.ChartFrameStyle == FrameStyle.ThreeD)
     {
         var pen = new Pen(ControlPaint.Dark(Chart.visualSettings.PaneFrameBorderColor, 0.5f));
         var brushUp = new LinearGradientBrush(new Point(0, 0), new Point(0, upHeight + 3),
                                               Chart.visualSettings.PaneFrameBorderMarginGradientColor,
                                               Chart.visualSettings.PaneFrameBorderCenterGradientColor);
         var brushDn = new LinearGradientBrush(new Point(0, 0), new Point(0, downHeight),
                                               Chart.visualSettings.PaneFrameBorderCenterGradientColor,
                                               Chart.visualSettings.PaneFrameBorderMarginGradientColor);
         using (pen)
         {
             using (brushUp)
             {
                 using (brushDn)
                 {
                     Renderer.Draw3DBorder(g, titleBorderRect, Chart.visualSettings.PaneFrameBorderColor,
                                           Border3DStyle.Raised);
                     g.DrawLine(pen, titleBorderRect.Left, titleBorderRect.Bottom, titleBorderRect.Right - 1,
                                titleBorderRect.Bottom);
                     g.FillRectangle(brushUp, upBox);
                     g.FillRectangle(brushDn, downBox);
                 }
             }
         }
     }
     else if (Chart.visualSettings.ChartFrameStyle == FrameStyle.Flat)
     {
         var pen2 = new Pen(Chart.visualSettings.PaneFrameBorderColor);
         var brush2 = new SolidBrush(Chart.visualSettings.PaneFrameBackColor);
         using (pen2)
         {
             using (brush2)
             {
                 g.FillRectangle(brush2, titleBorderRect);
                 g.DrawLine(pen2, titleBorderRect.Left, titleBorderRect.Bottom, titleBorderRect.Right - 1,
                            titleBorderRect.Bottom);
             }
         }
     }
     g.EndContainer(container);
 }
Example #19
0
		protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
		{

            TreeGridNode node = this.OwningNode;
            if (node == null) return;

            Image image = node.Image;

            if (this._imageHeight == 0 && image != null) this.UpdateStyle();

			// paint the cell normally
			base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts);

            // TODO: Indent width needs to take image size into account
			Rectangle glyphRect = new Rectangle(cellBounds.X + this.GlyphMargin, cellBounds.Y, INDENT_WIDTH, cellBounds.Height - 1);
			int glyphHalf = glyphRect.Width / 2;

			//TODO: This painting code needs to be rehashed to be cleaner
			int level = this.Level;

            //TODO: Rehash this to take different Imagelayouts into account. This will speed up drawing
			//		for images of the same size (ImageLayout.None)
			if (image != null)
			{
				Point pp;
				if (_imageHeight > cellBounds.Height)
                    pp = new Point(glyphRect.X + this.glyphWidth, cellBounds.Y + _imageHeightOffset);
				else
                    pp = new Point(glyphRect.X + this.glyphWidth, (cellBounds.Height / 2 - _imageHeight / 2) + cellBounds.Y);

				// Graphics container to push/pop changes. This enables us to set clipping when painting
				// the cell's image -- keeps it from bleeding outsize of cells.
				System.Drawing.Drawing2D.GraphicsContainer gc = graphics.BeginContainer();
				{
					graphics.SetClip(cellBounds);
					graphics.DrawImageUnscaled(image, pp);
				}
				graphics.EndContainer(gc);
			}

			// Paint tree lines			
            if (node._grid.ShowLines)
            {
                using (Pen linePen = new Pen(SystemBrushes.ControlDark, 1.0f))
                {
                    linePen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
                    bool isLastSibling = node.IsLastSibling;
                    bool isFirstSibling = node.IsFirstSibling;
                    if (node.Level == 1)
                    {
                        // the Root nodes display their lines differently
                        if (isFirstSibling && isLastSibling)
                        {
                            // only node, both first and last. Just draw horizontal line
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top + cellBounds.Height / 2, glyphRect.Right, cellBounds.Top + cellBounds.Height / 2);
                        }
                        else if (isLastSibling)
                        {
                            // last sibling doesn't draw the line extended below. Paint horizontal then vertical
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top + cellBounds.Height / 2, glyphRect.Right, cellBounds.Top + cellBounds.Height / 2);
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top, glyphRect.X + 4, cellBounds.Top + cellBounds.Height / 2);
                        }
                        else if (isFirstSibling)
                        {
                            // first sibling doesn't draw the line extended above. Paint horizontal then vertical
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top + cellBounds.Height / 2, glyphRect.Right, cellBounds.Top + cellBounds.Height / 2);
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top + cellBounds.Height / 2, glyphRect.X + 4, cellBounds.Bottom);
                        }
                        else
                        {
                            // normal drawing draws extended from top to bottom. Paint horizontal then vertical
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top + cellBounds.Height / 2, glyphRect.Right, cellBounds.Top + cellBounds.Height / 2);
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top, glyphRect.X + 4, cellBounds.Bottom);
                        }
                    }
                    else
                    {
                        if (isLastSibling)
                        {
                            // last sibling doesn't draw the line extended below. Paint horizontal then vertical
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top + cellBounds.Height / 2, glyphRect.Right, cellBounds.Top + cellBounds.Height / 2);
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top, glyphRect.X + 4, cellBounds.Top + cellBounds.Height / 2);
                        }
                        else
                        {
                            // normal drawing draws extended from top to bottom. Paint horizontal then vertical
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top + cellBounds.Height / 2, glyphRect.Right, cellBounds.Top + cellBounds.Height / 2);
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top, glyphRect.X + 4, cellBounds.Bottom);
                        }

                        // paint lines of previous levels to the root
                        TreeGridNode previousNode = node.Parent;
                        int horizontalStop = (glyphRect.X + 4) - INDENT_WIDTH;

                        while (!previousNode.IsRoot)
                        {
                            if (previousNode.HasChildren && !previousNode.IsLastSibling)
                            {
                                // paint vertical line
                                graphics.DrawLine(linePen, horizontalStop, cellBounds.Top, horizontalStop, cellBounds.Bottom);
                            }
                            previousNode = previousNode.Parent;
                            horizontalStop = horizontalStop - INDENT_WIDTH;
                        }
                    }

                }
            }

            if (node.HasChildren || node._grid.VirtualNodes)
            {
                // Paint node glyphs				
                if (node.IsExpanded)
                    node._grid.rOpen.DrawBackground(graphics, new Rectangle(glyphRect.X, glyphRect.Y + (glyphRect.Height / 2) - 4, 10, 10));
                else
                    node._grid.rClosed.DrawBackground(graphics, new Rectangle(glyphRect.X, glyphRect.Y + (glyphRect.Height / 2) - 4, 10, 10));
            }


		}
Example #20
0
        public override void Draw(Graphics g, int time)
        {
            if (base.DrawVisible)
            {
                GraphicsContainer container1 = g.BeginContainer();
            //				if (this.pretime != time)
            //				{
            //					int num1 = 0;
            //					int num2 = 0;
            //					AnimFunc.CreateAnimateValues(this, time, out num1, out num2);
            //				}
                Matrix matrix1 = this.Transform.Matrix.Clone();
                base.GraphTransform.Matrix.Multiply(matrix1, MatrixOrder.Prepend);
                if (!this.editMode)
                {
                    g.SmoothingMode = base.OwnerDocument.SmoothingMode;

                    if (this == this.OwnerTextElement)
                    {
                        ClipPath.Clip(g, time, this);
                    }
                    if (!base.Visible)
                    {
                        g.SetClip(Rectangle.Empty);
                    }
                    ISvgBrush brush1 = base.GraphBrush;

                    if (this == this.OwnerTextElement)
                    {
                        this.currentPostion = PointF.Empty;
                    }
                    float single1 = this.Size;
                    this.GPath = new GraphicsPath();
                    using (StringFormat format1 = this.GetGDIStringFormat())
                    {

                        using (FontFamily family1 = this.GetGDIFontFamily())
                        {
                            if (this.X == 0)
                            {
                                this.currentPostion.X = this.currentPostion.X + this.Dx;
                            }
                            else
                            {
                                this.currentPostion.X = (this.X + this.Dx);
                            }
                            if (this.Y == 0)
                            {
                                this.currentPostion.Y = this.currentPostion.Y + this.Dy;
                            }
                            else
                            {
                                this.currentPostion.Y = (this.Y + this.Dy);
                            }
                            //this.currentPostion.Y += (this.Y + this.Dy);
                            int num3 = this.GetGDIStyle();
                            base.TempFillOpacity = Math.Min(1f, base.FillOpacity);
                            base.TempOpacity = Math.Min(1f, base.Opacity);
                            base.TempStrokeOpacity = Math.Min(1f, base.StrokeOpacity);
                            this.old = true;
            //							this.OwnerDocument.BeginPrint=true;
                            bool flag = false;
                            foreach (XmlNode node1 in this.ChildNodes)
                            {
                                GraphicsPath path1 = new GraphicsPath();
                                if (node1 is Text)
                                {
                                    ((Text) node1).currentPostion = this.currentPostion;
                                    ((Text) node1).GraphTransform.Matrix = base.GraphTransform.Matrix.Clone();
                                    ((Text) node1).Draw(g, time);
                                    this.currentPostion = ((Text) node1).currentPostion;
                                    if (((Text) node1).GPath.PointCount > 0)
                                    {
                                        this.GPath.StartFigure();
                                        this.GPath.AddPath(((Text) node1).GPath, false);
                                    }
                                    continue;
                                }
                                if (node1.NodeType == XmlNodeType.Text)
                                {
                                    string text1 = "t";//this.TrimText(node1.Value);
                                    Font font1 =null;
                                    try
                                    {
                                        font1=new Font(family1.Name, single1, (FontStyle) num3,GraphicsUnit.Pixel);
                                    }
                                    catch
                                    {
                                        int ii=0;
                                        ii++;

                                    }
                                    float single2 = (((float) family1.GetCellAscent(FontStyle.Regular))/((float) family1.GetEmHeight(FontStyle.Regular)))*single1;
                                    SizeF ef1 = g.MeasureString(text1, font1, new PointF(this.currentPostion.X, this.currentPostion.Y - single2), format1);
                                    float single3 = ef1.Width;

                                    float single5 = (((float) family1.GetLineSpacing(FontStyle.Regular)) / ((float) family1.GetEmHeight(FontStyle.Regular))) * single1 ; //�о�

                                    float offy = this.currentPostion.Y -single2;
                                    float offx = this.currentPostion.X;

                                    for(int i=0 ;i<Lines.Length;i++)
                                    {
                                        if (!base.ShowBound && (this.OwnerDocument.BeginPrint || LimitSize))
                                        {
                                            GraphicsContainer gc=g.BeginContainer();
                                            g.TextRenderingHint =System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
                                            g.Transform=base.GraphTransform.Matrix;
                                            //g.DrawString(lines[i], font1,new SolidBrush(Color.Black),100,100);
                                            Color color1 =Color.Black;
                                            if (this.SvgAttributes.Contains("stroke"))
                                            {
                                                color1=Stroke.GetStroke(this).StrokeColor;
                                                if (color1.IsEmpty || color1==Color.Transparent || color1==Color.Empty )
                                                    color1 = Color.Black;
                                            }

                                            g.DrawString(lines[i], font1,new SolidBrush(color1),new PointF(offx, offy),format1);
                                            g.EndContainer(gc);
                                            SizeF ef2 = g.MeasureString(lines[i], font1, new PointF(offx, offy), format1);
                                            path1.AddString(lines[i],family1,num3,single1,new PointF(offx, offy),format1);
                                        }
                                        else
                                        {
                                            flag = true;
                                            path1.AddString(lines[i], family1, num3, single1, new PointF(offx, offy), format1);
                                        }
                                        if(Vertical)
                                        {
                                            offx += single5;
                                        }
                                        else
                                        {
                                            offy += single5;
                                        }
                                    }
                                    this.currentPostion.X += ((single3*3f)/4f);
                                    this.GPath.StartFigure();
                                    this.GPath.AddPath(path1, false);
                                    float single4 = base.Opacity;
                                    if (this.svgAnimAttributes.ContainsKey("fill-opacity"))
                                    {
                                        single4 = Math.Min(single4, base.FillOpacity);
                                    }
                                    path1.Transform(base.GraphTransform.Matrix);
                                    if (!base.ShowBound && !(this.OwnerDocument.BeginPrint || LimitSize))
                                    {

                                        brush1.Paint(path1, g, time, single4);
                                        //								Stroke stroke1 = Stroke.GetStroke(this);
                                        //								stroke1.Paint(g, this,path1, time);
                                        base.GraphStroke.Paint(g, this, path1, 0);
                                        continue;
                                    }
                                    else if(flag)
                                    {
                                        g.DrawPath(new Pen(base.BoundColor), path1);
                                    }
                                }
                                path1.Dispose();
                            }
                        }
                    }

                    matrix1.Dispose();
                    ClipPath.DrawClip(g, time, this);
                    g.EndContainer(container1);
                    this.pretime = time;
                    this.old = false;
                }
            }
        }
            public override void Draw(Graphics graphics)
            {
                GraphicsContainer graphicsState = graphics.BeginContainer();

                Rectangle bounds = Bounds;
                using (Region clipRegion = new Region(new Rectangle(bounds.X, bounds.Y, bounds.Width + 1, bounds.Height + 1)))
                {
                    graphics.Clip = clipRegion;

                    StringFormat format = new StringFormat();
                    format.Alignment = StringAlignment.Center;
                    format.LineAlignment = StringAlignment.Center;
                    format.Trimming = StringTrimming.Character;
                    format.FormatFlags = StringFormatFlags.NoWrap;

                    int visibleItems = MaxVisibleItems;
                    int scrollPosition = ScrollPosition;
                    for (int itemIndex = scrollPosition; itemIndex < Items.Count && itemIndex < (scrollPosition + visibleItems); itemIndex++)
                    {
                        ItemInfo itemInfo = Items[itemIndex];
                        Rectangle itemRectangle = GetItemBounds(itemInfo);

                        int margin = itemRectangle.Width / 5;
                        GraphicsPath[] graphicsPath = ActivityDesignerPaint.GetPagePaths(itemRectangle, margin, DesignerContentAlignment.TopRight);
                        using (GraphicsPath pagePath = graphicsPath[0])
                        using (GraphicsPath pageFoldPath = graphicsPath[1])
                        {
                            Brush pageBrush = Brushes.White;
                            if (SelectedItem == itemInfo)
                                pageBrush = PageStrip.SelectionBrush;
                            else if (HighlitedItem == itemInfo)
                                pageBrush = PageStrip.HighliteBrush;

                            graphics.FillPath(pageBrush, pagePath);
                            graphics.DrawPath(Pens.DarkBlue, pagePath);
                            graphics.FillPath(Brushes.White, pageFoldPath);
                            graphics.DrawPath(Pens.DarkBlue, pageFoldPath);

                            if (itemInfo.Image == null)
                            {
                                itemRectangle.Y += margin;
                                itemRectangle.Height -= margin;
                                int index = itemIndex + 1;
                                graphics.DrawString(index.ToString(CultureInfo.CurrentCulture), Control.DefaultFont, SystemBrushes.ControlText, (RectangleF)itemRectangle, format);
                            }
                            else
                            {
                                itemRectangle.Y += margin; itemRectangle.Height -= margin;
                                itemRectangle.X += (itemRectangle.Width - itemRectangle.Height) / 2;
                                itemRectangle.Width = itemRectangle.Height;
                                itemRectangle.Inflate(-2, -2);
                                ActivityDesignerPaint.DrawImage(graphics, itemInfo.Image, itemRectangle, DesignerContentAlignment.Center);
                            }
                        }
                    }
                }

                graphics.EndContainer(graphicsState);
            }
        public override void Draw(Graphics graphics)
        {
            GraphicsContainer graphicsState = graphics.BeginContainer();

            Rectangle bounds = Bounds;
            using (Region clipRegion = new Region(new Rectangle(bounds.X, bounds.Y, bounds.Width + 1, bounds.Height + 1)))
            {
                graphics.Clip = clipRegion;

                base.itemStrip.Draw(graphics);

                if (base.itemStrip.ScrollPosition > 0)
                    DrawButton(graphics, (Orientation == Orientation.Horizontal) ? ScrollButton.Left : ScrollButton.Up);

                if (base.itemStrip.ScrollPosition + base.itemStrip.MaxVisibleItems < base.itemStrip.Items.Count)
                    DrawButton(graphics, (Orientation == Orientation.Horizontal) ? ScrollButton.Right : ScrollButton.Down);
            }

            graphics.EndContainer(graphicsState);
        }
        public void Render(Graphics g)
        {
            if (this.VisitedGraph==null)
                return;
            if (this.positions.Count==0)
                return;

            GraphicsContainer container = null;
            RectangleF bb = GetBoundingBox();

            g.FillRectangle(Brushes.White,g.ClipBounds);
            g.BeginContainer(GetOriginalBox(),bb,GraphicsUnit.Pixel);

            if (this.edgeVisible)
            {
                int index = 0;
                foreach(IEdge e in this.VisitedGraph.Edges)
                {
                    this.edgeRenderer.Render(g,
                                             e,
                                             this.Positions[e.Source],
                                             this.Positions[e.Target]
                                             );
                    ++index;
                }
            }

            if (this.vertexVisible)
            {
                this.vertexRenderer.PreRender();
                foreach(DictionaryEntry de in this.Positions)
                {
                    this.vertexRenderer.Render(g,(IVertex)de.Key,(PointF)de.Value);
                }
            }

            if (container!=null)
                g.EndContainer(container);
        }
Example #24
0
        public virtual void Draw(Graphics g, int time)
        {
            if (this.DrawVisible)
            {
            //				int num1 = 0;
            //				int num2 = 0;
            //				if (this.pretime != time)
            //				{

            //					AnimFunc.CreateAnimateValues(this, time, out num1, out num2);
            //				}
                GraphicsContainer container1 = g.BeginContainer();
                g.SmoothingMode = base.OwnerDocument.SmoothingMode;
                if (!this.Visible)
                {
                    g.SetClip(Rectangle.Empty);
                }
                Matrix matrix1 = this.Transform.Matrix.Clone();
                this.GraphTransform.Matrix.Multiply(matrix1, MatrixOrder.Prepend);
                //g.Transform = matrix1;
                ClipAndMask.ClipPath.Clip(g, time, this);
                this.TempFillOpacity = Math.Min(1f, this.FillOpacity);
                this.TempOpacity = Math.Min(1f, this.Opacity);
                this.TempStrokeOpacity = Math.Min(1f, this.StrokeOpacity);
                Matrix matrix2 = this.GraphTransform.Matrix.Clone();
                if (this.pretime != time)
                {
                    this.graphPath.Reset();
                    foreach(IGraph childgraph in this.graphList )
                    {
                        childgraph.ShowConnectPoints=false;
                    }
                }
                SvgElementCollection.ISvgElementEnumerator enumerator1 = this.graphList.GetEnumerator();
                while (enumerator1.MoveNext())
                {
                    IGraph graph1 = (IGraph) enumerator1.Current;
                    graph1.GraphTransform.Matrix = matrix2.Clone();
                    graph1.Draw(g, time);
                    if ((this.pretime != time))
                    {
                        GraphicsPath path1 = (GraphicsPath) graph1.GPath.Clone();
                        path1.Transform(graph1.Transform.Matrix);
                        this.graphPath.StartFigure();
                        if (path1.PointCount > 0)
                        {
                            this.graphPath.AddPath(path1, false);
                        }
                    }
                }
                if(this.pretime != time)
                {
                    this.CreateConnectPoint();
                }
                this.DrawConnect(g);
                ClipAndMask.ClipPath.DrawClip(g, time, this);
                g.EndContainer(container1);
                this.pretime = time;
            }
        }
        private void Render(Graphics graphics, Size size, Random random, IEnumerable<CharRenderInfo> characters, StringFormat format, float textWidth)
        {
            string text = Text;

            int x = (text.Length == 1)
                ? (int)(size.Width / 2 - textWidth / 2)
                : margin;

            int stepX = (text.Length == 1)
                ? 0
                : (int)(size.Width - textWidth - margin * 2) / (text.Length - 1);

            foreach (CharRenderInfo c in characters)
            {
                Font font = c.Font;
                int rotate = random.Next(minRotation, maxRotation + 1);
                int maxY = size.Height - font.Height - margin * 2;
                int y = (margin >= maxY) ? margin : random.Next(margin, maxY + 1);

                GraphicsContainer container = graphics.BeginContainer();

                graphics.TranslateTransform(x + c.Size.Width / 2, y + c.Size.Height / 2);
                graphics.RotateTransform(rotate);
                graphics.TranslateTransform(-c.Size.Width / 2, -c.Size.Height / 2);

                RenderCharacter(graphics, c.Char, c.Size, c.Font, c.Color, format, random);

                graphics.EndContainer(container);

                x += (int)c.Size.Width + stepX;
            }
        }
    /// <summary>
    /// Custom paints the cell. The base implementation of the DataGridViewTextBoxCell 
    /// type is called first to draw the text box part. Then the <see cref="Image"/> is drawn.
    /// </summary>
    /// <param name="graphics">The <see cref="Graphics"/> used to paint the <see cref="DataGridViewCell"/>.</param>
    /// <param name="clipBounds">A <see cref="Rectangle"/> that represents the area of the <see cref="DataGridView"/> that needs to be repainted.</param>
    /// <param name="cellBounds">A <see cref="Rectangle"/> that contains the bounds of the <see cref="DataGridViewCell"/> that is being painted.</param>
    /// <param name="rowIndex">The row index of the cell that is being painted.</param>
    /// <param name="cellState">A bitwise combination of <see cref="DataGridViewElementStates"/> values that specifies the state of the cell.</param>
    /// <param name="value">The data of the <see cref="DataGridViewCell"/> that is being painted.</param>
    /// <param name="formattedValue">The formatted data of the <see cref="DataGridViewCell"/> that is being painted.</param>
    /// <param name="errorText">An error message that is associated with the cell.</param>
    /// <param name="cellStyle">A <see cref="DataGridViewCellStyle"/> that contains formatting and style information about the cell.</param>
    /// <param name="advancedBorderStyle">A <see cref="DataGridViewAdvancedBorderStyle"/> that contains border styles for the cell that is being painted.</param>
    /// <param name="paintParts">A bitwise combination of the <see cref="DataGridViewPaintParts"/> values that specifies which parts of the cell need to be painted.</param>
    protected override void Paint(Graphics graphics, Rectangle clipBounds,
                Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState,
                object value, object formattedValue, string errorText,
                DataGridViewCellStyle cellStyle,
                DataGridViewAdvancedBorderStyle advancedBorderStyle,
                DataGridViewPaintParts paintParts)
    {
      // Paint the base content
      base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState,
                  value, formattedValue, errorText, cellStyle,
                  advancedBorderStyle, paintParts);

      if (this.Image != null)
      {
        // Draw the image clipped to the cell.
        System.Drawing.Drawing2D.GraphicsContainer container = graphics.BeginContainer();

        graphics.SetClip(cellBounds);
        graphics.DrawImage(this.Image, cellBounds.Location.X, cellBounds.Location.Y, this.Image.Width, this.Image.Height);

        graphics.EndContainer(container);
      }
    }
Example #27
0
        private void draw2(Graphics g, int time)
        {
            if (base.DrawVisible)
            {
                GraphicsContainer container1 = g.BeginContainer();
                Matrix matrix1 = base.Transform.Matrix.Clone();
                base.GraphTransform.Matrix.Multiply(matrix1, MatrixOrder.Prepend);
                if (!this.editMode)
                {
                    g.SmoothingMode = base.OwnerDocument.SmoothingMode;

                    if (this == this.OwnerTextElement)
                    {
                        ClipPath.Clip(g, time, this);
                    }
                    if (!base.Visible)
                    {
                        g.SetClip(Rectangle.Empty);
                    }
                    ISvgBrush brush1 = base.GraphBrush;

                    if (this == this.OwnerTextElement)
                    {
                        this.currentPostion = PointF.Empty;
                    }
                    float single1 = this.Size;
                    this.GPath = new GraphicsPath();
                    using (StringFormat format1 = this.GetGDIStringFormat())
                    {

                        using (FontFamily family1 = this.GetGDIFontFamily())
                        {
                            if (this.X == 0)
                            {
                                this.currentPostion.X = this.currentPostion.X + this.Dx;
                            }
                            else
                            {
                                this.currentPostion.X = (this.X + this.Dx);
                            }
                            if (this.Y == 0)
                            {
                                this.currentPostion.Y = this.currentPostion.Y + this.Dy;
                            }
                            else
                            {
                                this.currentPostion.Y = (this.Y + this.Dy);
                            }
                            //this.currentPostion.Y += (this.Y + this.Dy);
                            int num3 = this.GetGDIStyle();
                            base.TempFillOpacity = Math.Min(1f, base.FillOpacity);
                            base.TempOpacity = Math.Min(1f, base.Opacity);
                            base.TempStrokeOpacity = Math.Min(1f, base.StrokeOpacity);
                            this.old = true;
                            foreach (XmlNode node1 in this.ChildNodes)
                            {
                                GraphicsPath path1 = new GraphicsPath();
                                if (node1 is Text)
                                {
                                    ((Text) node1).currentPostion = this.currentPostion;
                                    ((Text) node1).GraphTransform.Matrix = base.GraphTransform.Matrix.Clone();
                                    ((Text) node1).Draw(g, time);
                                    this.currentPostion = ((Text) node1).currentPostion;
                                    if (((Text) node1).GPath.PointCount > 0)
                                    {
                                        this.GPath.StartFigure();
                                        this.GPath.AddPath(((Text) node1).GPath, false);
                                    }
                                    continue;
                                }
                                if (node1.NodeType == XmlNodeType.Text)
                                {
                                    string text1 = "t";//this.TrimText(node1.Value);
                                    Font font1 = new Font(family1.Name, single1, (FontStyle) num3);
                                    float single2 = (((float) family1.GetCellAscent(FontStyle.Regular))/((float) family1.GetEmHeight(FontStyle.Regular)))*single1;
                                    SizeF ef1 = g.MeasureString(text1, font1, new PointF(this.currentPostion.X, this.currentPostion.Y - single2), format1);
                                    float single3 = ef1.Width;

                                    float single5 = (((float) family1.GetLineSpacing(FontStyle.Regular)) / ((float) family1.GetEmHeight(FontStyle.Regular))) * single1 ; //�о�

                                    float offy = this.currentPostion.Y -single2;
                                    float offx = this.currentPostion.X;
                                    for(int i=0 ;i<Lines.Length;i++)
                                    {
                                        if (!base.ShowBound)
                                        {
                                            GraphicsContainer gc=g.BeginContainer();
                                            g.Transform=base.GraphTransform.Matrix;
                                            //g.DrawString(lines[i], font1,new SolidBrush(Color.Black),100,100);
                                            g.DrawString(lines[i], font1,new SolidBrush(Color.Black),new PointF(offx, offy));
                                            g.EndContainer(gc);
                                        }
                                        path1.AddString(lines[i], family1, num3, single1, new PointF(offx, offy), format1);
                                        if(Vertical)
                                        {
                                            offx += single5;
                                        }
                                        else
                                        {
                                            offy += single5;
                                        }
                                    }
                                    this.currentPostion.X += ((single3*3f)/4f);
                                    this.GPath.StartFigure();
                                    this.GPath.AddPath(path1, false);
                                    float single4 = base.Opacity;
                                    if (this.svgAnimAttributes.ContainsKey("fill-opacity"))
                                    {
                                        single4 = Math.Min(single4, base.FillOpacity);
                                    }

                                    path1.Transform(base.GraphTransform.Matrix);

                                    if (!base.ShowBound)
                                    {

            //										brush1.Paint(path1, g, time, single4);
            //										//								Stroke stroke1 = Stroke.GetStroke(this);
            //										//								stroke1.Paint(g, this,path1, time);
            //										base.GraphStroke.Paint(g, this, path1, 0);
                                        continue;
                                    }
                                    else
                                    {
                                        g.DrawPath(new Pen(base.BoundColor), path1);
                                    }
                                }
                                path1.Dispose();
                            }
                        }
                    }

                    matrix1.Dispose();
                    ClipPath.DrawClip(g, time, this);
                    g.EndContainer(container1);
                    this.pretime = time;
                    this.old = false;
                }
            }
        }
Example #28
0
        void drawN(Graphics g, Rectangle lei)
        {
            GraphicsContainer gc = g.BeginContainer();

            g.CompositingQuality = CompositingQuality.HighQuality;
            float s = 0f;
            //s = Convert.ToSingle(500 * 60 / scalex / 1000);
            s = 400 / 60 / (pageScale);

            float f1 = 40;

            int num1 = 1000;

            if (s * f1 > 1000)
            {
                f1 = num1 / s;
                while (f1 < 40)
                {
                    num1 += 50;
                    f1 = num1 / s;
                }
            }
            else
            {
                num1 -= 50;
                f1 = num1 / s;
                while (f1 > 45)
                {
                    num1 -= 50;
                    f1 = num1 / s;
                }
            }
            //MessageBox.Show(s + "," + f1 + "," + num1);
            Brush bkbru = Brushes.Black;

            Pen p1 = new Pen(Color.Black);
            Font ft = new Font("����", 15f);
            Font sft = new Font("����", 8f);
            //Polygon rt1 = tlVectorControl1.SVGDocument.CurrentElement as Polygon;
            //RectangleF pictureBox1 = rt1.GetBounds();

            //Rectangle pictureBox1 = pageSetting.Bounds;

            //g.FillRectangle(Brushes.White, lei.X , lei.Y + lei.Height - 37, 90, 37);
            //g.DrawRectangle(p1, lei.X, lei.Y + lei.Height-37, 90, 37);

            g.DrawString("1", ft, bkbru, new PointF(lei.X + 45, lei.Y + lei.Height - 60));
            g.DrawString(":", ft, bkbru, new PointF(lei.X + 57, lei.Y + lei.Height - 60));
            g.DrawString(Convert.ToString(Convert.ToInt32(num1) / 100), ft, bkbru, new PointF(lei.X + 69, lei.Y + lei.Height - 60));
            g.DrawString(" ��", ft, bkbru, new PointF(lei.X + 105, lei.Y + lei.Height - 60));
            //,120 40,120 100
            PointF leto = new PointF(lei.X, lei.Y);
            PointF lebo = new PointF(lei.X, lei.Y + lei.Height);
            PointF rito = new PointF(lei.X + lei.Width, lei.Y);
            PointF ribo = new PointF(lei.X + lei.Width, lei.Y + lei.Height);
            //Pen bkb = true;
            g.DrawLine(new Pen(Color.Black, 1.0f), leto, lebo);
            g.DrawLine(new Pen(Color.Black, 0.8f), leto, rito);
            g.DrawLine(new Pen(Color.Black, 1.0f), lebo, ribo);
            g.DrawLine(new Pen(Color.Black, 0.8f), rito, ribo);
            g.EndContainer(gc);
        }
Example #29
0
        public override void Draw(Graphics g, int time)
        {
            if (base.DrawVisible)
            {
                Matrix matrix1 = base.Transform.Matrix.Clone();

                GraphicsContainer container1 = g.BeginContainer();

                g.SmoothingMode = base.OwnerDocument.SmoothingMode;

                Matrix matrix2 = base.GraphTransform.Matrix.Clone();
                base.GraphTransform.Matrix.Multiply(matrix1, MatrixOrder.Prepend);

                ClipAndMask.ClipPath.Clip(g, time, this);
                bool flag1 = base.Visible;
                if (!base.Visible)
                {
                    g.SetClip(Rectangle.Empty);
                }
                float single1 = this.Opacity;
                if (this.svgAnimAttributes.ContainsKey("fill-opacity"))
                {
                    single1 = Math.Min(single1, (float) this.svgAnimAttributes["fill-opacity"]);
                }
                ISvgBrush brush1 = this.GraphBrush;
                Stroke stroke1 =this.graphStroke;
                using (GraphicsPath path1 = (GraphicsPath) this.GPath.Clone())
                {
                    path1.Transform(base.GraphTransform.Matrix);
                    if (!base.ShowBound)
                    {
                        if (this.IsMarkerChild) {
                            Marker marker= this.ParentNode as Marker;
                            this.IsChanged = false;
                            this.pretime = time;
                            stroke1 = marker.GraphStroke;
                            if (brush1 != null && !brush1.IsEmpty())
                                brush1 = marker.GraphBrush;

                        }
                        if (((brush1 != null) && !(this is Line)) && !(this is Polyline)) {
                            brush1.Paint(path1, g, time, single1);
                        }

                        stroke1.Paint(g, this, path1, time);

                        if(this is Polyline)
                        {
                            if (LineType == "1") {
                                //ƽ���ߣ�
                                using (Pen p = new Pen(brush1.Pen.Color)) {
                                    p.Width = this.graphStroke.StrokePen.Width;
                                    p.CompoundArray = new float[] { 0f, 0.1f, 0.9f, 1f };
                                    g.DrawPath(p, path1);
                                }
                            } else if(LineType == "2") {//��·Ч��
                                using (Pen p = new Pen(Color.FromArgb(120,120,120))) {
                                    p.Width = this.graphStroke.StrokePen.Width;
                                    p.CompoundArray = new float[] { 0f, 0.1f, 0.9f, 1f };
                                    g.DrawPath(p, path1);
                                }
                            }
                        }
                    }
                    else
                    {
                        g.DrawPath(new Pen(base.BoundColor), path1);
                    }
                    this.DrawConnect(g);
                }
                matrix1.Dispose();
                ClipAndMask.ClipPath.DrawClip(g, time, this);
                g.EndContainer(container1);
                this.pretime = time;
            }
        }
Example #30
0
 private void DrawTitle(Graphics g)
 {
     try
     {
         GraphicsContainer container = g.BeginContainer();
         Rectangle titleBoxRect = TitleBoxRect;
         if (titleBoxRect.Width < (LeftBorderWidth + RightBorderWidth))
         {
             titleBoxRect.Width = 0;
         }
         g.SetClip(titleBoxRect);
         RectangleF layoutRectangle = titleBoxRect;
         layoutRectangle.Inflate(-2f, -2f);
         layoutRectangle.Width = 0f;
         var stringFormat = new StringFormat {Alignment = StringAlignment.Near};
         stringFormat.FormatFlags |= StringFormatFlags.NoClip | StringFormatFlags.NoWrap;
         stringFormat.Trimming = StringTrimming.None;
         using (var brush = new SolidBrush(Chart.visualSettings.PaneFrame2TextColor))
         {
             foreach (Series.Series series in Owner.Series)
             {
                 SizeF ef3 = g.MeasureString(series.Name, Font, layoutRectangle.Location, stringFormat);
                 layoutRectangle.Offset(layoutRectangle.Width, 0f);
                 layoutRectangle.Width = ef3.Width;
                 layoutRectangle.Intersect(titleBoxRect);
                 string title = series.Name;
                 if (!string.IsNullOrEmpty(Title)) title = Title;
                 g.DrawString(title, Font, brush, layoutRectangle, stringFormat);
                 if (string.IsNullOrEmpty(Title))
                 {
                     // если заголовок не задан отдельно - вывести результирующую
                     ef3 = g.MeasureString(series.CurrentPriceString + "0", Font, layoutRectangle.Location,
                                             stringFormat);
                     layoutRectangle.Offset(layoutRectangle.Width, 0f);
                     layoutRectangle.Width = ef3.Width;
                     layoutRectangle.Intersect(titleBoxRect);
                     g.DrawString(series.CurrentPriceString, Font, brush, layoutRectangle, stringFormat);
                 }
                 break; // вывести только первую
             }
         }
         g.EndContainer(container);
     }
     catch
     {
     }
 }