protected override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle clipBounds, System.Drawing.Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
        {
            Tuple<int, string> updateInfo = (Tuple<int, string>)value;
            int progressVal = updateInfo.Item1;
            string message = updateInfo.Item2;

            float percentage = ((float)progressVal / 100.0f); // Need to convert to float before division; otherwise C# returns int which is 0 for anything but 100%.
            Brush backColorBrush = new SolidBrush(cellStyle.BackColor);
            Brush foreColorBrush = new SolidBrush(cellStyle.ForeColor);
            // Draws the cell grid
            base.Paint(g, clipBounds, cellBounds,
             rowIndex, cellState, value, formattedValue, errorText,
             cellStyle, advancedBorderStyle, (paintParts & ~DataGridViewPaintParts.ContentForeground));

            
            if (percentage > 0.0)
            {
                // Draw the progress bar and the text
                g.FillRectangle(new SolidBrush(Color.FromArgb(163, 189, 242)), cellBounds.X + 2, cellBounds.Y + 2, Convert.ToInt32((percentage * cellBounds.Width - 4)), cellBounds.Height - 4);
                g.DrawString(message, cellStyle.Font, foreColorBrush, cellBounds.X + 6, cellBounds.Y + 2);
            }
            else
            {
                // draw the text
                if (this.DataGridView.CurrentRow.Index == rowIndex)
                    g.DrawString(message, cellStyle.Font, new SolidBrush(cellStyle.SelectionForeColor), cellBounds.X + 6, cellBounds.Y + 2);
                else
                    g.DrawString(message, cellStyle.Font, foreColorBrush, cellBounds.X + 6, cellBounds.Y + 2);
            }
        }
Example #2
0
        protected override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle clipBounds, System.Drawing.Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
        {
            try
            {
                int progressVal = (int)value;
                float percentage = ((float)progressVal / 100.0f); // Need to convert to float before division; otherwise C# returns int which is 0 for anything but 100%.
                Brush backColorBrush = new SolidBrush(cellStyle.BackColor);
                Brush foreColorBrush = new SolidBrush(cellStyle.ForeColor);
                // Draws the cell grid
                base.Paint(g, clipBounds, cellBounds,
                 rowIndex, cellState, value, formattedValue, errorText,
                 cellStyle, advancedBorderStyle, (paintParts & ~DataGridViewPaintParts.ContentForeground));
                if (percentage > 0.0)
                {
                    // Draw the progress bar and the text
                    g.FillRectangle(new SolidBrush(Color.FromArgb(203, 235, 108)), cellBounds.X + 2, cellBounds.Y + 2, Convert.ToInt32((percentage * cellBounds.Width - 4)), cellBounds.Height - 4);
                    g.DrawString(progressVal.ToString() + "%", cellStyle.Font, foreColorBrush, cellBounds.X + (cellBounds.Width / 2) - 5, cellBounds.Y + 2);

                }
                else
                {
                    g.DrawString("Ожидание...", cellStyle.Font, foreColorBrush, cellBounds.X + (cellBounds.Width / 2) - 25, cellBounds.Y + 2);
                }
            }
            catch (Exception e) { }
        }
