當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。