Наследование: MarshalByRefObject, ICloneable, IDisposable
 public InterestPointDrawer(Bitmap background, SRegion[] regions)
     : base(background, regions)
 {
     Color c = Color.FromArgb(125, Color.Red);
     pen = new Pen(c);
     brush = new SolidBrush(c);
 }
Пример #2
1
 public Ellipse(Pen pen, Brush brush, Point start, Point end)
 {
     Pen = pen;
     Brush = brush;
     Start = start;
     End = end;
 }
Пример #3
1
 public DataPoint(string name, float value, Brush brush)
 {
     m_name = name;
     m_value = value;
     m_brush = brush;
     m_color = Color.Black;
 }
		protected void DoGraphics( ArrayList chains )
		{
			m_panelClip.Graphics.FillRectangle( Brushes.Black, m_panelClip.Rect );

			int w = 350;
			int h = 50;
			m_backBrush  = new SolidBrush( Color.FromArgb( 60, 60, 60 ) );
			

			string[] prefix = new string[]{"LongMethod", "TemporaryField", "MessageChains"};
			string[] baseCls = new string[]{"Detector", "Visualization", "Component", "Comparer"};

			int i = 0;

			MovieClip clip = m_panelClip.CreateSubMovieClip( 0, 0, w, h );
			foreach( string bass in baseCls)
			{
				CreateClassHier( clip, bass, prefix, 0, 0, w/4, h );
				i++;
			}
			MovieClip legend = clip.CreateSubMovieClip( (3*w)/4, 0, w/4, h );
			Brush[] brushes = new Brush[]{Brushes.LightGreen,Brushes.LightBlue, Brushes.LightPink};
			for( int d = 0; d < prefix.Length; d++ )
			{   // extra spacing in between disconnected chains?
				MovieClip index = legend.CreateSubMovieClip( 0, 0, w/4, h/3 );
				MovieClip dot = index.CreateSubMovieClip( 0, 0, 10, 10 );
				dot.Graphics.FillEllipse( brushes[d], 0, 0, 9, 9 );
				MovieClip text = index.CreateSubMovieClip( 10, 0, w/4 - 10, h/3 );
				text.LeftString( prefix[d], Brushes.White);
			}
			Space( 4, 1, legend.Children, w/4 );
			Space( 10, 10, clip.Children, this.Width );
		}
Пример #5
1
      public void SetPixelScaled(int x, int y, Brush brush, int scale = 1)
      {
        int bitmapX = x * scale;
        int bitmapY = y * scale;

        FillRect(bitmapX, bitmapY, scale, scale, brush);
      }
Пример #6
1
        public ImageSplitter(Image source, string format, int sizeX, int sizeY, int marginX, int marginY, Color background, Brush foreground)
        {
            _sizeX = sizeX;
            _sizeY = sizeY;
            _source = source;
            _format = format;
            _marginX = marginX;
            _marginY = marginY;
            _background = background;

            _tileSizeX = _sizeX + 1;
            _tileSizeY = _sizeY + 1;
            _innerTilesX = (_source.Width - 1)/_sizeX;
            _innerTilesY = (_source.Height - 1)/_sizeY;
            _lastTileSizeX = (_source.Width - 1)%_sizeX + 1;
            _lastTileSizeY = (_source.Height - 1)%_sizeY + 1;
            _dirName = "out_" + _sizeX + "_" + _sizeY;

            _combinedBitmap = new Bitmap(
                _marginX + _innerTilesX * _tileSizeX + _lastTileSizeX,
                _marginY + _innerTilesY * _tileSizeY + _lastTileSizeY);

            _combinedG = Graphics.FromImage(_combinedBitmap);
            _foreground = foreground;
        }
        public static void BuildStatusImageColumnCellPainting(DataGridViewCellPaintingEventArgs e, GitRevision revision, Brush foreBrush, Font rowFont)
        {
            if (revision.BuildStatus != null)
            {
                Image buildStatusImage = null;

                switch (revision.BuildStatus.Status)
                {
                    case BuildInfo.BuildStatus.Success:
                        buildStatusImage = Resources.BuildSuccessful;
                        break;
                    case BuildInfo.BuildStatus.Failure:
                        buildStatusImage = Resources.BuildFailed;
                        break;
                    case BuildInfo.BuildStatus.Unknown:
                        buildStatusImage = Resources.BuildCancelled;
                        break;
                    case BuildInfo.BuildStatus.InProgress:
                        buildStatusImage = Resources.Icon_77;
                        break;
                    case BuildInfo.BuildStatus.Unstable:
                        buildStatusImage = Resources.bug;
                        break;
                    case BuildInfo.BuildStatus.Stopped:
                        buildStatusImage = Resources.BuildCancelled;
                        break;
                }

                if (buildStatusImage != null)
                {
                    e.Graphics.DrawImage(buildStatusImage, new Rectangle(e.CellBounds.Left, e.CellBounds.Top + 4, 16, 16));
                }
            }
        }
Пример #8
1
        public void WatermarkFileWithText(string inputFile, string outputFile, string text, Font font, int x, int y,
                                          bool renderOver,
                                          Brush under, Brush over, StringAlignment xAlignment,
                                          StringAlignment yAlignment)
        {
            Image imgPhoto = null;
            Image outputPhoto = null;
            try
            {
                try
                {
                    imgPhoto = Image.FromFile(inputFile);
                }
                catch (Exception ex)
                {
                    throw new InvalidOperationException("Failed to open file \"" + inputFile + "\"", ex);
                }

                WatermarkImageWithText(imgPhoto, ref outputPhoto, SmoothingMode.AntiAlias, text, font, x, y, renderOver,
                                       under, over, xAlignment, yAlignment);

                imgPhoto.Dispose();
                imgPhoto = null;

                outputPhoto.Save(outputFile, ImageFormat.Jpeg);
            }
            finally
            {
                if (imgPhoto != null) imgPhoto.Dispose();
                if (outputPhoto != null) outputPhoto.Dispose();
            }
        }
Пример #9
1
        public Surface()
        {
            ScreenRectangle = CaptureHelpers.GetScreenBounds();
            ScreenRectangle0Based = CaptureHelpers.ScreenToClient(ScreenRectangle);

            InitializeComponent();

            using (MemoryStream cursorStream = new MemoryStream(Resources.Crosshair))
            {
                Cursor = new Cursor(cursorStream);
            }

            DrawableObjects = new List<DrawableObject>();
            Config = new SurfaceOptions();
            timerStart = new Stopwatch();
            timerFPS = new Stopwatch();

            borderPen = new Pen(Color.Black);
            borderDotPen = new Pen(Color.White);
            borderDotPen.DashPattern = new float[] { 5, 5 };
            nodeBackgroundBrush = new SolidBrush(Color.White);
            textFont = new Font("Verdana", 16, FontStyle.Bold);
            infoFont = new Font("Verdana", 9);
            textBackgroundBrush = new SolidBrush(Color.FromArgb(75, Color.Black));
            textBackgroundPenWhite = new Pen(Color.FromArgb(50, Color.White));
            textBackgroundPenBlack = new Pen(Color.FromArgb(150, Color.Black));
            markerPen = new Pen(Color.FromArgb(200, Color.Red)) { DashStyle = DashStyle.Dash };
        }
