BP Forums
Custom Theme - Printable Version

+- BP Forums (https://bpforums.info)
+-- Forum: Archived Forums (https://bpforums.info/forumdisplay.php?fid=55)
+--- Forum: Archived Forums (https://bpforums.info/forumdisplay.php?fid=56)
+---- Forum: VB.NET (Visual Basic 2010/2008) (https://bpforums.info/forumdisplay.php?fid=8)
+----- Forum: Programming Help (https://bpforums.info/forumdisplay.php?fid=9)
+----- Thread: Custom Theme (/showthread.php?tid=791)



Custom Theme - Cecilio - 06-13-2013

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


Re: Custom Theme - brandonio21 - 06-19-2013

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?


Re: Custom Theme - Cecilio - 06-23-2013

Thanks for replying and its for your application using code to make simple gradients and other effects


Re: Custom Theme - brandonio21 - 07-05-2013

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.