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


C# Graphics.DrawImageUnscaledAndClipped方法代码示例

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


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

示例1: RenderButton

        ///<summary>
        /// RenderButton
        ///</summary>
        ///<param name="g"></param>
        ///<param name="image"></param>
        ///<param name="buttonBounds"></param>
        ///<param name="clipBounds"></param>
        static public Size RenderButton(Graphics g, Image image,
            Rectangle buttonBounds, Rectangle clipBounds)
        {
            if (image != null && buttonBounds.IsEmpty == false)
            {
                Rectangle r = buttonBounds;
                r.Width++;
                r.Height++;

                if (r.Width > image.Width)
                {
                    r.X += (r.Width - image.Width)/2;
                    r.Width = image.Width;
                }

                if (r.Height > image.Height)
                {
                    r.Y += (r.Height - image.Height)/2;
                    r.Height = image.Height;
                }

                r.Intersect(clipBounds);

                g.DrawImageUnscaledAndClipped(image, r);

                return (r.Size);
            }

            return (Size.Empty);
        }
开发者ID:huamanhtuyen,项目名称:VNACCS,代码行数:37,代码来源:ExpandDisplay.cs

示例2: DrawMap

 public void DrawMap(Graphics device)
 {
     foreach (Tile tile in mapTiles)
     {
         device.DrawImageUnscaledAndClipped(tile.TileImg, new Rectangle(tile.TileLocation, new Size(40, 40)));
         //device.DrawImage(t.img, t.loc);
     }
 }
开发者ID:TeamDoldur,项目名称:RPG-Game,代码行数:8,代码来源:ShadowMountains.cs

示例3: DrawIcon

		public override void DrawIcon(Graphics g, Rectangle bounds) {
			if (IsRoot) {
				g.DrawImageUnscaledAndClipped(Resources.GetResource<Image>("Icons.arrow.png"), bounds);
			}
			else {
				ObjectIconRenderer.Render(analysis.TargetObject, g, bounds);
			}
		}
开发者ID:mamingxiu,项目名称:dnExplorer,代码行数:8,代码来源:AnalysisModel.cs

示例4: DrawFrame

        public override void DrawFrame(ConcurrentGifsCommand.Frame currentFrame, Graphics gfx)
        {
            if (currentFrame.Start < _startTime)
                return;

            var newBackground = Image.FromStream(this.GetType().Assembly.GetManifestResourceStream(
                "Gifenstein.Resources.AllRightGentlemen_impressed.png"));

            gfx.DrawImageUnscaledAndClipped(newBackground, new Rectangle(0, VerticalOffset, newBackground.Width, newBackground.Height));

            base.DrawFrame(currentFrame, gfx);
        }
开发者ID:fschwiet,项目名称:Gifenstein,代码行数:12,代码来源:AlrightImpressedStep.cs

示例5: RenderType

		public static void RenderType(ITypeDefOrRef type, Graphics g, Rectangle bounds) {
			var typeDef = type as TypeDef;
			if (typeDef == null) {
				g.DrawImageUnscaledAndClipped(Resources.GetResource<Image>("Icons.ObjModel.type.png"), bounds);
				return;
			}

			Image icon, visibility;

			icon = Resources.GetResource<Image>("Icons.ObjModel.type.png");
			if (typeDef.IsInterface) {
				icon = Resources.GetResource<Image>("Icons.ObjModel.interface.png");
			}
			else if (typeDef.BaseType != null) {
				if (typeDef.IsEnum) {
					icon = Resources.GetResource<Image>("Icons.ObjModel.enum.png");
				}
				else if (typeDef.IsValueType && !typeDef.IsAbstract) {
					icon = Resources.GetResource<Image>("Icons.ObjModel.valuetype.png");
				}
				else if (typeDef.IsDelegate()) {
					icon = Resources.GetResource<Image>("Icons.ObjModel.delegate.png");
				}
			}

			switch (typeDef.Visibility) {
				case TypeAttributes.NotPublic:
				case TypeAttributes.NestedAssembly:
				case TypeAttributes.NestedFamANDAssem:
					visibility = Resources.GetResource<Image>("Icons.ObjModel.internal.png");
					break;
				case TypeAttributes.NestedPrivate:
					visibility = Resources.GetResource<Image>("Icons.ObjModel.private.png");
					break;
				case TypeAttributes.NestedFamily:
					visibility = Resources.GetResource<Image>("Icons.ObjModel.protected.png");
					break;
				case TypeAttributes.NestedFamORAssem:
					visibility = Resources.GetResource<Image>("Icons.ObjModel.famasm.png");
					break;
				case TypeAttributes.Public:
				case TypeAttributes.NestedPublic:
				default:
					visibility = null;
					break;
			}

			g.DrawImageUnscaledAndClipped(icon, bounds);
			if (visibility != null)
				g.DrawImageUnscaledAndClipped(visibility, bounds);
		}