Пример #10
1
        public VideoRender(PictureBox view)
        {
            this.view = view;
			this.bufferContext = BufferedGraphicsManager.Current;
            this.foreground = new SolidBrush(Color.ForestGreen);
            this.background = new SolidBrush(Color.Black);
        }
Пример #11
1
 public void Draw(Graphics gr, Pen pen, Brush backgroundBrush, Pen forePen)
 {
     //draw minus
     gr.FillRectangle(backgroundBrush, rectangle);
     gr.DrawRectangle(pen, rectangle);
     gr.DrawLine(forePen, rectangle.Left + 2, rectangle.Top + rectangle.Height / 2, rectangle.Right - 2, rectangle.Top + rectangle.Height / 2);
 }
Пример #12
1
 private static void DrawStringML(this Graphics G, string Text, Font font, Brush brush, float x, ref float y, float mX)
 {
     string[] words = Text.Split(' ');
     float tempX = x;
     float totalSpace = mX - x;
     SizeF measureWord = new SizeF(0, font.GetHeight());
     float tempWordWidth = 0;
     foreach (string word in words)
     {
         //measure word width (based in font size)
         tempWordWidth = G.MeasureString(word + " ", font).Width;
         measureWord.Width += tempWordWidth;
         //check if the word fits in free line space
         //if not then change line
         if (measureWord.Width > totalSpace)
         {
             y += font.GetHeight();
             tempX = x;
             measureWord.Width = tempWordWidth;
         }
         G.DrawString(word + " ", font, brush, tempX, y);
         tempX += tempWordWidth;
     }
     y += font.GetHeight();
 }
Пример #13
1
 public static void FillRoundedRectangle(this Graphics g, Brush brush, RectangleF rect, float topLeftCorner, float topRightCorner, float bottomLeftCorner, float bottomRightCorner)
 {
     using(var gp = GraphicsUtility.GetRoundedRectangle(rect, topLeftCorner, topRightCorner, bottomLeftCorner, bottomRightCorner))
     {
         g.FillPath(brush, gp);
     }
 }
Пример #14
1
		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);
		}
Пример #15
1
        protected virtual void DrawRectangle(Pen outlinePen, Brush fillBrush)
        {
            if (fillBrush is LinearGradientBrush)
            {
                if ((rect.Width > 0) && (rect.Height > 0))
                {
                    fillBrush = new LinearGradientBrush(rect,
                          args.settings.PrimaryColor,
                          args.settings.SecondaryColor,
                          args.settings.GradiantStyle);
                    //outlinePen = new Pen(fillBrush, args.settings.Width);
                }
            }

            switch (args.settings.DrawMode)
            {
                case DrawMode.Outline:
                    g.DrawRectangle(outlinePen, rect);
                    break;

                case DrawMode.Filled:
                    g.FillRectangle(fillBrush, rect);
                    break;

                case DrawMode.Mixed:
                    g.FillRectangle(fillBrush, rect);
                    g.DrawRectangle(outlinePen, rect);
                    break;

                case DrawMode.MixedWithSolidOutline:
                    g.FillRectangle(fillBrush, rect);
                    g.DrawRectangle(outlinePen, rect);
                    break;
            }
        }
Пример #16
1
 public NodeCursor(GameUI myGameUI, int myDepth)
     : base(myGameUI, myDepth)
 {
     penCursorMini = new Pen(new SolidBrush(Color.FromArgb(180, Color.Wheat)), 2);
     brushCellMarker = new SolidBrush(Color.FromArgb(40, Color.Yellow));
     brushCursorMini = new SolidBrush(Color.FromArgb(200, Color.White));
 }
Пример #17
1
 public static void FillRoundRectangle(Graphics g, Brush brush, Rectangle rect, int cornerRadius)
 {
     using (GraphicsPath path = CreateRoundedRectanglePath(rect, cornerRadius))
     {
         g.FillPath(brush, path);
     }
 }
        public static void BuildStatusMessageCellPainting(DataGridViewCellPaintingEventArgs e, GitRevision revision, Brush foreBrush, Font rowFont)
        {
            if (revision.BuildStatus != null)
            {
                Brush buildStatusForebrush = foreBrush;

                switch (revision.BuildStatus.Status)
                {
                    case BuildInfo.BuildStatus.Success:
                        buildStatusForebrush = Brushes.DarkGreen;
                        break;
                    case BuildInfo.BuildStatus.Failure:
                        buildStatusForebrush = Brushes.DarkRed;
                        break;
                    case BuildInfo.BuildStatus.InProgress:
                        buildStatusForebrush = Brushes.Blue;
                        break;
                    case BuildInfo.BuildStatus.Unstable:
                        buildStatusForebrush = Brushes.OrangeRed;
                        break;
                    case BuildInfo.BuildStatus.Stopped:
                        buildStatusForebrush = Brushes.Gray;
                        break;
                }

                var text = (string)e.FormattedValue;
                e.Graphics.DrawString(text, rowFont, buildStatusForebrush, new PointF(e.CellBounds.Left, e.CellBounds.Top + 4));
            }
        }
        public static void FillPill(Brush b, RectangleF rect, Graphics g)
        {
            if (rect.Width > rect.Height)
            {
                g.SmoothingMode = SmoothingMode.HighQuality;
                g.FillEllipse(b, new RectangleF(rect.Left, rect.Top, rect.Height, rect.Height));
                g.FillEllipse(b, new RectangleF(rect.Left + rect.Width - rect.Height, rect.Top, rect.Height, rect.Height));

                var w = rect.Width - rect.Height;
                var l = rect.Left + ((rect.Height) / 2);
                g.FillRectangle(b, new RectangleF(l, rect.Top, w, rect.Height));
                g.SmoothingMode = SmoothingMode.Default;
            }
            else if (rect.Width < rect.Height)
            {
                g.SmoothingMode = SmoothingMode.HighQuality;
                g.FillEllipse(b, new RectangleF(rect.Left, rect.Top, rect.Width, rect.Width));
                g.FillEllipse(b, new RectangleF(rect.Left, rect.Top + rect.Height - rect.Width, rect.Width, rect.Width));

                var t = rect.Top + (rect.Width / 2);
                var h = rect.Height - rect.Width;
                g.FillRectangle(b, new RectangleF(rect.Left, t, rect.Width, h));
                g.SmoothingMode = SmoothingMode.Default;
            }
            else if (rect.Width == rect.Height)
            {
                g.SmoothingMode = SmoothingMode.HighQuality;
                g.FillEllipse(b, rect);
                g.SmoothingMode = SmoothingMode.Default;
            }
        }
