Reputation: 271
Say I have a bitmap that is 600 by 600 and I want to add an image to that bitmap at a location of x and y. How would I do that? For example: I have a bitmap that is 600 by 600 and I want to add an image that is 20 by 20 to that bitmap at x of 0 and y of 0? Is there an easy way to do this, like a premade function? Thanks. :)
Upvotes: 0
Views: 4862
Reputation: 71
Its rather easy. There is a Graphics Class at your disposal that you can use to do exactly what you want. You may want to import "System.Drawing" its already Referenced by default on a VB.net project.
To do what you want you would have to do the following, using this class:
Using GraphicsObject as Graphics = Graphics.FromImage([Original Bitmap])
GraphicsObject.Drawimage([Bitmap to Draw], X, Y)
'X, Y are the coordinates (inside the bitmap we're drawing into), of where the new bitmap will be drawn
' The bitmap will be drawn with its original Width and Height
End Using
The Graphics.DrawImage method is overloaded and you can choose to draw images in many different ways given the parameters you choose to provide to it.
Hope that this helps, have fun with it.
Upvotes: 1