当前位置: 首页>>代码示例>>C#>>正文


C# System.FillRectangle方法代码示例

本文整理汇总了C#中System.FillRectangle方法的典型用法代码示例。如果您正苦于以下问题:C# System.FillRectangle方法的具体用法?C# System.FillRectangle怎么用?C# System.FillRectangle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System的用法示例。


在下文中一共展示了System.FillRectangle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawGraph

        protected override void DrawGraph(System.Drawing.Graphics g)
        {
            Rectangle.Height = Math.Max(80, Rectangle.Height);
            Rectangle.Width = Math.Max(40, Rectangle.Width);
            var rect = DrawRectangle.GetNormalizedRectangle(Rectangle);

            using (Pen pen = new Pen(PenColor, PenWidth))
            {
                var backRect = new Rectangle(rect.Left + 3, rect.Top + 3, rect.Width, rect.Height);
                g.FillRectangle(Brushes.LightGray, backRect);

                using (var brush = GetBrush(rect))
                {
                    var fillRect = new Rectangle(rect.Left, rect.Top, rect.Width, 20);
                    g.FillRectangle(brush, fillRect);
                }

                using (var brush = DrawRectangle.GetBackgroundBrush(rect, this.BackColor))
                {
                    var fillRect = new Rectangle(rect.Left, rect.Top + 20, rect.Width, rect.Height - 20);
                    g.FillRectangle(brush, fillRect);
                }

                var startPoint = new Point(Rectangle.Left, Rectangle.Top + 20);
                var endPoint = new Point(Rectangle.Right, Rectangle.Top + 20);
                g.DrawLine(pen, startPoint, endPoint);

                g.DrawRectangle(pen, rect);
            }
        }
开发者ID:JodenSoft,项目名称:JodenSoft,代码行数:30,代码来源:DrawLane.cs

示例2: DrawLabel

        /// <summary>
        /// Renders a label to the map.
        /// </summary>
        /// <param name="g">Graphics reference</param>
        /// <param name="LabelPoint">Label placement</param>
        /// <param name="Offset">Offset of label in screen coordinates</param>
        /// <param name="font">Font used for rendering</param>
        /// <param name="forecolor">Font forecolor</param>
        /// <param name="backcolor">Background color</param>
        /// <param name="halo">Color of halo</param>
        /// <param name="rotation">Text rotation in degrees</param>
        /// <param name="text">Text to render</param>
        /// <param name="map">Map reference</param>
        public static void DrawLabel(System.Drawing.Graphics g, System.Drawing.PointF LabelPoint, System.Drawing.PointF Offset, System.Drawing.Font font, System.Drawing.Color forecolor, System.Drawing.Brush backcolor, System.Drawing.Pen halo, float rotation, string text, SharpMap.Map map)
        {
            System.Drawing.SizeF fontSize = g.MeasureString(text, font); //Calculate the size of the text
            LabelPoint.X += Offset.X; LabelPoint.Y += Offset.Y; //add label offset
            if (rotation != 0 && rotation != float.NaN)
            {
                g.TranslateTransform(LabelPoint.X, LabelPoint.Y);
                g.RotateTransform(rotation);
                g.TranslateTransform(-fontSize.Width / 2, -fontSize.Height / 2);
                if (backcolor != null && backcolor != System.Drawing.Brushes.Transparent)
                    g.FillRectangle(backcolor, 0, 0, fontSize.Width * 0.74f + 1f, fontSize.Height * 0.74f);
                System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
                path.AddString(text, font.FontFamily, (int)font.Style, font.Size, new System.Drawing.Point(0, 0), null);
                if (halo != null)
                    g.DrawPath(halo, path);
                g.FillPath(new System.Drawing.SolidBrush(forecolor), path);
                //g.DrawString(text, font, new System.Drawing.SolidBrush(forecolor), 0, 0);
                g.Transform = map.MapTransform;
            }
            else
            {
                if (backcolor != null && backcolor != System.Drawing.Brushes.Transparent)
                    g.FillRectangle(backcolor, LabelPoint.X, LabelPoint.Y, fontSize.Width * 0.74f + 1, fontSize.Height * 0.74f);

                System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();

                path.AddString(text, font.FontFamily, (int)font.Style, font.Size, LabelPoint, null);
                if (halo != null)
                    g.DrawPath(halo, path);
                g.FillPath(new System.Drawing.SolidBrush(forecolor), path);
                //g.DrawString(text, font, new System.Drawing.SolidBrush(forecolor), LabelPoint.X, LabelPoint.Y);
            }
        }