Example #3
0
        /// <summary>
        /// 绘制方法
        /// </summary>
        /// <param name="g"></param>
        /// <param name="center"></param>
        /// <param name="zoom"></param>
        /// <param name="screen_size"></param>
        public override void Draw(System.Drawing.Graphics g, LatLngPoint center, int zoom, System.Drawing.Size screen_size)
        {
            if (Points != null && Points.Count >= 2)
            {
                g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                List<Point> l = new List<Point>();
                foreach (LatLngPoint p in Points)
                {
                    l.Add(MapHelper.GetScreenLocationByLatLng(p, center, zoom, screen_size));  //屏幕坐标
                }
                
                double total = 0; double step = 0;
                using (Pen pen = new Pen(Color.FromArgb(150, Color.OrangeRed), 4))
                {
                    for (int i = 0; i < l.Count - 1; ++i)
                    {
                        g.DrawLine(pen, l[i], l[i + 1]);
                        g.FillEllipse(Brushes.White, new Rectangle(new Point(l[i].X - 4, l[i].Y - 4), new Size(8, 8)));
                        g.DrawEllipse(Pens.OrangeRed, new Rectangle(new Point(l[i].X - 4, l[i].Y - 4), new Size(8, 8)));

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

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

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

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

                            if (i == l.Count - 2)  //终点
                            {
                                step = MapHelper.GetDistanceByLatLng(Points[i], Points[i + 1]);
                                total += step;
                                g.FillRectangle(Brushes.White, new Rectangle(l[i + 1].X + 3, l[i + 1].Y, 100, 20));
                                g.DrawRectangle(Pens.DarkGray, new Rectangle(l[i + 1].X + 3, l[i + 1].Y, 100, 20));
                                g.DrawString("总长:" + Math.Round(total, 2) + "公里", new Font("微软雅黑", 9), Brushes.OrangeRed, new PointF(l[i + 1].X + 10, l[i + 1].Y + 2));
                            }
                        }
                    }
                }
            }
        }
 public override void DrawRegionRepresentation(System.Drawing.Graphics gc, Render.RenderParameter r, Render.IDrawVisitor drawMethods, PointD mousePosition)
 {
     if (m_Param.Path != null)
     {
         if (m_Param.Path.IsVisible((Point)mousePosition))
         {
             gc.DrawString("+ speed", r.FontType, new SolidBrush(r.RegionGuides.Color), new PointF((float)mousePosition.X, (float)mousePosition.Y - 15));
         }
     }
     else
     {
         gc.DrawString("+ speed", r.FontType, new SolidBrush(r.RegionGuides.Color), new PointF((float)mousePosition.X, (float)mousePosition.Y - 15));
     }
 }
Example #5
0
        // -------------------------------------------------        Draw
        public override void Draw(System.Drawing.Graphics grfx)
        {
            Size sizeDelete = Auxi_Geometry.RoundMeasureString(Funclet.FormParent, DELETE_STRING, Funclet.FormParent.Font);
            Size sizeType = Auxi_Geometry.RoundMeasureString(Funclet.FormParent, STR_STRING, Funclet.FormParent.Font);
            Size sizeFunct = Auxi_Geometry.RoundMeasureString(Funclet.FormParent, strs[0], Funclet.FormParent.Font);

            grfx.FillRectangle(brushStandard, area);
            int dy = area.Height/strs.Count;
            int cxL = area.Left + wLeftSpace;
            int cy;
            if (iHighlighted >= 0)
            {
                cy = area.Top + dy*iHighlighted;
                grfx.FillRectangle(brushHighlight,
                                   Rectangle.FromLTRB(area.Left, cy, area.Right, cy + area.Height / strs.Count));
            }
            int cxR_line = area.Right - wLeftSpace;

            grfx.DrawString(strs[0], Funclet.FormParent.Font, brushLeaves, new Point(area.Left + ((area.Width - sizeType.Width - sizeFunct.Width) / 2), area.Top));
            grfx.DrawString(STR_STRING,Funclet.FormParent.Font, brushModify, new Point(area.Right - sizeType.Width, area.Top));
            grfx.DrawRectangle(penBorder, new Rectangle(new Point(area.Right - sizeType.Width, area.Top), sizeType ));

            for (int i = 1; i < strs.Count; i++)
            {
                if (iRightConnections[i] == -1)
                {
                    grfx.DrawString(strs[i], Funclet.FormParent.Font, brushLeaves, new Point(cxL, area.Top + i * dy));
                }
                else
                {
                    grfx.DrawString(strs[i], Funclet.FormParent.Font, brushTexts, new Point(cxL, area.Top + i * dy));
                }

                if (strs.Count >= 3)
                {
                    grfx.DrawString(ADD_STRING, Funclet.FormParent.Font, brushModify, new Point(area.Left + 1, area.Top + i * dy));
                }

                if (strs.Count > 3)
                {
                    grfx.DrawString(DELETE_STRING, Funclet.FormParent.Font, brushModify, new Point(area.Right - sizeDelete.Width, area.Top + i * dy));
                }

                cy = area.Top + i*dy;
                grfx.DrawLine(penSeparator, area.Left, cy, area.Right, cy);
            }
            grfx.DrawRectangle(penBorder, area);
        }