开发者ID:mamingxiu,项目名称:dnExplorer,代码行数:51,代码来源:ObjectIconRenderer.cs

示例6: Draw

        /// <summary>
        /// Draw rectangle
        /// </summary>
        /// <param name="g"></param>
        public override void Draw(Graphics g)
        {
            var property = Property as GridProperty;
            var brush = new SolidBrush(PropertyUtility.ParseToColor(property.BackgroudColor));
            var pen = new Pen(PropertyUtility.ParseToColor(property.BorderColor),
                PropertyUtility.ParseToNumber(property.BorderThickness));
            var rect = GraphicUtility.GetNormalizedRectangle(Rect);
            var drawRect = new RectangleF(rect.X, rect.Y, rect.Width, rect.Height);

            var treeImage = ImageUtility.ReadDataGrid(new Size(rect.Width, rect.Height));

            g.DrawRectangle(pen, rect);
            g.FillRectangle(brush, rect);
            g.DrawImageUnscaledAndClipped(treeImage, rect);

            treeImage.Dispose();
            pen.Dispose();
        }
开发者ID:dalinhuang,项目名称:tdcodes,代码行数:22,代码来源:DrawGrid.cs

示例7: Draw

        /// <summary>
        /// Draw rectangle
        /// </summary>
        /// <param name="g"></param>
        public override void Draw(Graphics g)
        {
            var property = Property as ImageProperty;
            var brush = new SolidBrush(PropertyUtility.ParseToColor(property.BackgroudColor));
            var pen = new Pen(PropertyUtility.ParseToColor(property.BorderColor),
                PropertyUtility.ParseToNumber(property.BorderThickness));
            var rect = GraphicUtility.GetNormalizedRectangle(Rect);
            var drawRect = new RectangleF(rect.X, rect.Y, rect.Width, rect.Height);

            var imagePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, property.BackgroudImage);
            var treeImage = ImageUtility.ReadImage(imagePath, new Size(rect.Width, rect.Height));

            g.DrawRectangle(pen, rect);
            g.FillRectangle(brush, rect);
            g.DrawImageUnscaledAndClipped(treeImage, rect);

            treeImage.Dispose();
            pen.Dispose();
        }
开发者ID:dalinhuang,项目名称:tdcodes,代码行数:23,代码来源:DrawImage.cs

