I found the following solution on the net and I tweaked it a bit to use it as functions. First I put it inside a Module and it works just fine. However when I created a Class and put it inside it, it showed up some errors. (they are in the code's comments)
Public Class MyImageClass
'function to merge 2 images into one
Public Function Merge(ByVal img1 As Image, ByVal img2 As Image) As Image 'Type 'Image' is not defined
Dim bmp As New Bitmap(Math.Max(img1.Width, img2.Width), img1.Height + img2.Height) 'Type 'Bitmap' is not defined
Dim g As Graphics = Graphics.FromImage(bmp) 'Type 'Graphics' is not defined
g.DrawImage(img1, 0, 0, img1.Width, img1.Height)
g.DrawImage(img2, 0, img1.Height, img2.Width, img2.Width)
g.Dispose()
Return bmp
End Function
End Class
I tried importing the System.Drawing namespace to this class which didn't change anything either. I've never really touched the OOP side of VB.NET before, this is my first attempt creating a class.
Can anyone please tell me what I'm missing here?

New Topic/Question
Reply



MultiQuote




|