开发者ID:jumpinjackie,项目名称:fdotoolbox,代码行数:46,代码来源:VectorRenderer.cs

示例3: Paint

        public override void Paint(System.Drawing.Graphics g)
        {
            /*
            Matrix or = g.Transform;
            Matrix m = new Matrix();
            m.RotateAt(20, Rectangle.Location);
            g.MultiplyTransform(m, MatrixOrder.Append);
             */
            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            //the shadow
            g.FillRectangle(ArtPallet.ShadowBrush, Rectangle.X + 5, Rectangle.Y + 5, Rectangle.Width, Rectangle.Height);
            //the actual bundle
            g.FillRectangle(ShapeBrush,Rectangle);
            //the edge of the bundle
            if(Hovered || IsSelected)
                g.DrawRectangle(ArtPallet.HighlightPen,Rectangle);
            else
                g.DrawRectangle(ArtPallet.BlackPen, Rectangle);
            //the connectors
            for(int k=0;k<Connectors.Count;k++)
            {
                Connectors[k].Paint(g);
            }

            //here we keep it really simple:
            if(!string.IsNullOrEmpty(Text))
                g.DrawString(Text, ArtPallet.DefaultFont, Brushes.Black, TextRectangle);
            //g.Transform = or;
        }
开发者ID:Tom-Hoinacki,项目名称:OO-CASE-Tool,代码行数:29,代码来源:SimpleRectangle.cs

示例4: Draw3ColorBar

        public static void Draw3ColorBar(System.Drawing.Graphics dc, System.Drawing.RectangleF r, System.Windows.Forms.Orientation orientation, System.Drawing.Color c1, System.Drawing.Color c2,
            System.Drawing.Color c3)
        {
            // to draw a 3 color bar 2 gradient brushes are needed
            // one from c1 - c2 and c2 - c3
            var lr1 = r;
            var lr2 = r;
            float angle = 0;

            if (orientation == System.Windows.Forms.Orientation.Vertical)
            {
                angle = 270;

                lr1.Height = lr1.Height/2;
                lr2.Height = r.Height - lr1.Height;
                lr2.Y += lr1.Height;
            }
            if (orientation == System.Windows.Forms.Orientation.Horizontal)
            {
                angle = 0;

                lr1.Width = lr1.Width/2;
                lr2.Width = r.Width - lr1.Width;
                lr1.X = lr2.Right;
            }

            if (lr1.Height > 0 && lr1.Width > 0)
            {
                using (System.Drawing.Drawing2D.LinearGradientBrush lb2 = new System.Drawing.Drawing2D.LinearGradientBrush(lr2, c1, c2, angle, false),  lb1 = new System.Drawing.Drawing2D.LinearGradientBrush(lr1, c2, c3, angle, false) )
                {
                    dc.FillRectangle(lb1, lr1);
                    dc.FillRectangle(lb2, lr2);

                }

            }
            // with some sizes the first pixel in the gradient rectangle shows the opposite color
            // this is a workaround for that problem
            if (orientation == System.Windows.Forms.Orientation.Vertical)
            {
                using (System.Drawing.Pen pc2 = new System.Drawing.Pen(c2, 1), pc3 = new System.Drawing.Pen(c3, 1))
                {
                    dc.DrawLine(pc3, lr1.Left, lr1.Top, lr1.Right - 1, lr1.Top);
                    dc.DrawLine(pc2, lr2.Left, lr2.Top, lr2.Right - 1, lr2.Top);

                }
            }

            if (orientation == System.Windows.Forms.Orientation.Horizontal)
            {
                using (System.Drawing.Pen pc1 = new System.Drawing.Pen(c1, 1), pc2 = new System.Drawing.Pen(c2, 1), pc3 = new System.Drawing.Pen(c3, 1))
                {
                    dc.DrawLine(pc1, lr2.Left, lr2.Top, lr2.Left, lr2.Bottom - 1);
                    dc.DrawLine(pc2, lr2.Right, lr2.Top, lr2.Right, lr2.Bottom - 1);
                    dc.DrawLine(pc3, lr1.Right, lr1.Top, lr1.Right, lr1.Bottom - 1);

                }
            }
        }
开发者ID:firestream99,项目名称:VisioAutomation,代码行数:59,代码来源:ColorPickerUtil.cs

示例5: Draw

        /// <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));
                            }
                        }
                    }
                }
            }
        }
开发者ID:huaan011,项目名称:BMap.NET,代码行数:65,代码来源:BDistance.cs

示例6: OnDraw

        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);
        }
开发者ID:IliqNikushev,项目名称:flow-network,代码行数:13,代码来源:SinkElement.cs