Example #6
0
 public override void Draw(System.Drawing.Graphics g)
 {
     g.DrawString(this.Texto, this.Police, this.Brush, this.Centre);
     g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
     g.PixelOffsetMode = PixelOffsetMode.HighQuality;
     g.CompositingQuality = CompositingQuality.HighQuality;
 }
        public void Draw(System.Drawing.Graphics graphics, System.Drawing.Rectangle destRect, System.Drawing.Rectangle sourceRect)
        {
            if (IsOpened)
            {
                using (Brush b= new SolidBrush(Color.Red))
                {

                    graphics.FillPolygon(b, new Point[]{
                        new Point(destRect.Left + (destRect.Width/2)+ClientSettings.Margin, destRect.Bottom-(ClientSettings.Margin*4)),
                        new Point(destRect.Left + (destRect.Width/2), destRect.Bottom),
                        new Point(destRect.Left + (destRect.Width/2)-ClientSettings.Margin, destRect.Bottom-(ClientSettings.Margin*4)),
                    });
                    using (Image userbmp = ThrottledArtGrabber.GetArt(this.userToDraw.profile_image_url))
                    {
                        graphics.DrawImage(userbmp, destRect.X, destRect.Y);
                    }
                }
            }
            else
            {
                TiledMaps.IGraphicsDrawable graphicsDrawable = ThrottledArtGrabber.mapMarkerImage as TiledMaps.IGraphicsDrawable;
                graphicsDrawable.Draw(graphics, destRect, sourceRect);
                Rectangle CharRect = new Rectangle(destRect.X + 7, destRect.Y+2, destRect.Width - 6, destRect.Height-2);
                if (charToUse >= 0)
                {
                    using (Font f = new Font(FontFamily.GenericSansSerif, fSize, FontStyle.Regular))
                    {
                        graphics.DrawString(charToUse.ToString(), f, B, CharRect);
                    }
                }
            }
            Location = destRect;
        }
Example #8
0
 public override void Draw(System.Drawing.Graphics g) {
     if (Bounds.IsEmpty) return;
     GPoint p1 = map.FromLatLngToLocal(Bounds.LocationTopLeft);
     GPoint p2 = map.FromLatLngToLocal(Bounds.LocationRightBottom);
     Font font = new Font(FontFamily.GenericSansSerif, 30, FontStyle.Bold);
     SizeF fs = g.MeasureString(Title, font);
     int x1 = p1.X;
     int y1 = p1.Y;
     int x2 = p2.X;
     int y2 = p2.Y;
     Rectangle r1 = new Rectangle(x1, y1 - (int)fs.Height, x2 - x1, y2 - y1 + (int)fs.Height);
     if (sbTable != null) {
         tableHeight = (int)(map.Font.GetHeight(g) * (sbTable.Rows.Count + 1));
         tableWidth = 60 * 3;
         tableRect = new Rectangle(r1.Right, r1.Top + (int)fs.Height, tableWidth, tableHeight);
         r1.Width += tableWidth;
         r1.Height = (int)Math.Max(r1.Height, 2 * fs.Height + tableHeight);
         tableRect.Y = r1.Bottom - tableRect.Height - 1;
     }
     Rectangle r2 = r1;
     r2.Inflate(5, 5);
     Point p3 = new Point(r1.Left + (r1.Width - (int)fs.Width) / 2, r1.Top + 5);
     g.DrawString(Title, font, Brushes.Black, p3);
     g.DrawRectangle(penin, r1);
     g.DrawRectangle(penout, r2);
     
     //drawsbtjInfo(g, tableRect.Location);
 }
        protected override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle clipBounds, System.Drawing.Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
        {
            try
            {
                int progressVal = (int)value;
                if(progressVal < 0) progressVal = 0;
                if(progressVal > 100) progressVal = 100;
                float percentage = ((float)progressVal / 100.0f);

                Brush backColorBrush = new SolidBrush(cellStyle.BackColor);
                Brush foreColorBrush = new SolidBrush(cellStyle.ForeColor);
                Brush barColorBrush = new SolidBrush(GetColorBetween(cellStyle.BackColor,
                    cellStyle.ForeColor, progressVal == 100 ? 0.2f : 0.3f));

                base.Paint(g, clipBounds, cellBounds,
                    rowIndex, cellState, value, formattedValue, errorText,
                    cellStyle, advancedBorderStyle, (paintParts & ~DataGridViewPaintParts.ContentForeground));

                var s = progressVal.ToString() + "%";
                var sz = g.MeasureString(s, cellStyle.Font);
                int dy = (cellBounds.Height - this.DataGridView.RowTemplate.Height) / 2;

                g.FillRectangle(barColorBrush, cellBounds.X + 2, cellBounds.Y + 2, Convert.ToInt32((percentage * cellBounds.Width - 4)), cellBounds.Height - 4);
                g.DrawString(s, cellStyle.Font, foreColorBrush, cellBounds.X + (cellBounds.Width / 2) - sz.Width / 2 - 5, cellBounds.Y + 2 + dy);
            }
            catch (Exception e) { }
        }
        protected override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle clipBounds, System.Drawing.Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
        {
            try
            {
                string text = value == null ? "" : (string)value;
                Brush backColorBrush = new SolidBrush(cellStyle.BackColor);
                Brush foreColorBrush = new SolidBrush(cellStyle.ForeColor);
                var col = this.OwningColumn as DataGridViewColorMarkColumn;
                Color markcolor = cellStyle.ForeColor;
                bool hasmark = col.GetColorMark(rowIndex, out markcolor);
                Brush markColorBrush = new SolidBrush(markcolor);

                base.Paint(g, clipBounds, cellBounds,
                    rowIndex, cellState, value, formattedValue, errorText,
                    cellStyle, advancedBorderStyle, (paintParts & ~DataGridViewPaintParts.ContentForeground));

                int rsz = this.DataGridView.RowTemplate.Height - 8;
                int dy = (cellBounds.Height - this.DataGridView.RowTemplate.Height) / 2;

                g.FillEllipse(markColorBrush, cellBounds.X + 2, cellBounds.Y + 4 + dy, rsz, rsz);
                //g.FillRectangle(markColorBrush, cellBounds.X + 2, cellBounds.Y + 4, rsz, rsz);
                g.DrawString(text, cellStyle.Font, foreColorBrush, cellBounds.X + 4 + rsz, cellBounds.Y + 2 + dy);
            }
            catch (Exception e) { }
        }
