locked
save icon at the botton right of the origional image RRS feed

  • Question

  • i want to save icon at the botton right of the origional image using vb.net

    Monday, January 7, 2008 10:53 AM

Answers

  • Hi, Ather,

     

    Based on my understanding, you want to save an icon to the botton right of your original image, don't you?

     

    I think you can just draw the icon on your original image.

    For example,

    Code Block

            private void button1_Click(object sender, EventArgs e)

            {

                Icon icon = new Icon("E:\\autorun.ico"); //Set your icon

                Image image = Image.FromFile("D:\\sample.jpg"); //Set your image

                Size oldSize = image.Size;

                Graphics g = Graphics.FromImage(image);

                g.DrawIcon(icon, image.Width - icon.Width, image.Height - icon.Height);

                //Draw the icon on the botton right side 

            

                Graphics form = this.CreateGraphics();

                form.DrawImage(image, new Rectangle(10, 10, oldSize.Width, oldSize.Height));

                //The image may change its size during the DrawIcon process(because of resampling)

                //We should draw it to its original size.

            }

     

     

    More info

    http://msdn2.microsoft.com/en-us/library/system.drawing.graphics.drawicon.aspx

    http://msdn2.microsoft.com/en-us/library/system.drawing.graphics.drawimage.aspx

     

    Hope this helps,

    Regards

     

     

    Thursday, January 10, 2008 9:22 AM