示例7: Draw

        // -------------------------------------------------        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);
        }
开发者ID:huutruongqnvn,项目名称:vnecoo01,代码行数:49,代码来源:GraphConcat.cs

示例8: DrawBg

            public override void DrawBg(System.Drawing.Graphics g, System.Drawing.Rectangle rect, System.Drawing.Drawing2D.SmoothingMode smooth)
            {
                using (SolidBrush backBrush = new SolidBrush(BgColor))
                    g.FillRectangle(backBrush, rect);

                g.SmoothingMode = smooth;
            }
开发者ID:AndrianDTR,项目名称:Atlantic,代码行数:7,代码来源:Office12Renderer.cs

示例9: Draw

        public override void Draw(System.Drawing.Graphics g)
        {
            #if DEBUG
            Console.WriteLine("Zone");
            #endif
            GraphicsState gState = g.Save();
            //Matrix scaleM = new Matrix();
            //scaleM.Scale(1, 1);

            //scaleM.TransformPoints(arrPoints);

            base.translationMatrix.Reset();
            base.translationMatrix.Translate(this.Position.X, this.Position.Y);
            g.MultiplyTransform(base.translationMatrix, MatrixOrder.Prepend);
            g.FillRectangle(Brushes.Blue, 0, 0, 500, 250);
            //g.FillRectangle(Brushes.Blue, 0, 0, 500, 250);

            foreach (IDrawable e in cards)
            {
                if (e.Visible)
                {
                    e.Draw(g);
                }
            }
            g.Restore(gState);
        }
开发者ID:Echo343,项目名称:Cartographer,代码行数:26,代码来源:Zone.cs

示例10: Paint

        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) { }
        }
开发者ID:Camel-RD,项目名称:MyDownloder,代码行数:27,代码来源:DataGridViewProgressColumn.cs

示例11: Draw

        /// <summary>
        /// Draw the gridlines.
        /// </summary>
        /// <param name="graphics">Reference to the GDI+ drawing surface.</param>
		public void Draw(System.Drawing.Graphics graphics)
		{
			using (Pen graphAreaPen = new Pen(m_ParentGraph.GridlineColor))
			{
				graphAreaPen.DashStyle = DashStyle.Dash;
				using (Brush graphAreaBrush = new SolidBrush(m_ParentGraph.GraphAreaColor))
				{
					graphics.FillRectangle(graphAreaBrush, m_ParentGraph.GraphArea);
					graphics.DrawRectangle(graphAreaPen, m_ParentGraph.GraphArea);

					if ((m_ParentGraph.Gridlines & GridStyles.Horizontal) == GridStyles.Horizontal)
					{
						graphics.SetClip(m_ParentGraph.GraphArea);

						int gridSize = m_ParentGraph.GraphArea.Height / m_ParentGraph.GraduationsY;
						for (int i = 0; i < m_ParentGraph.GraphArea.Height; i += gridSize)
						{
							graphics.DrawLine(graphAreaPen, m_ParentGraph.GraphArea.Left, m_ParentGraph.GraphArea.Top + i, m_ParentGraph.GraphArea.Right, m_ParentGraph.GraphArea.Top + i);
						}
					}

					if ((m_ParentGraph.Gridlines & GridStyles.Vertical) == GridStyles.Vertical)
					{
						graphics.SetClip(m_ParentGraph.GraphArea);

						int gridSize = m_ParentGraph.GraphArea.Width / m_ParentGraph.GraduationsX;
						for (int i = 0; i < m_ParentGraph.GraphArea.Width; i += gridSize)
						{
							graphics.DrawLine(graphAreaPen, m_ParentGraph.GraphArea.Left + i, m_ParentGraph.GraphArea.Bottom, m_ParentGraph.GraphArea.Left + i, m_ParentGraph.GraphArea.Top);
						}
					}
				}
			}
        }
开发者ID:SiGenixDave,项目名称:PtuPCNew,代码行数:38,代码来源:Gridline.cs

示例12: Paint

        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) { }
        }
开发者ID:tatar1nro,项目名称:KKM_Trash,代码行数:26,代码来源:dataProgress.cs

示例13: paint

		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));
				}
			}
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:26,代码来源:ToolButton.cs

示例14: Paint

        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);
            }
        }
开发者ID:TheTerribleChild,项目名称:Windows-Novel-Reader,代码行数:30,代码来源:NovelListController.cs

示例15: Draw

        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); 
            }
        }
开发者ID:AssassinUKG,项目名称:monotorrent,代码行数:16,代码来源:TorrentProgressBar.cs


注:本文中的System.FillRectangle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。