Пример #20
1
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Updates the background brush.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private void UpdateBackgroundBrush()
		{
			if (m_BackBrush != null)
				m_BackBrush.Dispose();

			m_BackBrush = null;
		}
Пример #21
0
        public CommandInputForm(ICommandProvider commandProvider, ICommandHistory history)
        {
            InitializeComponent();
            Width = Screen.PrimaryScreen.Bounds.Width;
            Font = new Font(Gentium.FontFamily, 30, FontStyle.Regular);

            DoubleBuffered = true;
            SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);

            _commandProvider = commandProvider;
            _commandHistory = history;
            _historicCommand = _commandHistory.GetEnumerator();

            _backBrush = new SolidBrush(BackColor);
            _foreBrush = new SolidBrush(Color.FromArgb(255, 10, 40));

            _dropDownForm = new DropDownForm();
            _dropDownForm.Font = Font;
            _dropDownForm.Top = Bottom;

            _mouseHook = new MouseHook();
            _mouseHook.MouseMove += new MouseMoveEventHandler(OnMouseMove);
            _mouseHook.MouseClick += new MouseClickEventHandler(Cancel);

            _inputTextBox.TextChanged += delegate { OnInputChanged(); };
            _inputTextBox.SelectionChanged += delegate { OnInputChanged(); };

            MakeForeground();
        }
Пример #22
0
 /// <summary>
 /// Creates a new powerup
 /// </summary>
 /// <param name="type">The type of the powerup: Stretch, Shrink, Multi</param>
 /// <param name="powerUpBrush">Color of the powerup</param>
 /// <param name="xpos">Centre X position</param>
 /// <param name="ypos">Centre Y position</param>
 public PowerUp(string type, Brush powerUpBrush, int xpos, int ypos)
 {
     label = type;
     brush = powerUpBrush;
     x = xpos - width / 2; //transforms centre to left
     y = ypos - height / 2; //transforms centre to top
 }
Пример #23
0
 public Player()
 {
     _pen = new Pen(Ext.ColorFromHsv(120, 0.75, 0.75));
     _brush = new SolidBrush(_pen.Color);
     _field = EntitiesOfType<Field>().Single();
     Respawn();
 }
Пример #24
0
        /// <summary>
        /// Initialize Renderer
        /// </summary>
        /// <param name="iSize">Size of the i.</param>
        /// <param name="darkBrush">The dark brush.</param>
        /// <param name="lightBrush">The light brush.</param>
        /// <remarks></remarks>
        public GraphicsRenderer(ISizeCalculation iSize, Brush darkBrush, Brush lightBrush)
        {
            m_iSize = iSize;

            m_DarkBrush = darkBrush;
            m_LightBrush = lightBrush;
        }
Пример #25
0
 public static void DrawAroundRect(this Graphics g, Rectangle inRect, Rectangle outRect, Brush b)
 {
     g.FillRectangle(b, new Rectangle(outRect.X, outRect.Y, outRect.Width, outRect.Y+inRect.Y)); //top
     g.FillRectangle(b, new Rectangle(outRect.X, outRect.Y+inRect.Y, inRect.X-outRect.X, outRect.Height-(outRect.Y + inRect.Y))); //left
     g.FillRectangle(b, new Rectangle(inRect.X, inRect.Y + inRect.Height, outRect.Width - (inRect.X - outRect.X), outRect.Height-(inRect.Y + inRect.Height))); //bottom
     g.FillRectangle(b, new Rectangle(inRect.X+inRect.Width, inRect.Y, outRect.Width-inRect.X+inRect.Width, inRect.Height)); //right
 }
Пример #26
0
 public static void FillRoundedRectangle(this Graphics g, Brush brush, RectangleF rect, float cornerRadius)
 {
     using(var gp = GraphicsUtility.GetRoundedRectangle(rect, cornerRadius))
     {
         g.FillPath(brush, gp);
     }
 }
Пример #27
0
        protected override void OnPaint( PaintEventArgs pe )
        {
            if ( Form1.colors == null ) return;

              // Get the graphics object
              Graphics gfx = pe.Graphics;

              int width = this.Size.Width;
              int height = this.Size.Height;
              int stripes = Form1.colors.Length;
              int stripHeight = height / stripes;
              int columnWidth = width / stripes;
              int y = 0;

              // 1. create color brushes:
              Brush[] brushes = new Brush[ stripes ];
              for ( int i = 0; i < stripes; i++ )
            brushes[ i ] = new SolidBrush( Form1.colors[ i ] );
              Brush brBlack = new SolidBrush( Color.Black );
              Brush brWhite = new SolidBrush( Color.White );

              // 2. draw color stripes:
              Font myFont = new System.Drawing.Font( "Helvetica", 10, FontStyle.Regular );
              for ( int i = 0; i < stripes; i++, y += stripHeight )
              {
            gfx.FillRectangle( brushes[ i ], 0, y, width, stripHeight );
            for ( int j = 0; j < stripes; j++ )
            {
              gfx.DrawString( "Sample", myFont, brushes[ j ], 4 + j * columnWidth, y + 4 );
            }
            gfx.DrawString( Form1.color2string( Form1.colors[ i ] ),
                        myFont, Form1.colors[ i ].GetBrightness() < 0.5f ? brWhite : brBlack,
                        12, y + stripHeight - 20 );
              }
        }
Пример #28
0
        public static void DrawPolygon(Graphics graphics, Polygon pol, Brush brush, Pen pen, IViewport viewport)
        {
            if (pol.ExteriorRing == null) return;
            if (pol.ExteriorRing.Vertices.Count <= 2) return;

            //Use a graphics path instead of DrawPolygon. DrawPolygon has a problem with several interior holes
            var gp = new GraphicsPath();

            //Add the exterior polygon
            var points = GeometryRenderer.WorldToScreenGDI(pol.ExteriorRing, viewport);
            if (points.Length > 2)
                gp.AddPolygon(points);
            //Add the interior polygons (holes)
            foreach (LinearRing linearRing in pol.InteriorRings)
            {
                var interiorPoints = GeometryRenderer.WorldToScreenGDI(linearRing, viewport);
                if (interiorPoints.Length > 2)
                    gp.AddPolygon(interiorPoints);
            }

            if (gp.PointCount == 0) return;

            // Only render inside of polygon if the brush isn't null or isn't transparent
            if (brush != null && brush != Brushes.Transparent)
                graphics.FillPath(brush, gp);
            // Create an outline if a pen style is available
            if (pen != null)
                graphics.DrawPath(pen, gp);
        }
