Visual Studio Custom Skins (Without Paying)

Filed Under (Code, Learn C#) by Mystalia on 27-03-2009

Tagged Under : , , , , , , , ,

It’s a nightmare to get custom skins without paying an arm and a leg for such a simple part of your program. Some companys ask for hundreds of dollars for simple .NET classes, it’s crazy, anyway, here’s a workaround that is 100% legal and 100% free.

This screenshot is VERY easy to achieve, no fancy software just 1 class, one dll, one msstyle and a few lines of code.

Below are the class file and dll, and i’ve thrown in a couple of msstyles to get you going, theres plenty more on the internet, theres a few on SkinBase.org. We are using USkin (Homepage) its the classes that do all the work, the documentation and examples are terrible but after trial and error I have figured it out and will explain in this article.

Download Uskin easy pack here

Right click the solution explorer, add an existing item (“USkinSDK.cs” and “USkin.dll”).
Make sure the dll properties are set to “Content” and “Copy Always”.
Make sure the class properties are set to “Compile” and “Never Copy”.

The code is simple.

using USkin; // declare it.

        private void Form1_Load(object sender, EventArgs e)
        {
            Size presize = this.Size; // Get the correct form size before the GUI mucks it up.
            USkinSDK.USkinInit("", "", "GUI.msstyles"); // Replace the text accordingly with your msstyles file.
            USkinSDK.USkinLoadSkin("GUI.msstyles"); // And again here.
            this.Size = presize; // Re-establish the form size.
        }

Simple and effective to make your applications look more professional. I will note however that you should get prior permission from the skin creator before using your application commercially, or just create your own, that’s easy too.

Hope this helps!

Basic C#.NET Syntax

Filed Under (Learn C#) by Mystalia on 15-03-2009

Start a new windows form application like in the previous tutorial.

Drag a new button in the middle and set the text to “Off”.
Now over in the Solution explorer, right click “Form1.cs” and click View Code.

You will see a bunch of Statements, and these are lines of code. Each statement as you can see, finish with a semi-colon (;).
The code is organised into .NET Libraries, namespaces, classes and methods or functions.

The using statements at the top are .net libraries that are included, for this tutorial we won’t need any more then this, but later on we can go into special libraries to include.

A namespace is a collection of classes.
A class is a collection of methods and functions.
A method or function simply completes a task.

The advantage of being a visual studio is that we don’t have to program any user interface, we can just paint it on. At the top there are tabs (Form1.cs, start page, Form1.cs [Design]). Click the Design tab to return to the design view for this application.

Double click the button you made earlier and notice it automatically creates a new function for this button.

private means that the code can only be accessed in the current class.
void means the code will not return anything but only complete a task.
button1_Click is just a name given to associate the button to that task.

Inside the brackets below ({ and }) we will perform a task when the user clicks the button. Type “button1” and then press put a full stop, notice a window appears giving you suggested options for the button. Type “Text” (case sensative) and then press Space. We will now set the button text to something else by pressing the Equals button and then in quote marks type “Goodbye” and finish the statement with a semi-colon.

button1.Text = "Goodbye";

Now click the test button and then your new button and see what happens!

In the next tutorial we will see how statements can contain other statements.

Visual C#.NET – Setting Yourself Up!

Filed Under (Learn C#) by Mystalia on 15-03-2009

This is a tutorial for those who know a little about the concepts of programming and want to design windows applications in C#.

In this tutorial we will:

  1. Learn about what the .NET framework is and why C# is worth the effort.
  2. Download and Setup the software needed to make C# applications.
  3. Get used to the Interface.

.NET Framework
The .NET Framework is needed to run any C#.NET application, fortunately anyone with vista should already have it installed. Some xp systems don’t have it and it can be downloaded and installed here. It is basically a library of code that exists so you don’t have to manually write it all yourself.

C#.NET
C#.net is comparable to PHP in style, if you know PHP then you will get on well with C#. If you want to program games, C# is a really easy way to go about it because of microsofts XNA Framework, which is a library full of game related code. C# is great to learn and you can get results quickly without too much effort.

Visual Studio 2008 Express Edition
This version of visual studio is absolutely free and downloadable from here. There are different types, so make sure you get Visual C#.NET 2008. You will also obviously need the .NET Framework installed if you don’t have it already.

The Interface
When you start up Visual C# 2008 express you will be greeted with the start page from which you can start a new project or continue one that you already have on the go. If it is your first time, go to File -> New Project. Select Windows Forms Application and name it Test, then click OK.

After it has loaded up, you will see a blank windows form and a bunch of tools down the left hand side. Over on the right you have the solution explorer and the properties menu. At the bottom there should be an error list (for debugging). Don’t worry about any of this right now, they will be covered later on.

Click the Button control in the Toolbox and click and drag a button on the windows form. Notice the Properties menu is now full of options. Change the Text option to “Hello” and then press Enter. Notice the text on the button has changed!

At the top there is a Green Triangle on its side, like a play button. Click this and test the application. Pretty easy right? Play with other controls and options and read the tooltips that appear when you hover your mouse over options and tools etc.

The next tutorial will cover some basic C# Syntax.