Example #11
0
	public void  paint(System.Drawing.Graphics g, System.Windows.Forms.Control c)
	{
		//UPGRADE_TODO: The equivalent in .NET for method 'java.awt.Graphics.getFont' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
		System.Drawing.Font font = SupportClass.GraphicsManager.manager.GetFont(g);
		System.Drawing.Font metrics = SupportClass.GraphicsManager.manager.GetFont(g);
		//UPGRADE_TODO: Class 'java.awt.font.FontRenderContext' was converted to 'System.Windows.Forms.Control' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
		//UPGRADE_ISSUE: Constructor 'java.awt.font.FontRenderContext.FontRenderContext' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaawtfontFontRenderContextFontRenderContext_javaawtgeomAffineTransform_boolean_boolean'"
           System.Drawing.Text.TextRenderingHint frc = TextRenderingHint.AntiAlias; //  new FontRenderContext(null, false, false);
		System.Drawing.Size size = c.Size;
		SupportClass.GraphicsManager.manager.SetColor(g, c.BackColor);
		g.FillRectangle(SupportClass.GraphicsManager.manager.GetPaint(g), 0, 0, size.Width, size.Height);
		SupportClass.GraphicsManager.manager.SetColor(g, c.ForeColor);
		g.DrawRectangle(SupportClass.GraphicsManager.manager.GetPen(g), 0, 0, size.Width - 1, size.Height - 1);
		if (strs != null)
		{
			int y = 0;
			for (int i = 0; i < strs.Length; i++)
			{
				// TODO: use render hint? frc
				y += (int) g.MeasureString(strs[i], font).Height + 2;
				//UPGRADE_TODO: Method 'java.awt.Graphics.drawString' was converted to 'System.Drawing.Graphics.DrawString' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtGraphicsdrawString_javalangString_int_int'"
				g.DrawString(strs[i], SupportClass.GraphicsManager.manager.GetFont(g), SupportClass.GraphicsManager.manager.GetBrush(g), 3, y - SupportClass.GraphicsManager.manager.GetFont(g).GetHeight());
				//g.drawString(strs[i],3,(metrics.getHeight())*(i+1));
			}
		}
	}
        public void Render(System.Drawing.Graphics g, System.Drawing.Rectangle bounds)
        {
            try
            {
                g.Clip = new Region(bounds);
          
                Rectangle textBounds;
                textBounds = new Rectangle(bounds.X + ClientSettings.Margin, bounds.Y, bounds.Width - (ClientSettings.Margin * 2), bounds.Height);

                DisplayItemDrawingHelper.DrawItemBackground(g, bounds, Selected);

                string itemText = PockeTwit.Localization.XmlBasedResourceManager.GetString("more");

                SizeF textSize = g.MeasureString(itemText, ClientSettings.MenuFont);
                Point startPoint = new Point((int)(bounds.Left + (bounds.Width - textSize.Width) / 2),(int)(bounds.Top + (bounds.Height - textSize.Height) / 2));
                
                Color drawColor = ClientSettings.MenuTextColor;
                using (Brush drawBrush = new SolidBrush(drawColor))
                {
                    g.DrawString(itemText, ClientSettings.MenuFont, drawBrush, startPoint.X, startPoint.Y);
                }
            }
            catch (ObjectDisposedException)
            {
            }
        }