Пример #29
0
 public void AddLine(string text, PointF position, Brush color)
 {
     _lines.Add(text);
     _positions.Add(position);
     _colors.Add(color);
     UpdateText();
 }
Пример #30
0
        public void Init()
        {
            _background = Fugam.Assets.CustomBrushes.BRUSH_BACKGROUND;

            _drawThread = new Thread(new ThreadStart(Draw));
            _drawThread.Start();
        }
Пример #31
0
 /// <summary>
 /// Sets the GraphicBrush property to the given graphics object in the hashtable. If the element doesn't exist, then it adds the graphic element to the hashtable with the given GraphicBrush.
 /// </summary>
 /// <param name="graphic">Graphic element to search or add</param>
 /// <param name="brush">GraphicBrush to set</param>
 public void SetPaint(System.Drawing.Graphics graphic, System.Drawing.Brush brush)
 {
     if (this[graphic] != null)
     {
         ((GraphicsProperties)this[graphic]).PaintBrush = brush;
     }
     else
     {
         GraphicsProperties tempProps = new GraphicsProperties();
         tempProps.PaintBrush = brush;
         Add(graphic, tempProps);
     }
 }
Пример #32
0
        private static void AddMultiPolygon(drawing.Graphics graphics, SqlGeometry multiPolygon, Func <Point, Point> transform, drawing.Pen pen, drawing.Brush brush)
        {
            int numberOfPolygons = multiPolygon.STNumGeometries().Value;

            for (int i = 0; i < numberOfPolygons; i++)
            {
                var polygon = multiPolygon.STGeometryN(i + 1);

                if (polygon.IsNotValidOrEmpty())
                {
                    continue;
                }

                AddPolygon(graphics, polygon, transform, pen, brush);
            }
        }
Пример #33
0
 public override void AnimalionEnd(System.Drawing.Graphics g, DetailDataModel data, System.Drawing.Pen pen, System.Drawing.Brush brush, System.Drawing.Font font)
 {
     animalion.IsPrepareAnimaled = true;
 }
        private void UpdateInterface(object sender, SizeChangedEventArgs e)
        {
            switch (Lead.Value)
            {
            default:
                tracingPen   = System.Drawing.Brushes.Green;
                tracingBrush = System.Windows.Media.Brushes.Green;
                break;

            case Lead.Values.SPO2:
                tracingPen   = System.Drawing.Brushes.Orange;
                tracingBrush = System.Windows.Media.Brushes.Orange;
                break;

            case Lead.Values.RR:
                tracingPen   = System.Drawing.Brushes.Salmon;
                tracingBrush = System.Windows.Media.Brushes.Salmon;
                break;

            case Lead.Values.ETCO2:
                tracingPen   = System.Drawing.Brushes.Aqua;
                tracingBrush = System.Windows.Media.Brushes.Aqua;
                break;

            case Lead.Values.ABP:
                tracingPen   = System.Drawing.Brushes.Red;
                tracingBrush = System.Windows.Media.Brushes.Red;
                break;

            case Lead.Values.CVP:
                tracingPen   = System.Drawing.Brushes.Blue;
                tracingBrush = System.Windows.Media.Brushes.Blue;
                break;

            case Lead.Values.PA:
                tracingPen   = System.Drawing.Brushes.Yellow;
                tracingBrush = System.Windows.Media.Brushes.Yellow;
                break;

            case Lead.Values.ICP:
                tracingPen   = System.Drawing.Brushes.Khaki;
                tracingBrush = System.Windows.Media.Brushes.Khaki;
                break;

            case Lead.Values.IAP:
                tracingPen   = System.Drawing.Brushes.Aquamarine;
                tracingBrush = System.Windows.Media.Brushes.Aquamarine;
                break;

            case Lead.Values.IABP:
                tracingPen   = System.Drawing.Brushes.SkyBlue;
                tracingBrush = System.Windows.Media.Brushes.SkyBlue;
                break;
            }

            borderTracing.BorderBrush = tracingBrush;

            lblLead.Foreground = tracingBrush;
            lblLead.Content    = App.Language.Localize(Lead.LookupString(Lead.Value));

            menuZeroTransducer.IsEnabled  = Strip.Lead.IsTransduced();
            menuToggleAutoScale.IsEnabled = Strip.CanScale;

            if (Strip.CanScale)
            {
                lblScaleAuto.Foreground = tracingBrush;
                lblScaleMin.Foreground  = tracingBrush;
                lblScaleMax.Foreground  = tracingBrush;

                lblScaleAuto.Content = Strip.ScaleAuto
                    ? App.Language.Localize("TRACING:Auto")
                    : App.Language.Localize("TRACING:Fixed");
                lblScaleMin.Content = Strip.ScaleMin.ToString();
                lblScaleMax.Content = Strip.ScaleMax.ToString();
            }

            CalculateOffsets();
        }
Пример #35
0
        /// <summary>
        /// Returns a bitmap containing the specified text drawn using the specified font and brush onto a transparent
        /// image. The image is sized to be as small as possible without running the risk of clipping the text.
        /// </summary>
        public static BitmapGdi TextToBitmap(this D.Graphics graphics, string text, D.Font font, D.Brush brush)
        {
            var size = graphics.MeasureString(text, font); // the default is to include any overhangs into the calculation
            var bmp  = new BitmapGdi((int)size.Width + 1, (int)size.Height + 1);

            using (var g = D.Graphics.FromImage(bmp.Bitmap))
            {
                g.CompositingQuality = graphics.CompositingQuality;
                g.InterpolationMode  = graphics.InterpolationMode;
                g.PixelOffsetMode    = graphics.PixelOffsetMode;
                g.SmoothingMode      = graphics.SmoothingMode;
                g.TextRenderingHint  = graphics.TextRenderingHint;
                g.DrawString(text, font, brush, 0, 0);
            }
            return(bmp);
        }
Пример #36
0
 public void sterg(System.Drawing.Graphics zona_des, System.Drawing.Brush rad, int pozx, int pozy, int diam)
 {
     zona_des.FillEllipse(rad, x0 + 1, y0 + 1, d - 1, d - 1);
 }