示例8: Paint

        /// <summary>
        /// Cell painting
        /// </summary>
        /// <param name="graphics"></param>
        /// <param name="clipBounds"></param>
        /// <param name="cellBounds"></param>
        /// <param name="rowIndex"></param>
        /// <param name="elementState"></param>
        /// <param name="value"></param>
        /// <param name="formattedValue"></param>
        /// <param name="errorText"></param>
        /// <param name="cellStyle"></param>
        /// <param name="advancedBorderStyle"></param>
        /// <param name="paintParts"></param>
        protected override void Paint(Graphics graphics,
            Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates elementState,
            object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle,
            DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
        {
            if (DataGridView != null)
            {
                // First paint the borders of the cell

                if (PartsSet(paintParts, DataGridViewPaintParts.Border))
                    PaintBorder(graphics, clipBounds, cellBounds, cellStyle, advancedBorderStyle);

                // Now paint the background and content

                if (PartsSet(paintParts, DataGridViewPaintParts.Background))
                {
                    Rectangle rBk = GetBackBounds(cellBounds, advancedBorderStyle);

                    if (rBk.Height > 0 && rBk.Width > 0)
                    {
                        DataGridViewProgressBarXColumn oc = (DataGridViewProgressBarXColumn)OwningColumn;
                        Bitmap bm = oc.GetCellBitmap(cellBounds);

                        if (bm != null)
                        {
                            using (Graphics g = Graphics.FromImage(bm))
                            {
                                PaintButtonBackground(g, cellStyle, rBk);
                                PaintButtonContent(cellBounds, rowIndex, formattedValue, cellStyle, paintParts, bm);

                                graphics.DrawImageUnscaledAndClipped(bm, rBk);
                            }

                            if ((DataGridView.ShowCellErrors == true) &&
                                (paintParts & DataGridViewPaintParts.ErrorIcon) == DataGridViewPaintParts.ErrorIcon)
                            {
                                base.PaintErrorIcon(graphics, clipBounds, cellBounds, errorText);
                            }
                        }
                    }
                }
            }
        }
开发者ID:huamanhtuyen,项目名称:VNACCS,代码行数:57,代码来源:DataGridViewProgressBarXCell.cs

示例9: Render

        public void Render(MapControl mapCtrl, Graphics buffer, Rectangle area)
        {
            if (_textBrush == null)
            {
                _textBrush = new SolidBrush(mapCtrl.ForeColor);
            }

            int startTileX, startTileY, tilesCntX, tilesCntY;
            _map.InvalidateArea(area, out startTileX, out startTileY, out tilesCntX, out tilesCntY);
            for (int x = startTileX; x < startTileX + tilesCntX; x++)
            {
                for (int y = startTileY; y < startTileY + tilesCntY; y++)
                {
                    Rectangle destRect = new Rectangle(x * _map.TileWidth - area.X,
                        y * _map.TileHeight - area.Y, _map.TileWidth, _map.TileHeight);
                    buffer.DrawImageUnscaledAndClipped(_map[x, y], destRect);
                    if (mapCtrl.ShowTileNumber)
                    {
                        buffer.DrawString(string.Format("{0}:{1}", x, y), mapCtrl.Font, _textBrush,
                            destRect, _textFormat);
                    }
                }
            }
        }
开发者ID:PsychoTeras,项目名称:RatKing,代码行数:24,代码来源:RendererBG.cs

示例10: Paint

            public void Paint(Graphics graphics, bool active)
            {
                int x = boundingBox.Left;
                int y = boundingBox.Top;

                // Draw background first if the button is active.
                if (active)
                {
                  Bitmap background = Resources.collapsing_panel_grid_bg;
                  int bgX = x + (boundingBox.Width - background.Width) / 2;
                  int bgY = y + (boundingBox.Height - background.Height) / 2;
                  graphics.DrawImageUnscaled(background, bgX, bgY);

                  // Move the button image down and right a bit to create the "pressed" effect.
                  x++;
                  y++;
                }

                // Center images in the available space.
                x += (boundingBox.Width - bitmap.Width) / 2;
                y += (boundingBox.Height - bitmap.Height) / 2;
                graphics.DrawImageUnscaled(bitmap, x, y);

                // Draw a left border line if not active.
                if (!active)
                {
                  Bitmap boundary = Resources.collapsing_panel_header_tab_left_flat;
                  graphics.DrawImageUnscaledAndClipped(boundary, new Rectangle(x, y, boundary.Width, boundingBox.Height));
                }
            }
开发者ID:abibell,项目名称:mysql-workbench,代码行数:30,代码来源:CollapsingPanel.cs

示例11: draw

 public new void draw(Graphics g)
 {
     if (_resize)
         g.DrawImage(_image, rect());
     else
         g.DrawImageUnscaledAndClipped(_image, rect());
     Pen p = new Pen(_forecolor);
     if (selected) p.Width = 2;
     p.DashStyle = ds;
     g.DrawRectangle(p, rect());
 }
开发者ID:maysam,项目名称:ParsLogPlot,代码行数:11,代码来源:UserControl1.cs

示例12: DrawBackground

 public override void DrawBackground(Graphics gfx)
 {
     gfx.DrawImageUnscaledAndClipped(_image, new Rectangle(0, VerticalOffset, _image.Width, _image.Height));
 }
开发者ID:fschwiet,项目名称:Gifenstein,代码行数:4,代码来源:AlrightStep.cs

示例13: DrawBorder

 private void DrawBorder(Graphics g)
 {
     g.DrawImage(this.BorderLeft, new Rectangle(0, this.TitleBarPanel.Height, this.BorderLeft.Width, base.Height - (this.TitleBarPanel.Height + this.BorderBottomLeft.Height)));
     g.DrawImage(this.BorderRight, new Rectangle(base.Width - this.BorderRight.Width, this.TitleBarPanel.Height, this.BorderRight.Width, base.Height - (this.TitleBarPanel.Height + this.BorderBottomRight.Height)));
     int num = base.Width / this.BorderBottom.Width;
     if ((base.Width % num) > 0)
     {
         num++;
     }
     for (int i = 0; i < num; i++)
     {
         g.DrawImageUnscaledAndClipped(this.BorderBottom, new Rectangle(i * this.BorderBottom.Width, base.Height - this.BorderBottom.Height, this.BorderBottom.Width, this.BorderBottom.Height));
     }
     g.DrawImage(this.BorderBottomLeft, new Rectangle(0, base.Height - this.BorderBottomLeft.Height, this.BorderBottomLeft.Width, this.BorderBottomLeft.Height));
     g.DrawImage(this.BorderBottomRight, new Rectangle(base.Width - this.BorderBottomRight.Width, base.Height - this.BorderBottomRight.Height, this.BorderBottomRight.Width, this.BorderBottomRight.Height));
 }
开发者ID:micheljung,项目名称:gpgnetfix,代码行数:16,代码来源:DockContainerForm.cs

示例14: Draw

        /// <summary>
        /// �����м����ָʾѪ����־��ש��
        /// </summary>
        /// <param name="paper">����ש���graphics</param>
        public void Draw(Graphics paper)
        {
            Rectangle brickRect = new Rectangle(x, y, width, height);
            Image brickImage = materials[type];
            paper.DrawImageUnscaledAndClipped(brickImage,brickRect); //��ש��
            paper.DrawRectangle(Pens.Black, x, y, width, height); //��ש��ı�

            int radius = height/3;
            Rectangle trafficLight = new Rectangle(Centre.X - radius, Centre.Y - radius, 2 * radius, 2 * radius);
            paper.FillEllipse(strengthBrush[strength], trafficLight); //����ָʾ��
            paper.DrawEllipse(Pens.Black, trafficLight); //ָʾ�Ʊ߽�
        }
开发者ID:prince2015,项目名称:Avatar,代码行数:16,代码来源:Brick.cs

示例15: Draw

        /// <summary>
        /// Draws the button.
        /// </summary>
        /// <param name="graphics">
        /// The graphics context used to draw the button.
        /// </param>
        public void Draw(Graphics graphics)
        {
            // Return if the button is not visible
            if (!this.IsVisible)
            {
                return;
            }

            // Draw button image
            switch (this.State)
            {
                case ButtonState.Standard:
                    graphics.DrawImageUnscaledAndClipped(this.StandardImage, this.PositionAndSize);
                    break;
                case ButtonState.Hovered:
                    graphics.DrawImageUnscaledAndClipped(this.HoverImage, this.PositionAndSize);
                    break;
                case ButtonState.Pressed:
                    graphics.DrawImageUnscaledAndClipped(this.PressedImage, this.PositionAndSize);
                    break;
            }

            // Draw text if any
            if (this.Text != string.Empty)
            {
                graphics.DrawString(this.Text, this.TextFont, new SolidBrush(this.TextColor), this.PositionAndSize);
            }
        }
开发者ID:mathiassoeholm,项目名称:BlobDefense,代码行数:34,代码来源:GuiButton.cs


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