Example #13
0
        public override System.Drawing.Size Draw(System.Drawing.Graphics graphics, int x, int y, int width, int height, Brush brush, Pen pen, Font font, Font mini_font, bool setRect = true)
        {
            SizeF size = graphics.MeasureString(ToString(), font);

            if (invert)
                graphics.DrawString("x", font, Brushes.Red, x, y);

            graphics.DrawString(ToString(), font, brush, x + ((invert)?15:0), y);

            if (setRect)
                SetRect(x, y, width, (int)size.Height + 6);

            if (selected)
                graphics.DrawLine(pen, x, y, x, y + size.Height);

            return new Size(width, (int)size.Height + 6);
        }
Example #14
0
        /// <summary>
        /// any custom drawing here
        /// </summary>
        /// <param name="drawingContext"></param>
        protected override void OnPaintOverlays(System.Drawing.Graphics g)
        {
            base.OnPaintOverlays(g);

            #if DEBUG
             g.DrawString("render: " + counter++ + ", load: " + ElapsedMilliseconds + "ms", DebugFont, Brushes.Blue, 36, 36);
            #endif
        }
Example #15
0
        protected override void OnTextPaint(System.Drawing.Graphics g, Rectangle rect) {
            //base.OnTextPaint(g);
            int iWidth = rect.Width;
            float fLeft = rect.Left;
            float fWidth = base.FontManager.GetWordWidth('●');
            for (int i = 0; i < base.Text.Length; i++) {
                if (fLeft + fWidth - base.HScroll >= 0 && fLeft - base.HScroll <= iWidth) {
                    if ((i >= base.SelectStart && i < base.SelectEnd) || (i >= base.SelectEnd && i < base.SelectStart)) {
                        g.DrawString("●", base.Font, new SolidBrush(Color.White), (int)fLeft - base.HScroll, rect.Top);
                    } else {
                        g.DrawString("●", base.Font, new SolidBrush(base.ForeColor), (int)fLeft - base.HScroll, rect.Top);
                    }

                }
                fLeft += fWidth;
            }
        }
        public override void drawnShap(System.Drawing.Graphics pe)
        {

            // Tạo font và bút vẽ
            Font drawFont = new Font(State.TextFont, State.TextSize);
            SolidBrush drawBrush = new SolidBrush(State.CurrentColor);
            pe.DrawString(State.Text, drawFont, drawBrush, State.TextLocation);

        }
        protected override void Paint(System.Drawing.Graphics graphics, System.Drawing.Rectangle clipBounds, System.Drawing.Rectangle cellBounds, int rowIndex, DataGridViewElementStates elementState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
        {
            if (value == null) {
                base.Paint(graphics, clipBounds, cellBounds, rowIndex, elementState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts);
                return;
            }

            PossibleMatch match = (PossibleMatch)value;

            // draw the native combo first, we are just painting on top of it, not redrawing from scratch
            base.Paint(graphics, clipBounds, cellBounds, rowIndex, elementState, value, match.Movie.Title, errorText, cellStyle, advancedBorderStyle, paintParts);

            string yearText = "(" + match.Movie.Year + ")";
            string altTitleText = "as " + match.Result.AlternateTitle;
            string providerName = match.Movie.PrimarySource == null ? string.Empty : match.Movie.PrimarySource.Provider.Name;

            // figure basic positioning
            SizeF providerSize = graphics.MeasureString(providerName, DataGridView.Font);
            SizeF titleSize = graphics.MeasureString(match.Movie.Title, DataGridView.Font);
            SizeF yearSize = graphics.MeasureString(yearText, DataGridView.Font);

            int providerPosition = (int)(cellBounds.X + cellBounds.Width - providerSize.Width - 25);
            int yearPosition = (int)(cellBounds.X + titleSize.Width);
            int altTitlePosition = (int)(cellBounds.X + titleSize.Width + yearSize.Width);

            // draw year
            RectangleF yearRect = new RectangleF(cellBounds.X + titleSize.Width, cellBounds.Y + 4, cellBounds.Width - providerSize.Width - 25, cellBounds.Height);
            graphics.DrawString(yearText, DataGridView.Font, SystemBrushes.ControlDark, yearRect);

            // draw alternate title if needed
            if (match.Result.AlternateTitleUsed()) {
                graphics.DrawString(altTitleText, DataGridView.Font, SystemBrushes.ControlDark, altTitlePosition, cellBounds.Y + 4);
            }

            // draw data provider if needed
            if (!string.IsNullOrEmpty(providerName)) {
                bool uncertainMatch = match.Result.TitleScore > 0 || match.Result.YearScore > 0;
                if (MovingPicturesCore.Settings.AlwaysDisplayProviderTags || !match.Result.FromTopSource || (uncertainMatch && match.HasMultipleSources)) {
                    graphics.FillRectangle(SystemBrushes.ControlLight, providerPosition + 1, cellBounds.Y + 4, providerSize.Width + 1, cellBounds.Height - 10);
                    graphics.DrawString(providerName, DataGridView.Font, SystemBrushes.ControlDark, providerPosition + 1, cellBounds.Y + 4);
                }
            }
        }
        public override void DibujarElemento(System.Drawing.Graphics grafico)
        {
            Pen p = new Pen(Color, 2);
            p.StartCap = LineCap.Triangle;
            int mitadX = _puerto.DimensionMundo.Centro.X;
            int mitadY = _puerto.DimensionMundo.Centro.Y;
            grafico.DrawLine(p, mitadX, mitadY, mitadX + 30, mitadY - 30);
            grafico.FillEllipse(new SolidBrush(Color), mitadX + 20, mitadY - 30, 10, 10);
            grafico.DrawString(Nombre, new Font("Arial", 8, FontStyle.Regular), Brushes.White, new PointF(mitadX + 30, mitadY - 30));

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

        }
        /// <summary>
        /// Paints the entity using the given graphics object
        /// </summary>
        /// <param name="g"></param>
        public override void Paint(System.Drawing.Graphics g)
        {
            if (!Visible) return;
            //the text
            if (!string.IsNullOrEmpty(Text))
            {
                //g.DrawRectangle(Pens.Orange, Rectangle);

                g.DrawString(Text, ArtPallet.DefaultFont, Brushes.Black, Rectangle, stringFormat);
            }
        }
Example #21
0
 public void Draw(System.Drawing.Graphics vrpContext)
 {
     int namevalue;
     int x;
     FontFamily fontFamily = new FontFamily("Arial");
     vrpContext.FillRectangle(new SolidBrush(ColorProp),
       Rectangle);
     namevalue = Name.Length * 4;
     x = (Rectangle.X + (Rectangle.Width) / 2) - namevalue;
     vrpContext.DrawString(this.Name,new Font(fontFamily,16,FontStyle.Regular,GraphicsUnit.Pixel),new SolidBrush(Color.Black),new PointF(x,Rectangle.Y +( Rectangle.Height)/2));
 }
Example #22
0
        /// <summary>
        /// any custom drawing here
        /// </summary>
        /// <param name="drawingContext"></param>
        protected override void OnPaintOverlays(System.Drawing.Graphics g) {
            base.OnPaintOverlays(g);

#if DEBUG
            //g.DrawString(string.Format("lat:{0},lon:{1}", this.Position.Lat, this.Position.Lng), DebugFont, Brushes.Red, 36, 36);
            //g.DrawString("render: " + counter++ + ", load: " + ElapsedMilliseconds + "ms", DebugFont, Brushes.Blue, 36, 36);
            g.DrawString(debugMsg, DebugFont, Brushes.Blue, 36, 36);
#endif
            
            if (Drawing != null)
                Drawing.Draw(g);
        }
Example #23
0
        protected override void OnDraw(System.Drawing.Graphics graphics, System.Drawing.Color backgroundColor)
        {
            System.Drawing.SizeF size = graphics.MeasureString(lastFlow.ToString(),labelFont);
            graphics.FillRectangle(new System.Drawing.SolidBrush(backgroundColor), this.Location.X, this.Location.Y, size.Width, size.Height);
            lastFlow = Flow;

            base.OnDraw(graphics, backgroundColor);

            size = graphics.MeasureString(lastFlow.ToString(), labelFont);
            graphics.FillRectangle(new System.Drawing.SolidBrush(backgroundColor), this.Location.X, this.Location.Y, size.Width, size.Height);
            graphics.DrawRectangle(System.Drawing.Pens.Black, this.Location.X, this.Location.Y, size.Width, size.Height);
            graphics.DrawString(this.Flow.ToString(), labelFont, System.Drawing.Brushes.Black, this.Location);
        }
Example #24
0
        public override System.Drawing.Size Draw(System.Drawing.Graphics graphics, int x, int y, int width, int height, System.Drawing.Brush brush, System.Drawing.Pen pen, System.Drawing.Font font, bool setRect = true)
        {
            SizeF size = graphics.MeasureString(ToString(), font);
            graphics.DrawString(ToString(), font, brush, x, y);

            if (setRect)
                SetRect(x, y, width, (int)size.Height + 6);

            if (selected)
                graphics.DrawLine(pen, x, y, x, y + size.Height);

            return new Size(width, (int)size.Height + 6);
        }
Example #25
0
        /// <summary>
        /// 绘制方法
        /// </summary>
        /// <param name="g"></param>
        /// <param name="center"></param>
        /// <param name="zoom"></param>
        /// <param name="screen_size"></param>
        public override void Draw(System.Drawing.Graphics g, LatLngPoint center, int zoom, System.Drawing.Size screen_size)
        {
            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            Point theScreenLeftTop = MapHelper.GetScreenLocationByLatLng(LeftTop, center, zoom, screen_size);  //矩形左上角屏幕坐标
            Point theScreenRightBottom = MapHelper.GetScreenLocationByLatLng(RightBottom, center, zoom, screen_size);  //矩形右下角屏幕坐标

            int width = Math.Abs(theScreenRightBottom.X - theScreenLeftTop.X);
            int height = Math.Abs(theScreenRightBottom.Y - theScreenLeftTop.Y);
            Rectangle r = new Rectangle(Math.Min(theScreenLeftTop.X, theScreenRightBottom.X), Math.Min(theScreenLeftTop.Y, theScreenRightBottom.Y), width, height);
            if (new Rectangle(new Point(0, 0), screen_size).IntersectsWith(r))
            {
                using (SolidBrush sb = new SolidBrush(Color.FromArgb(15, Color.DarkBlue)))
                {
                    g.FillRectangle(sb, r);
                }
                using (Pen pen = new Pen(Color.FromArgb(150,Color.DarkBlue), 2))
                {
                    g.DrawRectangle(pen, r);
                }
            }

            double d1 = MapHelper.GetDistanceByLatLng(LeftTop, new LatLngPoint(LeftTop.Lng, RightBottom.Lat));
            double d2 = MapHelper.GetDistanceByLatLng(LeftTop, new LatLngPoint(RightBottom.Lng, LeftTop.Lat));
            double d3 = MapHelper.GetDistanceByLatLng(new LatLngPoint(LeftTop.Lng, RightBottom.Lat), RightBottom);
            double d4 = MapHelper.GetDistanceByLatLng(new LatLngPoint(RightBottom.Lng, LeftTop.Lat), RightBottom);

            using (Font f = new Font("微软雅黑", 9))
            {
                g.FillRectangle(Brushes.DarkBlue, new Rectangle(theScreenLeftTop.X, (theScreenLeftTop.Y + theScreenRightBottom.Y) / 2 - 10, 60, 20));
                g.DrawString(Math.Round(d1, 2).ToString() + "km", f, Brushes.White, new PointF(theScreenLeftTop.X + 5, (theScreenLeftTop.Y + theScreenRightBottom.Y) / 2 - 8));
                g.FillRectangle(Brushes.DarkBlue, new Rectangle((theScreenLeftTop.X + theScreenRightBottom.X) / 2 - 30, theScreenLeftTop.Y, 60, 20));
                g.DrawString(Math.Round(d2, 2).ToString() + "km", f, Brushes.White, new PointF((theScreenLeftTop.X + theScreenRightBottom.X) / 2 - 30 + 5, theScreenLeftTop.Y + 2));
                g.FillRectangle(Brushes.DarkBlue, new Rectangle((theScreenLeftTop.X + theScreenRightBottom.X) / 2 - 30, theScreenRightBottom.Y - 20, 60, 20));
                g.DrawString(Math.Round(d3, 2).ToString() + "km", f, Brushes.White, new PointF((theScreenLeftTop.X + theScreenRightBottom.X) / 2 - 30 + 5, theScreenRightBottom.Y + 4 - 20));
                g.FillRectangle(Brushes.DarkBlue, new Rectangle(theScreenRightBottom.X - 60, (theScreenLeftTop.Y + theScreenRightBottom.Y) / 2 - 10, 60, 20));
                g.DrawString(Math.Round(d4, 2).ToString() + "km", f, Brushes.White, new PointF(theScreenRightBottom.X - 60 + 3, (theScreenLeftTop.Y + theScreenRightBottom.Y) / 2 - 10));
            }
        }
Example #26
0
        /// <summary>
        /// Paints the bundle on the canvas
        /// </summary>
        /// <param name="g">a Graphics object onto which to paint</param>
        public override void Paint(System.Drawing.Graphics g)
        {
            if (g == null)
                throw new ArgumentNullException("The Graphics object is 'null'.");

            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;

            //the edge
            if (Hovered || IsSelected)
                g.DrawRectangle(new Pen(Color.Red, 2F), Rectangle);
            //the text
            if (!string.IsNullOrEmpty(Text))
                g.DrawString(Text, ArtPallet.DefaultFont, Brushes.Black, Rectangle);
        }
Example #27
0
        /// <summary>
        /// Paints the shape on the canvas
        /// </summary>
        /// <param name="g"></param>
        public override void Paint(System.Drawing.Graphics g)
        {
            g.FillRectangle(shapeBrush,rectangle);
            if(hovered || isSelected)
                g.DrawRectangle(new Pen(Color.Red,2F),rectangle);

            //well, a lot should be said here like
            //the fact that one should measure the text before drawing it,
            //resize the width and height if the text if bigger than the rectangle,
            //alignment can be set and changes the drawing as well...
            //here we keep it really simple:
            if(text !=string.Empty)
                g.DrawString(text,font,Brushes.Black, rectangle.X+10,rectangle.Y+10);
        }
Example #28
0
        public override void DrawHourLabel(System.Drawing.Graphics g, System.Drawing.Rectangle rect, int hour)
        {
            Color color = Color.FromArgb(101, 147, 207);

            using (Pen pen = new Pen(color))
                g.DrawLine(pen, rect.Left, rect.Y, rect.Width, rect.Y);

            using (SolidBrush brush = new SolidBrush(color))
            {
                g.DrawString(hour.ToString("##00"), HourFont, brush, rect);

                rect.X += 27;

                g.DrawString("00", MinuteFont, brush, rect);
            }
        }
        public void Draw(System.Drawing.Graphics graphics, System.Drawing.Rectangle bounds)
        {
            float length = (float)this.manager.Progress / 100.0f;

			using (LinearGradientBrush complete = new LinearGradientBrush(bounds, Color.LightBlue, Color.Blue, LinearGradientMode.Horizontal))
            using (SolidBrush incomplete = new SolidBrush(Color.White))
            using(StringFormat format = new StringFormat())
            using(SolidBrush text = new SolidBrush(Color.Black))
            {
				complete.SetSigmaBellShape(1.0f, 0.25f);
                format.Alignment = StringAlignment.Center;
				graphics.FillRectangle(complete, bounds.X, bounds.Y + borderHeight, bounds.Width * length, bounds.Height - 2 * borderHeight);
				graphics.FillRectangle(incomplete, bounds.X + (bounds.Width * length), bounds.Y + borderHeight, bounds.Width - bounds.Width * length, bounds.Height - 2 * borderHeight);
                graphics.DrawString(string.Format("{0:0.00} %",this.manager.Progress), new Font(FontFamily.GenericSansSerif, 7), text, bounds, format); 
            }
        }
Example #30
0
        public override void Draw(System.Drawing.Graphics g)
        {
            g.DrawString("LIVES", LivesFont, Brushes.White, Position);

            if (_numberOfLives > 0)
            {
                g.DrawImage(TheImage, Position.X + 100, Position.Y, TheImage.Width * 2 / 3, TheImage.Height * 2 / 3);
            }

            if (_numberOfLives > 1)
            {
                g.DrawImage(TheImage, Position.X + 104 + TheImage.Width * 2 / 3, Position.Y, TheImage.Width * 2 / 3, TheImage.Height * 2 / 3);
            }

            if (_numberOfLives > 2)
            {
                g.DrawImage(TheImage, Position.X + 108 + 2 * TheImage.Width * 2 / 3, Position.Y, TheImage.Width * 2 / 3, TheImage.Height * 2 / 3);
            }
        }