Пример #37
0
        //used to fire an event to retrieve formatting info
        //and then draw the cell with this formatting info
        protected override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, System.Windows.Forms.CurrencyManager source, int rowNum, System.Drawing.Brush backBrush, System.Drawing.Brush foreBrush, bool alignToRight)
        {
            DataGridFormatCellEventArgs e = null;

            bool callBaseClass = true;

            //fire the formatting event
            if (SetCellFormat != null)
            {
                int col = this.DataGridTableStyle.GridColumnStyles.IndexOf(this);
                e = new DataGridFormatCellEventArgs(rowNum, col, this.GetColumnValueAtRow(source, rowNum));
                SetCellFormat(this, e);

                if (e.BackBrush != null)
                {
                    backBrush = e.BackBrush;
                }

                //if these properties set, then must call drawstring
                if (e.ForeBrush != null || e.TextFont != null)
                {
                    if (e.ForeBrush == null)
                    {
                        e.ForeBrush = foreBrush;
                    }
                    if (e.TextFont == null)
                    {
                        e.TextFont = this.DataGridTableStyle.DataGrid.Font;
                    }
                    g.FillRectangle(backBrush, bounds);
                    Region    saveRegion = g.Clip;
                    Rectangle rect       = new Rectangle(bounds.X, bounds.Y, bounds.Width, bounds.Height);
                    using (Region newRegion = new Region(rect))
                    {
                        g.Clip = newRegion;
                        int charWidth = (int)Math.Ceiling(g.MeasureString("c", e.TextFont, 20, StringFormat.GenericTypographic).Width);

                        string s        = this.GetColumnValueAtRow(source, rowNum).ToString();
                        int    maxChars = Math.Min(s.Length, (bounds.Width / charWidth));

                        try
                        {
                            g.DrawString(s.Substring(0, maxChars), e.TextFont, e.ForeBrush, bounds.X, bounds.Y + 2);
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message.ToString());
                        }                         //empty catch
                        finally
                        {
                            g.Clip = saveRegion;
                        }
                    }
                    callBaseClass = false;
                }

                if (!e.UseBaseClassDrawing)
                {
                    callBaseClass = false;
                }
            }
            if (callBaseClass)
            {
                base.Paint(g, bounds, source, rowNum, backBrush, foreBrush, alignToRight);
            }

            //clean up
            if (e != null)
            {
                if (e.BackBrushDispose)
                {
                    e.BackBrush.Dispose();
                }
                if (e.ForeBrushDispose)
                {
                    e.ForeBrush.Dispose();
                }
                if (e.TextFontDispose)
                {
                    e.TextFont.Dispose();
                }
            }
        }
Пример #38
0
        private static void AddPoint(drawing.Graphics graphics, SqlGeometry point, Func <Point, Point> transform, drawing.Pen pen, drawing.Brush brush, double pointSize, SimplePointSymbol pointSymbol)
        {
            var parsedPoint = transform(point.AsWpfPoint()).AsPoint();

            if (pointSymbol?.GeometryPointSymbol != null)
            {
                GeometryHelper.Transform(graphics, pointSymbol.GeometryPointSymbol, parsedPoint, pen, brush);
            }
            else if (pointSymbol?.ImagePointSymbolGdiPlus != null)
            {
                //96.09.21
                //graphics.DrawImage(pointSymbol.ImagePointSymbol, new drawing.RectangleF((float)parsedPoint.X - _symbolOffset, (float)parsedPoint.Y - _symbolOffset, _symbolSize, _symbolSize));
                graphics.DrawImage(pointSymbol.ImagePointSymbolGdiPlus, new drawing.RectangleF((float)(parsedPoint.X - pointSymbol.SymbolWidth / 2.0), (float)(parsedPoint.Y - pointSymbol.SymbolHeight), (float)pointSymbol.SymbolWidth, (float)pointSymbol.SymbolHeight));
            }
            else
            {
                graphics.DrawEllipse(pen, (float)(parsedPoint.X - pointSymbol.SymbolWidth / 2.0), (float)(parsedPoint.Y - pointSymbol.SymbolHeight / 2.0), (float)pointSymbol.SymbolWidth, (float)pointSymbol.SymbolHeight);
                graphics.FillEllipse(brush, (float)(parsedPoint.X - pointSymbol.SymbolWidth / 2.0), (float)(parsedPoint.Y - pointSymbol.SymbolHeight / 2.0), (float)pointSymbol.SymbolWidth, (float)pointSymbol.SymbolHeight);
            }
        }
Пример #39
0
        //const int _pointSize = 2;

        //const int _offset = (int)(_pointSize / 2.0);

        ////const int _symbolSize = 16;
        //static readonly int _symbolOffset;//= (int)(_symbolSize / 2.0);

        public static void WriteToImage(drawing.Bitmap image, List <SqlGeometry> geometries, Func <Point, Point> transform, drawing.Pen pen, drawing.Brush brush, double pointSize, SimplePointSymbol pointSymbol)
        {
            drawing.Graphics graphics = drawing.Graphics.FromImage(image);

            int p = 0;

            if (geometries != null)
            {
                foreach (SqlGeometry item in geometries)
                {
                    p += AddGeometry(graphics, item, transform, pen, brush, pointSize, pointSymbol);
                }
            }

            //return image;
        }
Пример #40
0
        public static drawing.Bitmap ParseSqlGeometry(List <SqlGeometry> geometries, double width, double height, Func <Point, Point> transform, drawing.Pen pen, drawing.Brush brush, double pointSize, SimplePointSymbol pointSymbol)
        {
            var result = new drawing.Bitmap((int)width, (int)height);

            drawing.Graphics graphics = drawing.Graphics.FromImage(result);

            int p = 0;

            if (geometries != null)
            {
                foreach (SqlGeometry item in geometries)
                {
                    p += AddGeometry(graphics, item, transform, pen, brush, pointSize, pointSymbol);
                }
            }

            return(result);
        }
