• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ImageLayout类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ImageLayout的典型用法代码示例。如果您正苦于以下问题:C# ImageLayout类的具体用法?C# ImageLayout怎么用?C# ImageLayout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ImageLayout类属于命名空间,在下文中一共展示了ImageLayout类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: DrawBackgroundImage

 public static void DrawBackgroundImage(Graphics g, Image backgroundImage, Color backColor, ImageLayout backgroundImageLayout, Rectangle bounds, Rectangle clipRect, Point scrollOffset, RightToLeft rightToLeft)
 {
     if (g == null)
     {
         throw new ArgumentNullException("g");
     }
     if (backgroundImageLayout == ImageLayout.Tile)
     {
         using (TextureBrush brush = new TextureBrush(backgroundImage, WrapMode.Tile))
         {
             if (scrollOffset != Point.Empty)
             {
                 Matrix transform = brush.Transform;
                 transform.Translate((float) scrollOffset.X, (float) scrollOffset.Y);
                 brush.Transform = transform;
             }
             g.FillRectangle(brush, clipRect);
             return;
         }
     }
     Rectangle rect = CalculateBackgroundImageRectangle(bounds, backgroundImage, backgroundImageLayout);
     if ((rightToLeft == RightToLeft.Yes) && (backgroundImageLayout == ImageLayout.None))
     {
         rect.X += clipRect.Width - rect.Width;
     }
     using (SolidBrush brush2 = new SolidBrush(backColor))
     {
         g.FillRectangle(brush2, clipRect);
     }
     if (!clipRect.Contains(rect))
     {
         if ((backgroundImageLayout == ImageLayout.Stretch) || (backgroundImageLayout == ImageLayout.Zoom))
         {
             rect.Intersect(clipRect);
             g.DrawImage(backgroundImage, rect);
         }
         else if (backgroundImageLayout == ImageLayout.None)
         {
             rect.Offset(clipRect.Location);
             Rectangle destRect = rect;
             destRect.Intersect(clipRect);
             Rectangle rectangle3 = new Rectangle(Point.Empty, destRect.Size);
             g.DrawImage(backgroundImage, destRect, rectangle3.X, rectangle3.Y, rectangle3.Width, rectangle3.Height, GraphicsUnit.Pixel);
         }
         else
         {
             Rectangle rectangle4 = rect;
             rectangle4.Intersect(clipRect);
             Rectangle rectangle5 = new Rectangle(new Point(rectangle4.X - rect.X, rectangle4.Y - rect.Y), rectangle4.Size);
             g.DrawImage(backgroundImage, rectangle4, rectangle5.X, rectangle5.Y, rectangle5.Width, rectangle5.Height, GraphicsUnit.Pixel);
         }
     }
     else
     {
         ImageAttributes imageAttr = new ImageAttributes();
         imageAttr.SetWrapMode(WrapMode.TileFlipXY);
         g.DrawImage(backgroundImage, rect, 0, 0, backgroundImage.Width, backgroundImage.Height, GraphicsUnit.Pixel, imageAttr);
         imageAttr.Dispose();
     }
 }
开发者ID:zhushengwen,项目名称:example-zhushengwen,代码行数:60,代码来源:CmbControlPaintEx.cs


