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


C# IGraphics.FillRect方法代码示例

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


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

示例1: Render

        public void Render(IGraphics g, OpenGLTextureReference tex)
        {
            g.SetColor (Colors.White);

            var x = tex.X + tex.ShapeOffset.X;
            var y = tex.Y + tex.ShapeOffset.Y;

            switch (ShapeType) {
            case OpenGLShapeType.Line:
                g.DrawLine (x, y, x + A, y + B, C);
                break;
            case OpenGLShapeType.Rect:
                if (Fill) {
                    g.FillRect (x, y, A, B);
                }
                else {
                    g.DrawRect (x, y, A, B, C);
                }
                break;
            case OpenGLShapeType.RoundedRect:
                if (Fill) {
                    g.FillRoundedRect (x, y, A, B, C);
                }
                else {
                    g.DrawRoundedRect (x, y, A, B, C, D);
                }
                break;
            case OpenGLShapeType.Oval:
                if (Fill) {
                    g.FillOval (x, y, A, B);
                }
                else {
                    g.DrawOval (x, y, A, B, C);
                }
                break;
            case OpenGLShapeType.Character:
                g.SetFont (Font);
                g.DrawString (Char.ToString (), x, y);
                break;
            case OpenGLShapeType.Polygon: {
                    var dx = x - Poly.Points[0].X;
                    var dy = y - Poly.Points[0].Y;
                    var dpoly = new Polygon ();
                    for (var i = 0; i < Poly.Points.Count; i++) {
                        dpoly.AddPoint (Poly.Points[i].X + dx, Poly.Points[i].Y + dy);
                    }
                    if (Fill) {
                        g.FillPolygon (dpoly);
                    }
                    else {
                        g.DrawPolygon (dpoly, A);
                    }
                }
                break;
            case OpenGLShapeType.Arc:
                if (Fill) {
                    g.FillArc (x, y, A, B, C);
                }
                else {
                    g.DrawArc (x, y, A, B, C, D);
                }
                break;
            case OpenGLShapeType.Polyline: {
                    var dx = x - PolylinePoints[0].X;
                    var dy = y - PolylinePoints[0].Y;
                    g.BeginLines (true);
                    for (var i = 0; i < PolylineLength - 1; i++) {
                        g.DrawLine (
                            PolylinePoints[i].X + dx,
                            PolylinePoints[i].Y + dy,
                            PolylinePoints[i + 1].X + dx,
                            PolylinePoints[i + 1].Y + dy,
                            A);
                    }
                    g.EndLines ();
                }
                break;
            default:
                throw new NotSupportedException ();
            }
        }
开发者ID:robertgreen,项目名称:CrossGraphics,代码行数:81,代码来源:OpenGLGraphics.cs

示例2: VectorMapCanvas

        ////////////////////////////////////////////////////////////////////////////
        //--------------------------------- REVISIONS ------------------------------
        // Date       Name                 Tracking #         Description
        // ---------  -------------------  -------------      ----------------------
        // 21JUN2009  James Shen                 	          Initial Creation
        ////////////////////////////////////////////////////////////////////////////
        /**
         * Construtor.
         */
        public VectorMapCanvas()
        {
            GetGraphics2DInstance();
            _textImage = MapLayer.GetAbstractGraphicsFactory()
                    .CreateImage(MapLayer.MAP_TILE_WIDTH,
                    IMAGE_PATERN_WIDTH);
            _textGraphics = _textImage.GetGraphics();
            _textGraphics.SetColor(0xC0C0FF);
            _textGraphics.FillRect(0, 0, _textImage.GetWidth(), _textImage.GetHeight());
            _fontTranspency = _textImage.GetRGB()[0];
            _imagePattern = MapLayer.GetAbstractGraphicsFactory()
                    .CreateImage(IMAGE_PATERN_WIDTH,
                    IMAGE_PATERN_WIDTH);

            _imagePatternGraphics = _imagePattern.GetGraphics();

            _mapSize.X = 0; _mapSize.Y = 0;
            _mapSize.MaxX = MapLayer.MAP_TILE_WIDTH;
            _mapSize.MaxY = MapLayer.MAP_TILE_WIDTH;
            _mapSize.Width = MapLayer.MAP_TILE_WIDTH;
            _mapSize.Height = MapLayer.MAP_TILE_WIDTH;
        }
开发者ID:237rxd,项目名称:maptiledownloader,代码行数:31,代码来源:VectorMapCanvas.cs

示例3: DrawThumbnail

		public virtual void DrawThumbnail (IDocument doc, IGraphics g, SizeF size, Theme theme)
		{
			g.SetColor (GetThumbnailBackgroundColor (theme));
			g.FillRect (new RectangleF (PointF.Empty, size));
		}
开发者ID:praeclarum,项目名称:Praeclarum,代码行数:5,代码来源:DocumentApplication.cs


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