Пример #41
0
        private static int AddGeometry(drawing.Graphics graphics, SqlGeometry geometry, Func <Point, Point> transform, drawing.Pen pen, drawing.Brush brush, double pointSize, SimplePointSymbol pointSymbol)
        {
            if (geometry.IsNotValidOrEmpty())
            {
                return(1);
            }

            //CheckGeometry(geometry);
            var type = geometry.GetOpenGisType();

            switch (type)
            {
            case OpenGisGeometryType.Point:
                AddPoint(graphics, geometry, transform, pen, brush, pointSize, pointSymbol);    //, pointSymbol, symbol);
                break;

            case OpenGisGeometryType.LineString:
                AddLineString(graphics, geometry, transform, pen, brush);
                break;

            case OpenGisGeometryType.Polygon:
                AddPolygon(graphics, geometry, transform, pen, brush);
                break;

            case OpenGisGeometryType.MultiPoint:
                AddMultiPoint(graphics, geometry, transform, pen, brush, pointSize, pointSymbol);    //, pointSymbol, symbol);
                break;

            case OpenGisGeometryType.MultiLineString:
                AddMultiLineString(graphics, geometry, transform, pen, brush);
                break;

            case OpenGisGeometryType.MultiPolygon:
                AddMultiPolygon(graphics, geometry, transform, pen, brush);
                break;

            case OpenGisGeometryType.GeometryCollection:
                System.Diagnostics.Trace.WriteLine($"******************WARNNING------at SqlSpatialToGdiBitmap.cs GeometryCollection escaped {new System.Diagnostics.StackTrace().GetFrame(0).GetFileLineNumber()}");
                break;

            case OpenGisGeometryType.CircularString:
            case OpenGisGeometryType.CompoundCurve:
            case OpenGisGeometryType.CurvePolygon:
            default:
                throw new NotImplementedException();
            }
            return(0);
        }
        public override void OnRenderNormalView(System.Drawing.Graphics g, Model.DataModel data, System.Drawing.Pen linePen, System.Drawing.Brush lineBrush, System.Drawing.Brush TextBrush, System.Drawing.Brush DataBrush, System.Drawing.Font TextFont, System.Drawing.Font DataFont)
        {
            //绘制点
            Point item = new Point(data.Area.left + data.Area.Width / 2, data.Area.top + data.Area.Height / 2);

            if (IsDrawDetailData)
            {
                //ReportViewUtils.drawString(g, LocationModel.Location_Right_Right, CoordinateDataModelBean.Y_Data[i] + "", FontData, DataBrush, StartX, StartY, LeftPadding, padding);
                g.DrawString(data.mainData + "", DataFont, DataBrush, (item.X), item.Y - 2 * DataSize);
            }
            if (data.Area.IsMouseIn)
            {
                g.FillEllipse(lineBrush, item.X - 4, item.Y - 4, 8, 8);
            }
            else
            {
                g.FillEllipse(lineBrush, item.X - 2, item.Y - 2, 4, 4);
            }
        }
Пример #43
0
        public override void childPaint(System.Drawing.Graphics g, Model.DataModel Data, System.Drawing.Pen linePen, System.Drawing.Brush lineBrush, System.Drawing.Brush TextBrush, System.Drawing.Brush DataBrush, System.Drawing.Font font_Text, System.Drawing.Font font_Data)
        {
            if (isFirst)
            {
                oldColor = linePen.Color;
                isFirst  = false;
            }
            if (Data != null)
            {
                ///建议把绘制的直接写在这里
                if (Data.Area.IsMouseIn)
                {
                    linePen.Color = ReportViewUtils.perferRed;
                }
                else
                {
                    linePen.Color = oldColor;
                }
                ChildDataModel data = Data as ChildDataModel;
                //圆点的大小
                int        startX      = data.Area.left;
                int        startY      = data.Area.top;
                int        width       = data.Area.right - startX;
                int        height      = data.Area.bottom - startY;
                int        CircleRaius = 10;
                SolidBrush sbrush1     = new SolidBrush(Color.FromArgb(150, 1, 77, 103));
                SolidBrush sf          = new SolidBrush(linePen.Color);
                Rectangle  rect        = new Rectangle(startX, startY, width, height);
                float      realAngle   = 360 * data.mainData * 1.0f / MaxNum;
                //顺时针绘制
                float startAngle = 360 - realAngle;
                g.DrawArc(linePen, rect, startAngle, realAngle);
                //绘制圆弧内的字体
                ReportViewUtils.drawStringWithLimiteText(g, LocationModel.Location_Down, data.mainText, font_Text, TextBrush, startX, startY, width, height / 2, 5);
                //绘制圆弧内的数据
                ReportViewUtils.drawStringWithLimiteText(g, LocationModel.Location_Up, data.mainData + "", font_Data, DataBrush, startX, startY + height / 2, width, height / 2, 5);

                //绘制圆弧外的字体
                Rectangle    Arc_Out = new Rectangle(startX, startY + height + height / 2, width, 30);
                GraphicsPath path    = ReportViewUtils.CreateRoundedRectanglePath(Arc_Out, 15);
                g.FillPath(sbrush1, path);
                path.Dispose();
                ReportViewUtils.drawStringWithLimiteText(g, LocationModel.Location_Center, data.childText + "" + data.childData, font_Data, DataBrush, startX, startY + height + height / 2, width, 30, 8);


                //定位圆点
                int       y           = (int)(Math.Sin(startAngle / 180 * Math.PI) * width / 2);
                int       x           = (int)(Math.Cos(startAngle / 180 * Math.PI) * height / 2);
                Rectangle rect_Circle = new Rectangle(startX + width / 2 - CircleRaius / 2 + x, startY + height / 2 - CircleRaius / 2 + y, CircleRaius, CircleRaius);
                //绘制圆点
                g.FillEllipse(sf, rect_Circle);

                sf.Dispose();
                sbrush1.Dispose();
            }
        }
Пример #44
0
            protected override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, System.Windows.Forms.CurrencyManager source, int rowNum, System.Drawing.Brush backBrush, System.Drawing.Brush foreBrush, bool alignToRight)
            {
                try
                {
                    foreBrush = new SolidBrush(_getColorRowCol(rowNum, this._column));
                    //backBrush = new SolidBrush(Color.GhostWhite);
                }

                catch {}
                finally
                {
                    base.Paint(g, bounds, source, rowNum, backBrush, foreBrush, alignToRight);
                }
            }
Пример #45
0
        private static void AddPolygon(drawing.Graphics graphics, SqlGeometry polygon, Func <Point, Point> transform, drawing.Pen pen, drawing.Brush brush)
        {
            var exteriorRing = polygon.STExteriorRing();

            AddPolygonRing(graphics, exteriorRing, transform, pen, brush);

            int numberOfInteriorRings = polygon.STNumInteriorRing().Value;

            for (int i = 0; i < numberOfInteriorRings; i++)
            {
                var ring = polygon.STInteriorRingN(i + 1);

                AddPolygonRing(graphics, ring, transform, pen, brush);
            }
        }
Пример #46
0
        private static void AddPolygonRing(drawing.Graphics graphics, SqlGeometry ring, Func <Point, Point> transform, drawing.Pen pen, drawing.Brush brush)
        {
            int numberOfPoints = ring.STNumPoints().Value;

            drawing.PointF[] points = new drawing.PointF[numberOfPoints];

            //STPointN(index): index is between 1 and number of points
            for (int i = 0; i < numberOfPoints; i++)
            {
                var parsedPoint = transform(ring.STPointN(i + 1).AsWpfPoint());

                points[i] = new drawing.PointF((float)parsedPoint.X, (float)parsedPoint.Y);
            }

            if (pen != null)
            {
                graphics.DrawPolygon(pen, points);
            }

            if (brush != null)
            {
                graphics.FillPolygon(brush, points);
            }
        }