示例2: VGScrollImage

    ///////////////////////////////////////////////////////////////////////////////
    // Defining Constants                                                        //
    ///////////////////////////////////////////////////////////////////////////////
    #region CONSTANTS

    #endregion //CONSTANTS

    ///////////////////////////////////////////////////////////////////////////////
    // Defining Variables, Enumerations, Events                                  //
    ///////////////////////////////////////////////////////////////////////////////
    #region FIELDS
    #endregion //FIELDS

    ///////////////////////////////////////////////////////////////////////////////
    // Construction and Initializing methods                                     //
    ///////////////////////////////////////////////////////////////////////////////
    #region CONSTRUCTION

    /// <summary>
    /// Initializes a new instance of the VGScrollImage class.
    /// When newShapeDrawAction is set to None, only the image will
    /// be drawn, with Edge an additional border is drawn,
    /// with fill an additional (hopefully transparent) fill is drawn over the image.
    /// </summary>
    /// <param name="newShapeDrawAction">Drawing action: Edge, Fill, Both, None</param>
    /// <param name="newPen">Pen for additional borderline.</param>
    /// <param name="newBrush">Brush for additional fills.</param>
    /// <param name="newFont">Font for drawing name</param>
    /// <param name="newFontColor">Font color for drawing name.</param>
    /// <param name="newImageFile">filename without path</param>
    /// <param name="newPath">path to image file</param>
    /// <param name="newLayout"><see cref="ImageLayout"/> of the image</param>
    /// <param name="newAlpha">The transparency alpha for this image.0=transparent,1=opaque</param>
    /// <param name="newCanvas"><see cref="Size"/> of the owning original canvas</param>
    /// <param name="newStyleGroup">Group Enumeration, <see cref="VGStyleGroup"/></param>
    /// <param name="newName">Name of Element</param>
    /// <param name="newElementGroup">Element group description</param>
    public VGScrollImage(
      ShapeDrawAction newShapeDrawAction,
      Pen newPen,
      Brush newBrush,
      Font newFont,
      Color newFontColor,
      string newImageFile,
      string newPath,
      ImageLayout newLayout,
      float newAlpha,
      Size newCanvas,
      VGStyleGroup newStyleGroup,
      string newName,
      string newElementGroup)
      : base(
      newShapeDrawAction,
      newPen,
      newBrush,
      newFont,
      newFontColor,
      newImageFile,
      newPath,
      newLayout,
      newAlpha,
      newCanvas,
      newStyleGroup,
      newName,
      newElementGroup,
      false)
    {
    }
开发者ID:DeSciL,项目名称:Ogama,代码行数:68,代码来源:VGScrollImage.cs


