VB Code:
Dim TheFont As Font = New Font("Times New Roman", 24, System.Drawing.GraphicsUnit.Point)
' i dont get it. Dim the font as font = New Font....
This first creates the variable TheFont, then assigns it to a new object instance.
VB Code:
TheGraphic.DrawString(TheText, TheFont, New SolidBrush(Color.FromArgb(Red, Green, Blue)), 0, 0)
' Creating a new object as a paramter of a function? never seen this before either.
Inserting the New SolidBrish(Color.FromArgb(Red, Green, Blue)) just makes it easier when you are required to supply an object as an argument to a method. That method requires a SolidBrush object, so instead of creating a seperate variable to insert into it, just pass it a new object with some simple settings. Example:
VB Code:
TheGraphic.DrawString(TheText, TheFont, New SolidBrush(Color.FromArgb(Red, Green, Blue)), 0, 0)
'or if you want to do some advanced property changes to the brush, you could do it this way.
Dim myBrush As SolidBrush = New SolidBrush(Color.FromArgb(Red, Green, Blue))
'Do all your property changes to your myBrush object here.
TheGraphic.DrawString(TheText, TheFont, myBrush, 0, 0)
So basically, if you have to pass an object into a method, but you could care less about changing that object before hand, you can just do an inline new statement like the first example. If you want to change some of the properties, and further customize the object before passing it into the method, then you should create a variable to hold the object that way you can modify it more before passing it to the method.