Пример #47
0
            public bool dSelected;              // Выделенный / Невыделенный объект

            #endregion

            #region // Методы прорисовки

            // Вывод текста
            void lDrawText(String St, Graphics gr, Point p, System.Drawing.Font ft, System.Drawing.Brush brushFt, System.Drawing.Pen pen, System.Drawing.Brush brush)
            {
                // St       - Надпись
                // gr       - Графическая область
                // p        - Позиция надписи
                // ft       - Шрифт надписи
                // brushFt  - Цвет шрифта надписи
                // pen      - Цвет оконтовки надписи
                // brush    - Цвет заливки надписи

                // Начальная проверка
                if (St == null)
                {
                    return;
                }
                if (St == "")
                {
                    return;
                }
                if (gr == null)
                {
                    return;
                }
                if (ft == null)
                {
                    return;
                }
                if (brushFt == null)
                {
                    return;
                }

                // Определяем оконтовку и заливку квадрата вывода
                if ((pen != null) && (brush != null))
                {
                    SizeF stSize = gr.MeasureString(St, ft);
                    if (pen != null)
                    {
                        gr.DrawRectangle(pen, 0.0F, 0.0F, stSize.Width, stSize.Height);
                    }
                    if (brush != null)
                    {
                        gr.FillRectangle(brush, 0.0F, 0.0F, stSize.Width, stSize.Height);
                    }
                }
                ;

                // Выводим текст
                gr.DrawString(St, ft, brushFt, p);
            }
Пример #48
0
        private static void AddMultiLineString(drawing.Graphics graphics, SqlGeometry multiLineString, Func <Point, Point> transform, drawing.Pen pen, drawing.Brush brush)
        {
            int numberOfLineStrings = multiLineString.STNumGeometries().Value;

            for (int i = 1; i <= numberOfLineStrings; i++)
            {
                SqlGeometry lineString = multiLineString.STGeometryN(i);

                if (lineString.IsNotValidOrEmpty())
                {
                    continue;
                }

                AddLineString(graphics, lineString, transform, pen, brush);
            }
        }
Пример #49
0
        //overridden to fire BoolChange event and Formatting event
        protected override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, System.Windows.Forms.CurrencyManager source, int rowNum, System.Drawing.Brush backBrush, System.Drawing.Brush foreBrush, bool alignToRight)
        {
            int colNum = this.DataGridTableStyle.GridColumnStyles.IndexOf(this);

            //used to handle the boolchanging
            ManageBoolValueChanging(rowNum, colNum);

            //fire formatting event
            DataGridFormatCellEventArgs e = null;
            bool callBaseClass            = true;

            if (SetCellFormat != null)
            {
                e = new DataGridFormatCellEventArgs(rowNum, colNum, this.GetColumnValueAtRow(source, rowNum));
                SetCellFormat(this, e);
                if (e.BackBrush != null)
                {
                    backBrush = e.BackBrush;
                }
                callBaseClass = e.UseBaseClassDrawing;
            }
            if (callBaseClass)
            {
                base.Paint(g, bounds, source, rowNum, backBrush, new SolidBrush(Color.Red), alignToRight);
            }

            //clean up
            if (e != null)
            {
                if (e.BackBrushDispose)
                {
                    e.BackBrush.Dispose();
                }
                if (e.ForeBrushDispose)
                {
                    e.ForeBrush.Dispose();
                }
                if (e.TextFontDispose)
                {
                    e.TextFont.Dispose();
                }
            }
        }
Пример #50
0
 public void DrawHeaderText(string text, System.Drawing.Brush brush, Rectangle rect)
 {
     base.PlatformGraphics.DrawString(text, scaledHeaderFont, brush, rect, this.headerSf);
 }
Пример #51
0
 public MarqueeCanvas(Point location, Size size, Point padding, string content, System.Drawing.Font font, System.Drawing.Brush brush, int scrolldelay, Direction direction)
     : base(location, size, padding, content, font, brush)
 {
     this.ScrollDelay = scrolldelay;
     this.Direction   = direction;
     this.LastPoint   = new Point(location.X + padding.X, location.Y + padding.Y);
 }
Пример #52
0
 public TimeCanvas(Point location, Size size, Point padding, string content, System.Drawing.Font font, System.Drawing.Brush brush, string formate) : base(location, size, padding, content, font, brush)
 {
     if (!string.IsNullOrEmpty(formate))
     {
         this.Formate = formate;
     }
 }
Пример #53
0
        private static void AddLineString(drawing.Graphics graphics, SqlGeometry lineString, Func <Point, Point> transform, drawing.Pen pen, drawing.Brush brush)
        {
            int numberOfPoints = lineString.STNumPoints().Value;

            drawing.PointF[] points = new drawing.PointF[numberOfPoints];

            //STPointN(index): index is between 1 and number of points
            for (int i = 0; i < numberOfPoints; i++)
            {
                var parsedPoint = transform(lineString.STPointN(i + 1).AsWpfPoint());

                points[i] = new drawing.PointF((float)parsedPoint.X, (float)parsedPoint.Y);
            }

            graphics.DrawLines(pen, points);
        }
Пример #54
0
        public static M.Brush DrawingBrushToMediaBrush(D.Brush in_brush)
        {
            if (in_brush is D.SolidBrush)
            {
                M.SolidColorBrush brush = new M.SolidColorBrush(
                    ColorUtils.DrawingColorToMediaColor((in_brush as D.SolidBrush).Color)
                    );

                return(brush);
            }
            else if (in_brush is D.Drawing2D.LinearGradientBrush)
            {
                D.Drawing2D.LinearGradientBrush lgb = (in_brush as D.Drawing2D.LinearGradientBrush);

                System.Windows.Point starting_point = new System.Windows.Point(
                    lgb.Rectangle.X,
                    lgb.Rectangle.Y
                    );

                System.Windows.Point ending_point = new System.Windows.Point(
                    lgb.Rectangle.Right,
                    lgb.Rectangle.Bottom
                    );

                M.GradientStopCollection collection = new M.GradientStopCollection();

                try
                {
                    if (lgb.InterpolationColors != null && lgb.InterpolationColors.Colors.Length == lgb.InterpolationColors.Positions.Length)
                    {
                        for (int x = 0; x < lgb.InterpolationColors.Colors.Length; x++)
                        {
                            collection.Add(
                                new M.GradientStop(
                                    ColorUtils.DrawingColorToMediaColor(lgb.InterpolationColors.Colors[x]),
                                    lgb.InterpolationColors.Positions[x]
                                    )
                                );
                        }
                    }
                }
                catch (Exception exc)
                {
                    for (int x = 0; x < lgb.LinearColors.Length; x++)
                    {
                        collection.Add(
                            new M.GradientStop(
                                ColorUtils.DrawingColorToMediaColor(lgb.LinearColors[x]),
                                x / (double)(lgb.LinearColors.Length - 1)
                                )
                            );
                    }
                }

                M.LinearGradientBrush brush = new M.LinearGradientBrush(
                    collection,
                    starting_point,
                    ending_point
                    );

                return(brush);
            }
            else if (in_brush is D.Drawing2D.PathGradientBrush)
            {
                D.Drawing2D.PathGradientBrush pgb = (in_brush as D.Drawing2D.PathGradientBrush);

                System.Windows.Point starting_point = new System.Windows.Point(
                    pgb.CenterPoint.X,
                    pgb.CenterPoint.Y
                    );

                M.GradientStopCollection collection = new M.GradientStopCollection();

                if (pgb.InterpolationColors != null && pgb.InterpolationColors.Colors.Length == pgb.InterpolationColors.Positions.Length)
                {
                    for (int x = 0; x < pgb.InterpolationColors.Colors.Length; x++)
                    {
                        collection.Add(
                            new M.GradientStop(
                                ColorUtils.DrawingColorToMediaColor(pgb.InterpolationColors.Colors[x]),
                                pgb.InterpolationColors.Positions[x]
                                )
                            );
                    }
                }

                M.RadialGradientBrush brush = new M.RadialGradientBrush(
                    collection
                    );

                brush.Center = starting_point;

                return(brush);
            }
            else
            {
                return(new M.SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 255, 0, 0))); //Return error color
            }
        }
