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();
     }
 }
Example #2
0
    ///////////////////////////////////////////////////////////////////////////////
    // 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)
    {
    }
        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;
        }
        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;
       }
 public static PictureBox layout(this PictureBox pictureBox, ImageLayout imageLayout)
 {
     return pictureBox.invokeOnThread(
         () =>
             {
                 pictureBox.BackgroundImageLayout = imageLayout;
                 return pictureBox;
             });
 }
Example #6
0
 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);
 }
 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;
 }
Example #8
0
 /// <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;
     }
 }
        /// <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;
        }
Example #10
0
 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);
 }
Example #11
0
 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);
 }
        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;
                }
            }
        }
Example #13
0
        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();
        }
Example #14
0
        /// <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
        }
Example #15
0
 /// <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);
 }
Example #16
0
 /// <summary>
 /// Creates a <see cref="ModuleDefMD"/> instance from a memory location
 /// </summary>
 /// <param name="addr">Address of a .NET module/assembly</param>
 /// <param name="context">Module context 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, ModuleContext context, ImageLayout imageLayout)
 {
     return Load(MetaDataCreator.Load(addr, imageLayout), new ModuleCreationOptions(context));
 }
Example #17
0
 /// <summary>
 /// Creates a <see cref="ModuleDefMD"/> instance from a reflection module
 /// </summary>
 /// <param name="mod">An existing reflection module</param>
 /// <param name="options">Module creation options or <c>null</c></param>
 /// <param name="imageLayout">Image layout of the module in memory</param>
 /// <returns>A new <see cref="ModuleDefMD"/> instance</returns>
 public static ModuleDefMD Load(System.Reflection.Module mod, ModuleCreationOptions options, ImageLayout imageLayout)
 {
     IntPtr addr = Marshal.GetHINSTANCE(mod);
     if (addr == new IntPtr(-1))
         throw new InvalidOperationException(string.Format("Module {0} has no HINSTANCE", mod));
     return Load(addr, options, imageLayout);
 }
Example #18
0
 /// <summary>
 /// Creates a <see cref="ModuleDefMD"/> instance from a reflection module
 /// </summary>
 /// <param name="mod">An existing reflection module</param>
 /// <param name="context">Module context or <c>null</c></param>
 /// <param name="imageLayout">Image layout of the module in memory</param>
 /// <returns>A new <see cref="ModuleDefMD"/> instance</returns>
 public static ModuleDefMD Load(System.Reflection.Module mod, ModuleContext context, ImageLayout imageLayout)
 {
     return Load(mod, new ModuleCreationOptions(context), imageLayout);
 }
Example #19
0
 protected eStyleBackgroundImage GetBackgroundImagePosition(ImageLayout layout)
 {
     if (layout == ImageLayout.Center)
         return eStyleBackgroundImage.Center;
     else if (layout == ImageLayout.None)
         return eStyleBackgroundImage.TopLeft;
     else if (layout == ImageLayout.Stretch)
         return eStyleBackgroundImage.Stretch;
     else if (layout == ImageLayout.Tile)
         return eStyleBackgroundImage.Tile;
     else if (layout == ImageLayout.Zoom)
         return eStyleBackgroundImage.Zoom;
     return eStyleBackgroundImage.TopLeft;
 }
		/// <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;
			}
		}
Example #21
0
		static IPEType ConvertImageLayout(ImageLayout imageLayout) {
			switch (imageLayout) {
			case ImageLayout.File: return FileLayout;
			case ImageLayout.Memory: return MemoryLayout;
			default: throw new ArgumentException("imageLayout");
			}
		}
Example #22
0
 public ImageMemoryBarrier(Image image, ImageLayout oldLayout, ImageLayout newLayout, AccessFlags sourceAccesMask, AccessFlags destinationAccessMask, ImageSubresourceRange subresourceRange)
     : this(image, oldLayout, newLayout, sourceAccesMask, destinationAccessMask, Vulkan.QueueFamilyIgnored, Vulkan.QueueFamilyIgnored, subresourceRange)
 {
 }
Example #23
0
        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);
        }
Example #24
0
		/// <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) {
		}
		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;
			}
		}
Example #26
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="baseAddr">Address of PE image</param>
		/// <param name="length">Length of PE image</param>
		/// <param name="imageLayout">Image layout</param>
		/// <param name="verify">Verify PE file data</param>
		public PEImage(IntPtr baseAddr, long length, ImageLayout imageLayout, bool verify)
			: this(new UnmanagedMemoryStreamCreator(baseAddr, length), imageLayout, verify) {
		}
Example #27
0
 public BejelformAlap (Bejelentkezo bejel, Bitmap bitmap, ImageLayout layout, string formszov,Icon icon)
 {
     BejelformAlapInit(bejel, bitmap, layout, formszov, icon);
 }
Example #28
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="baseAddr">Address of PE image</param>
		/// <param name="imageLayout">Image layout</param>
		/// <param name="verify">Verify PE file data</param>
		public PEImage(IntPtr baseAddr, ImageLayout imageLayout, bool verify)
			: this(new UnmanagedMemoryStreamCreator(baseAddr, 0x10000), imageLayout, verify) {
			try {
				((UnmanagedMemoryStreamCreator)imageStreamCreator).Length = peInfo.GetImageSize();
				ResetReader();
			}
			catch {
				Dispose();
				throw;
			}
		}
		protected ToolStripItem (string text, Image image, EventHandler onClick, string name)
		{
			this.alignment = ToolStripItemAlignment.Left;
			this.anchor = AnchorStyles.Left | AnchorStyles.Top;
			this.auto_size = true;
			this.auto_tool_tip = this.DefaultAutoToolTip;
			this.available = true;
			this.back_color = Color.Empty;
			this.background_image_layout = ImageLayout.Tile;
			this.can_select = true;
			this.display_style = this.DefaultDisplayStyle;
			this.dock = DockStyle.None;
			this.enabled = true;
			this.fore_color = Color.Empty;
			this.image = image;
			this.image_align = ContentAlignment.MiddleCenter;
			this.image_index = -1;
			this.image_key = string.Empty;
			this.image_scaling = ToolStripItemImageScaling.SizeToFit;
			this.image_transparent_color = Color.Empty;
			this.margin = this.DefaultMargin;
			this.merge_action = MergeAction.Append;
			this.merge_index = -1;
			this.name = name;
			this.overflow = ToolStripItemOverflow.AsNeeded;
			this.padding = this.DefaultPadding;
			this.placement = ToolStripItemPlacement.None;
			this.right_to_left = RightToLeft.Inherit;
			this.bounds.Size = this.DefaultSize;
			this.text = text;
			this.text_align = ContentAlignment.MiddleCenter;
			this.text_direction = DefaultTextDirection;
			this.text_image_relation = TextImageRelation.ImageBeforeText;
			this.visible = true;

			this.Click += onClick;
			OnLayout (new LayoutEventArgs (null, string.Empty));
		}
		/// <summary>
		/// Creates a <see cref="ModuleDefMD"/> instance from a memory location
		/// </summary>
		/// <param name="addr">Address of a .NET module/assembly</param>
		/// <param name="context">Module context 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, ModuleContext context, ImageLayout imageLayout) {
			DotNetFile dnFile = null;
			try {
				return Load(dnFile = DotNetFile.Load(addr, imageLayout), context);
			}
			catch {
				if (dnFile != null)
					dnFile.Dispose();
				throw;
			}
		}