Posts: 5
Threads: 3
Joined: Jun 2013
Reputation:
0
Hey there i'm a an intermediate to almost expert programmer for vb.net but can't seem to get one thing down. I want to create a custom theme from code by adding a class. I have seen other you tubers do it but only get so far and stop uploading more vids. Please help
Cecilio
Posts: 1,006
Threads: 111
Joined: Jul 2010
Reputation:
1
By custom theme do you mean a custom theme for the Visual Studio IDE or for your application? If it's for your application, do you want to use custom images, etc, or simply custom colors?
Posts: 5
Threads: 3
Joined: Jun 2013
Reputation:
0
Thanks for replying and its for your application using code to make simple gradients and other effects
Posts: 1,006
Threads: 111
Joined: Jul 2010
Reputation:
1
Well for something like that you are going to use the VB.NET Graphics object in order to actually draw things directly onto your forms and panels. So, for example, if you wanted to draw a red rectangle on a form, you would need to get a graphics object in order to draw the rectangle. This can be done in some way like this:
[code2=vbnet]Dim g As Graphics = Me.CreateGraphics()
'We can now use "g" to draw anything
'Let's first set everything to red
Dim myBrush As New System.Drawing.SolidBrush(System.Drawing.Color.Red)
g.FillRectangle(myBrush, New Rectangle(0, 0, 200, 300))
myBrush.Dispose()
g.Dispose()[/code2]
The above code creates a graphics object that gets its ability to draw directly from the form, meaning that it will draw directly onto the form. We then set its color to red using a "SolidBrush" object and are able to fill a rectangle by calling the "Fill Rectangle" method. In order to create some sort of gradient effect, this can be done in changing colors while moving down the form using a For Loop or something to the same effect.