Пример #55
0
        private static Bitmap AddFillRectangle(Bitmap bitmap, System.Drawing.Point position, System.Drawing.Size size, System.Drawing.Brush brush)
        {
            using (Graphics grf = Graphics.FromImage(bitmap))
            {
                Rectangle rect = new Rectangle(position, size);
                grf.FillRectangle(brush, rect);
            }

            return(bitmap);
        }
Пример #56
0
 public override void OnRenderNormalView(System.Drawing.Graphics g, Model.DataModel data, System.Drawing.Pen linePen, System.Drawing.Brush lineBrush, System.Drawing.Brush TextBrush, System.Drawing.Brush DataBrush, System.Drawing.Font TextFont, System.Drawing.Font DataFont)
 {
 }
Пример #57
0
        private static void AddMultiPoint(drawing.Graphics graphics, SqlGeometry multiPoint, Func <Point, Point> transform, drawing.Pen pen, drawing.Brush brush, double pointSize, SimplePointSymbol pointSymbol)//, ImageSource pointSymbol, Geometry symbol)
        {
            int numberOfPoints = multiPoint.STNumGeometries().Value;

            for (int i = 0; i < numberOfPoints; i++)
            {
                var point = multiPoint.STGeometryN(i + 1);

                if (point.IsNotValidOrEmpty())
                {
                    continue;
                }

                AddPoint(graphics, point, transform, pen, brush, pointSize, pointSymbol);
            }
        }
Пример #58
0
 public override void AnimalionDraw(System.Drawing.Graphics g, DetailDataModel data, System.Drawing.Pen pen, System.Drawing.Brush brush, System.Drawing.Font font, object[] args)
 {
     try
     {
         if (!IsMouseIn)
         {
             RollStartX = RollStartX - _Interpolation.Value;
         }
         if (textSizef != null && RollStartX + textSizef.Width < 0)
         {
             RollStartX = EViewWidth;
         }
         if (textSizef != null)
         {
             g.DrawString(rollText, font, brush, RollStartX, (EViewHeight - textSizef.Height) / 2);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine("{0} Second exception.", e.Message);
     }
     //ReportViewUtils.drawString(graphics, LocationModel.Location_Right_Right, "你好, 大幅度发发酵哦大家爱哦大范甘迪 大哥家的感觉爱逛街肉购入价格个人机构", font, brush, -Index, EStartY, EViewWidth, EViewHeight);
 }
Пример #59
0
        public override void childPaint(System.Drawing.Graphics g, Model.DataModel Data, System.Drawing.Pen linePen, System.Drawing.Brush lineBrush, System.Drawing.Brush TextBrush, System.Drawing.Brush DataBrush, System.Drawing.Font FontText, System.Drawing.Font FontData)
        {
            //绘制Pie自定义标题
            if (IsDrawPieTiTle)
            {
                Brush pieTitleBrush = new SolidBrush(pieTitleColor);
                ReportViewUtils.drawString(g, LocationModel.Location_Right_Right, pieTitle, pieTitleFont, pieTitleBrush, 0, 3, this.Width, padding);

                pieTitleBrush.Dispose();
            }

            int length = this.Height > this.Width ? (this.Width / 2) : (this.Height / 2);
            int startX = (this.Width - length) / 2;
            int startY = (this.Height - length) / 2;

            if (Data is DetailDataModel)
            {
                DetailDataModel data  = (DetailDataModel)Data;
                string[]        datas = data.TextAndData;
                linePen = new Pen(Color.FromArgb(180, 71, 85, 182), 60);
                //7/12的效果最好看
                piePenWidth = 7 * length / 12;
                Rectangle rectangle = new Rectangle(startX, startY, length, length);

                IsFirst    = true;
                sweepAngle = 0;
                float startAngle = 360;
                for (int i = 0; i < datas.Length / 2; i++)
                {
                    string str       = datas[2 * i + 1];
                    float  realAngle = 360 * int.Parse(str) * 1.0f / allNum;

                    linePen.Width = piePenWidth * int.Parse(str) / maxNum;
                    int realX      = startX + (int)(piePenWidth - linePen.Width + 0.5f) / 2;
                    int realY      = startY + (int)(piePenWidth - linePen.Width + 0.5f) / 2;
                    int realLength = length - (int)(piePenWidth - linePen.Width);

                    rectangle     = new Rectangle(realX, realY, realLength, realLength);
                    linePen.Color = ReportViewUtils.PerferColors[i % ReportViewUtils.PerferColors.Length];
                    startAngle   -= (realAngle - 0.5f);
                    g.DrawArc(linePen, rectangle, startAngle, realAngle + 0.7f);

                    if (IsDrawLineNote)
                    {
                        DrawLineNote(g, linePen.Color, data, 2 * i + 1, startAngle, realAngle, realLength / 2);
                    }
                }
            }

            linePen.Dispose();
            lineBrush.Dispose();
            TextBrush.Dispose();
            DataBrush.Dispose();
            FontText.Dispose();
            FontData.Dispose();
        }
 public override void OnRenderAnimalionedView(System.Drawing.Graphics g, Model.DataModel data, System.Drawing.Pen linePen, System.Drawing.Brush lineBrush, System.Drawing.Brush TextBrush, System.Drawing.Brush DataBrush, System.Drawing.Font FontText, System.Drawing.Font FontData)
 {
 }