示例3: CalculateBackgroundImageRectangle

        internal static Rectangle CalculateBackgroundImageRectangle(Rectangle bounds, Image backgroundImage, ImageLayout imageLayout)
        {
            Rectangle rectangle = bounds;
            if (backgroundImage != null)
            {
                switch (imageLayout)
                {
                    case ImageLayout.None:
                        rectangle.Size = backgroundImage.Size;
                        return rectangle;

                    case ImageLayout.Tile:
                        return rectangle;

                    case ImageLayout.Center:
                    {
                        rectangle.Size = backgroundImage.Size;
                        Size size = bounds.Size;
                        if (size.Width > rectangle.Width)
                        {
                            rectangle.X = (size.Width - rectangle.Width) / 2;
                        }
                        if (size.Height > rectangle.Height)
                        {
                            rectangle.Y = (size.Height - rectangle.Height) / 2;
                        }
                        return rectangle;
                    }
                    case ImageLayout.Stretch:
                        rectangle.Size = bounds.Size;
                        return rectangle;

                    case ImageLayout.Zoom:
                    {
                        Size size2 = backgroundImage.Size;
                        float num = ((float) bounds.Width) / ((float) size2.Width);
                        float num2 = ((float) bounds.Height) / ((float) size2.Height);
                        if (num >= num2)
                        {
                            rectangle.Height = bounds.Height;
                            rectangle.Width = (int) ((size2.Width * num2) + 0.5);
                            if (bounds.X >= 0)
                            {
                                rectangle.X = (bounds.Width - rectangle.Width) / 2;
                            }
                            return rectangle;
                        }
                        rectangle.Width = bounds.Width;
                        rectangle.Height = (int) ((size2.Height * num) + 0.5);
                        if (bounds.Y >= 0)
                        {
                            rectangle.Y = (bounds.Height - rectangle.Height) / 2;
                        }
                        return rectangle;
                    }
                }
            }
            return rectangle;
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:59,代码来源:ControlPaint.cs


示例4: CalculateBackgroundImageRectangle

        internal static Rectangle CalculateBackgroundImageRectangle(Rectangle bounds, Image backgroundImage, ImageLayout imageLayout) {

           Rectangle result = bounds;

           if (backgroundImage != null) {
               switch (imageLayout) {
                   case ImageLayout.Stretch:
                       result.Size = bounds.Size;
                       break;

                   case ImageLayout.None:
                       result.Size = backgroundImage.Size;
                       break;

                   case ImageLayout.Center:
                       result.Size = backgroundImage.Size;
                       Size szCtl = bounds.Size;
                       
                       if (szCtl.Width > result.Width) {
                           result.X = (szCtl.Width - result.Width) / 2;
                       }
                       if (szCtl.Height > result.Height) {
                           result.Y = (szCtl.Height - result.Height) / 2;
                       }
                       break;

                   case ImageLayout.Zoom:
                        Size imageSize = backgroundImage.Size;
                        float xRatio = (float)bounds.Width / (float)imageSize.Width;
                        float yRatio = (float)bounds.Height / (float)imageSize.Height;
                        if (xRatio < yRatio) {
                            //width should fill the entire bounds.
                            result.Width = bounds.Width;
                            // preserve the aspect ratio by multiplying the xRatio by the height
                            // adding .5 to round to the nearest pixel
                            result.Height = (int) ((imageSize.Height * xRatio) +.5);
                            if (bounds.Y >= 0)
                            {                               
                                result.Y = (bounds.Height - result.Height) /2;
                            }
                        }
                        else {
                            // width should fill the entire bounds
                            result.Height = bounds.Height;                       
                            // preserve the aspect ratio by multiplying the xRatio by the height
                            // adding .5 to round to the nearest pixel
                            result.Width = (int) ((imageSize.Width * yRatio) +.5);
                            if (bounds.X >= 0)
                            {
                                result.X = (bounds.Width - result.Width) /2;
                            }
                        }
                                              
                        break;
               }
           }
           return result;
       }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:58,代码来源:ControlPaint.cs


示例5: layout

 public static PictureBox layout(this PictureBox pictureBox, ImageLayout imageLayout)
 {
     return pictureBox.invokeOnThread(
         () =>
             {
                 pictureBox.BackgroundImageLayout = imageLayout;
                 return pictureBox;
             });
 }
开发者ID:sempf,项目名称:FluentSharp,代码行数:9,代码来源:WinForms_ExtensionMethods_PictureBox.cs


示例6: ConstructSpecial

 public void ConstructSpecial(string bitmapResName, ImageLayout bitmapLayout, string tagLine, Color tagColor)
 {
     GeneralLooks = SplashLooks.Special;
     lblMainVersion.Visible = false;
     picCup.Visible = false;
     lblTitle.Visible = false;
     lblSeparator.Visible = false;
     lblTagLine.Visible = false;
     ArrangeSpecial(bitmapResName, bitmapLayout, tagLine, tagColor);
 }
开发者ID:CisBetter,项目名称:ags,代码行数:10,代码来源:SplashPage.cs


示例7: ImageMemoryBarrier

 public ImageMemoryBarrier(Image image, ImageLayout oldLayout, ImageLayout newLayout, AccessFlags sourceAccesMask, AccessFlags destinationAccessMask, uint sourceQueueFamilyIndex, uint destinationQueueFamilyIndex, ImageSubresourceRange subresourceRange)
 {
     StructureType = StructureType.ImageMemoryBarrier;
     Next = IntPtr.Zero;
     Image = image;
     SubresourceRange = subresourceRange;
     OldLayout = oldLayout;
     NewLayout = newLayout;
     SourceAccessMask = sourceAccesMask;
     DestinationAccessMask = destinationAccessMask;
     SourceQueueFamilyIndex = sourceQueueFamilyIndex;
     DestinationQueueFamilyIndex = destinationQueueFamilyIndex;
 }
开发者ID:jwollen,项目名称:SharpVulkan,代码行数:13,代码来源:ImageMemoryBarrier.cs


示例8: PEImage

 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="imageStreamCreator">The PE stream creator</param>
 /// <param name="imageLayout">Image layout</param>
 /// <param name="verify">Verify PE file data</param>
 public PEImage(IImageStreamCreator imageStreamCreator, ImageLayout imageLayout, bool verify)
 {
     try {
         this.imageStreamCreator = imageStreamCreator;
         this.peType = ConvertImageLayout(imageLayout);
         ResetReader();
         this.peInfo = new PEInfo(imageStream, verify);
         Initialize();
     }
     catch {
         Dispose();
         throw;
     }
 }
开发者ID:sthiy,项目名称:dnlib,代码行数:20,代码来源:PEImage.cs


示例9: ShowDialog

        /// <summary>
        /// Shows the dialog.
        /// </summary>
        /// <param name="labelText">The label text.</param>
        /// <param name="title">The title.</param>
        /// <param name="i">The i.</param>
        /// <param name="maxlen">The maxlen.</param>
        /// <param name="il">The il.</param>
        /// <returns></returns>
        public string[] ShowDialog(string labelText, string title, Image i, int maxlen = -1,
            ImageLayout il = ImageLayout.Center)
        {
            Text = title;
            label.Text = labelText;
            imagepanel.BackgroundImage = i;
            imagepanel.BackgroundImageLayout = il;

            if (maxlen >= 0)
                textbox.MaxLength = maxlen;

            ShowDialog();
            return returnvalue;
        }
开发者ID:andreigec,项目名称:ANDREICSLIB,代码行数:23,代码来源:GetStringImageCompare.cs


示例10: DrawBackgroundImage

 public static void DrawBackgroundImage(
     Graphics g,
     Image backgroundImage,
     Color backColor,
     ImageLayout backgroundImageLayout,
     Rectangle bounds,
     Rectangle clipRect)
 {
     DrawBackgroundImage(
         g,
         backgroundImage,
         backColor,
         backgroundImageLayout,
         bounds,
         clipRect,
         Point.Empty,
         RightToLeft.No);
 }
开发者ID:piaolingzxh,项目名称:Justin,代码行数:18,代码来源:ControlPaintEx.cs


示例11: DrawBackgroundImage

 public static void DrawBackgroundImage(
     System.Drawing.Graphics g,
     Image backgroundImage,
     Color backColor,
     ImageLayout backgroundImageLayout,
     Rectangle bounds,
     Rectangle clipRect,
     Point scrollOffset)
 {
     DrawBackgroundImage(
         g,
         backgroundImage,
         backColor,
         backgroundImageLayout,
         bounds,
         clipRect,
         scrollOffset,
         RightToLeft.No);
 }
开发者ID:songques,项目名称:CSSIM_Solution,代码行数:19,代码来源:ControlPaintEx.cs


示例12: RenderBackgroundImage

        public static void RenderBackgroundImage(this Graphics Graphics, Rectangle ClientRectangle, Color BackColor, Int32 Width, Int32 Height, ImageLayout ImageLayout, Image BackgroundImage)
        {
            Graphics.SetClip(ClientRectangle);
            Graphics.SmoothingMode = SmoothingMode.HighQuality;
            Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;

            Graphics.FillRectangle(new SolidBrush(BackColor), ClientRectangle);

            if (BackgroundImage != null) {
                switch (ImageLayout) {
                    case ImageLayout.Center:
                        Graphics.DrawImageUnscaled(BackgroundImage, Width / 2 - BackgroundImage.Width / 2, Height / 2 - BackgroundImage.Height / 2);
                        break;
                    case ImageLayout.None:
                        Graphics.DrawImageUnscaled(BackgroundImage, 0, 0);
                        break;
                    case ImageLayout.Stretch:
                        Graphics.DrawImage(BackgroundImage, 0, 0, Width, Height);
                        break;
                    case ImageLayout.Tile:
                        var pixelOffsetX = 0;
                        var pixelOffsetY = 0;
                        while (pixelOffsetX < Width) {
                            pixelOffsetY = 0;
                            while (pixelOffsetY < Height) {
                                Graphics.DrawImageUnscaled(BackgroundImage, pixelOffsetX, pixelOffsetY);
                                pixelOffsetY += BackgroundImage.Height;
                            }
                            pixelOffsetX += BackgroundImage.Width;
                        }
                        break;
                    case ImageLayout.Zoom:
                        if ((Single)(BackgroundImage.Width / Width) < (Single)(BackgroundImage.Height / Height))
                            Graphics.DrawImage(BackgroundImage, 0, 0, Height, Height);
                        else
                            Graphics.DrawImage(BackgroundImage, 0, 0, Width, Width);
                        break;
                }
            }
        }
开发者ID:StewartScottRogers,项目名称:RealtimeControlsSolution,代码行数:40,代码来源:BackgroundImageRenderer.cs


示例13: BejelformAlapInit

        public virtual void BejelformAlapInit(Bejelentkezo bejel, Bitmap bitmap, ImageLayout layout, string formszov, Icon icon)
        {
            InitializeComponent();
//            ErrorProvider.ContainerControl = containerControl1;
            this.panel1.BackgroundImage = bitmap;
            this.panel1.BackgroundImageLayout = layout;
            Bejel = bejel;
            alkid = Bejel.alkid;
            kezeloidkar = bejel.KezeloIdkArray;
            Sqlinterface.RendszerUserConn(Bejel.Rendszerconn, Bejel.Userconn);
            Sqlinterface.Select(kezelok, Bejel.Userconn, "KEZELOK", "", "", false);
            string maidat = DateTime.Today.ToShortDateString();
            if (maidat.EndsWith("."))
                maidat = maidat.Substring(0, maidat.Length - 1);
            if (bejel.Rgazdaid=="-1")             // kell egy rendszergazda
            {
                label2.Text = "Rendszergazda:";
                textBox2.UseSystemPasswordChar = false;
                kezelorow = null;
            }
            else
                textBox2.UseSystemPasswordChar = true;
            label5.Text = formszov;
            if (icon != null)
                this.Icon = icon;
            vanujceg = Bejel.Vanujceg;
            label4.Visible=vanujceg;
            comboBox1.Visible=vanujceg;
            if (vanujceg)
            {
                string ho_nap = ".01.01";
                int jelenev = DateTime.Today.Year;
                string[] itemek = new string[] { (jelenev - 1).ToString() + ho_nap, jelenev.ToString() + ho_nap, (jelenev + 1).ToString() + ho_nap };
                comboBox1.Items.AddRange(itemek);
                comboBox1.SelectedIndex = 1;
            }
 //           this.Focus();
            textBox1.Focus();
        }
开发者ID:AndrasD,项目名称:Vezir.egy,代码行数:39,代码来源:BejelformAlap.cs


示例14: FreeDrawing

        /// <summary>
        /// Default constructor of the FreeDraw form.
        /// </summary>
        public FreeDrawing(Image background, ImageLayout layout, Size imageSize)
        {
            InitializeComponent();

            panelDrawing.BackgroundImage = background;
            panelDrawing.BackgroundImageLayout = layout;

            if (layout == ImageLayout.Tile)
            {
                panelDrawing.Width = imageSize.Width;
                panelDrawing.Height = imageSize.Height;

                this.BackgroundImage = null;
            }
            else
            {
                panelDrawing.Width = background.Width;
                panelDrawing.Height = background.Height;
            }

            //TODO: Get the real values.
            this.Width = panelDrawing.Width + 40;
            this.Height = panelDrawing.Height + 66 + 20;

            if (this.Width < 400) this.Width = 400;
            if (this.Height < 215) this.Height = 215;

            panelDrawing.EraseAll();

            #region Localize Labels

            this.Text = Resources.Title_FreeDrawing;
            lblBrushSize.Text = Resources.Label_BrushSize;
            lblEraserSize.Text = Resources.Label_EraserSize;

            #endregion
        }
开发者ID:dbremner,项目名称:ScreenToGif,代码行数:40,代码来源:FreeDrawing.cs


示例15: Load

 /// <summary>
 /// Creates a <see cref="ModuleDefMD"/> instance from a memory location
 /// </summary>
 /// <param name="addr">Address of a .NET module/assembly</param>
 /// <param name="options">Module creation options or <c>null</c></param>
 /// <param name="imageLayout">Image layout of the file in memory</param>
 /// <returns>A new <see cref="ModuleDefMD"/> instance</returns>
 public static ModuleDefMD Load(IntPtr addr, ModuleCreationOptions options, ImageLayout imageLayout)
 {
     return Load(MetaDataCreator.Load(addr, imageLayout), options);
 }
开发者ID:dmirmilshteyn,项目名称:dnlib,代码行数:11,代码来源:ModuleDefMD.cs


示例16: Load

		/// <summary>
		/// Create a <see cref="DotNetFile"/> instance
		/// </summary>
		/// <param name="addr">Address of a .NET file in memory</param>
		/// <param name="imageLayout">Image layout of the file in memory</param>
		/// <returns>A new <see cref="DotNetFile"/> instance</returns>
		public static DotNetFile Load(IntPtr addr, ImageLayout imageLayout) {
			IPEImage peImage = null;
			try {
				return Load(peImage = new PEImage(addr, imageLayout, true));
			}
			catch {
				if (peImage != null)
					peImage.Dispose();
				throw;
			}
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:17,代码来源:DotNetFile.cs


示例17: ConvertImageLayout

		static IPEType ConvertImageLayout(ImageLayout imageLayout) {
			switch (imageLayout) {
			case ImageLayout.File: return FileLayout;
			case ImageLayout.Memory: return MemoryLayout;
			default: throw new ArgumentException("imageLayout");
			}
		}
开发者ID:xingkongtianyu,项目名称:Protect.NET,代码行数:7,代码来源:PEImage.cs


示例18: SetImageLayout

        private void SetImageLayout(Image image, ImageAspectFlags imageAspect, ImageLayout oldLayout, ImageLayout newLayout)
        {
            if (setupCommanBuffer == CommandBuffer.Null)
            {
                // Create command buffer
                CommandBuffer setupCommandBuffer;
                var allocateInfo = new CommandBufferAllocateInfo
                {
                    StructureType = StructureType.CommandBufferAllocateInfo,
                    CommandPool = commandPool,
                    Level = CommandBufferLevel.Primary,
                    CommandBufferCount = 1,
                };
                device.AllocateCommandBuffers(ref allocateInfo, &setupCommandBuffer);
                setupCommanBuffer = setupCommandBuffer;

                // Begin command buffer
                var inheritanceInfo = new CommandBufferInheritanceInfo { StructureType = StructureType.CommandBufferInheritanceInfo };
                var beginInfo = new CommandBufferBeginInfo
                {
                    StructureType = StructureType.CommandBufferBeginInfo,
                    InheritanceInfo = new IntPtr(&inheritanceInfo)
                };
                setupCommanBuffer.Begin(ref beginInfo);
            }

            var imageMemoryBarrier = new ImageMemoryBarrier
            {
                StructureType = StructureType.ImageMemoryBarrier,
                OldLayout = oldLayout,
                NewLayout = newLayout,
                Image = image,
                SubresourceRange = new ImageSubresourceRange(imageAspect, 0, 1, 0, 1)
            };

            switch (newLayout)
            {
                case ImageLayout.TransferDestinationOptimal:
                    imageMemoryBarrier.DestinationAccessMask = AccessFlags.TransferRead;
                    break;
                case ImageLayout.ColorAttachmentOptimal:
                    imageMemoryBarrier.DestinationAccessMask = AccessFlags.ColorAttachmentWrite;
                    break;
                case ImageLayout.DepthStencilAttachmentOptimal:
                    imageMemoryBarrier.DestinationAccessMask = AccessFlags.DepthStencilAttachmentWrite;
                    break;
                case ImageLayout.ShaderReadOnlyOptimal:
                    imageMemoryBarrier.DestinationAccessMask = AccessFlags.ShaderRead | AccessFlags.InputAttachmentRead;
                    break;
            }

            var sourceStages = PipelineStageFlags.TopOfPipe;
            var destinationStages = PipelineStageFlags.TopOfPipe;

            setupCommanBuffer.PipelineBarrier(sourceStages, destinationStages, DependencyFlags.None, 0, null, 0, null, 1, &imageMemoryBarrier);
        }
开发者ID:jwollen,项目名称:SharpVulkan,代码行数:56,代码来源:Sample.cs


示例19: PEImage

		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="data">The PE file data</param>
		/// <param name="imageLayout">Image layout</param>
		/// <param name="verify">Verify PE file data</param>
		public PEImage(byte[] data, ImageLayout imageLayout, bool verify)
			: this(new MemoryStreamCreator(data), imageLayout, verify) {
		}
开发者ID:xingkongtianyu,项目名称:Protect.NET,代码行数:9,代码来源:PEImage.cs


示例20: DrawBackground

		private void DrawBackground (Graphics g, Rectangle bounds, Image image, ImageLayout layout)
		{
			// Center and Tile don't matter if the image is larger than the control
			if (layout == ImageLayout.Center || layout == ImageLayout.Tile)
				if (image.Size.Width >= bounds.Size.Width && image.Size.Height >= bounds.Size.Height)
					layout = ImageLayout.None;
					
			switch (layout) {
				case ImageLayout.None:
					g.DrawImageUnscaledAndClipped (image, bounds);
					break;
				case ImageLayout.Tile:
					int x = 0;
					int y = 0;
					
					while (y < bounds.Height) {
						while (x < bounds.Width) {
							g.DrawImageUnscaledAndClipped (image, bounds);
							x += image.Width;	
						}
						x = 0;
						y += image.Height;
					}
					break;
				case ImageLayout.Center:
					Rectangle r = new Rectangle ((bounds.Size.Width - image.Size.Width) / 2, (bounds.Size.Height - image.Size.Height) / 2, image.Width, image.Height);
					g.DrawImageUnscaledAndClipped (image, r);
					break;
				case ImageLayout.Stretch:
					g.DrawImage (image, bounds);
					break;
				case ImageLayout.Zoom:
					if (((float)image.Height / (float)image.Width) < ((float)bounds.Height / (float)bounds.Width)) {
						Rectangle rzoom = new Rectangle (0, 0, bounds.Width, (int)((float)bounds.Width * ((float)image.Height / (float)image.Width)));
						rzoom.Y = (bounds.Height - rzoom.Height)/ 2;
						g.DrawImage (image, rzoom);
					} else {
						Rectangle rzoom = new Rectangle (0, 0, (int)((float)bounds.Height * ((float)image.Width / (float)image.Height)), bounds.Height);
						rzoom.X = (bounds.Width - rzoom.Width) / 2;
						g.DrawImage (image, rzoom);
					}
					break;
			}
		}
开发者ID:nagyist,项目名称:MonoMac.Windows.Form,代码行数:44,代码来源:ToolStripRenderer.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ImageList类代码示例发布时间:2022-05-24
下一篇:
C# ImageItem类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap