Visual Studio

C# Snippet - Shuffling a Dictionary


Posted in:

Randomizing something can be a daunting task, especially with all the algorithms out there. However, sometimes you just need to shuffle things up, in a simple, yet effective manner. Today we are going to take a quick look at an easy and simple way to randomize a dictionary, which is most likely something that you may be using in a complex application.

Read More Icon Read More

How to Create .Net DataGridView Image Buttons


Posted in:

As you may have guessed by now, here at Switch On The Code, we are very big advocates of the .Net framework and all it has to offer. Sometimes however, things can be a little bit on the tricky side. Recently I ran into a tricky solution when I was trying to get image buttons in a DataGridView control, and in this tutorial I will go over the solution I came up with, which may just give you the edge the next time you need a fancy DataGridView.

Read More Icon Read More

Loading XML Through XNA Content Pipeline


Posted in:

XNA is quite possibly one of the most robust game programming frameworks out there. You can do nearly anything with it, and one of the reasons it is so flexible is its "Content Pipeline". But sometimes it can be a bit tricky to use this feature, requiring us to do bit more work. But in the end, it helps to use the Content Pipeline. Luckily today we are going over how to use it to load in some XML.

Read More Icon Read More

C++ & Lua - Function Arguments


Posted in:

As we have been realizing here at SOTC, using Lua with C++ is really the only way to make Lua work for you. Lua itself is really not that useful, but used in conjunction with other languages, it can be quite powerful. It past tutorials, we have gone over how to use Lua with C++. However, we have yet to go over how to pass arguments back and forth between the two. This is what we will cover today.

Read More Icon Read More

C++ & Lua - Functions


Posted in:

So in our last Lua tutorial, we went over a basic way to get information from lua and use it inside C++ code. This time, we are going to use the same principals to run a lua function from C++ and a C++ function from lua. This opens up endless possibilities for communication between the two. So, how about we get started then.

Read More Icon Read More

Lua & C++ - The Basics


Posted in:

With Lua, almost anything is possible. It is akin to JS, but in some ways it is so much more powerful. With World of Warcraft incorporating Lua right into its core, you have to wonder how powerful you can actually make it. One of the things that make Lua so powerful is its easy integration into C++ and C. With this integration, you can accomplish just about anything. Today, we are going to go through the steps to get some basic interaction between C++ and Lua.

Read More Icon Read More

Silverlight 3 - An Out Of Browser Example


Posted in:

One of the many new things available in Silverlight 3 is the ability to create out-of-browser applications. At first glance, this new out-of-browser capability sounds like it is Microsoft's duplicate of Adobe AIR, but for a number of very important aspects, the two are completely different. In fact, Silverlight's out-of-browser ability has more in common with Mozilla's Prism or Google Gears.

Read More Icon Read More

Silverlight 3 - Custom Fonts

As you go on with Silverlight, one thing sticks out if you are a designer: you have about 9 fonts to play around with. Well, with very little digging, you will find there is a way to get the fonts you want. You can easily take a font and add it to your Silverlight app, and best of all it is embedded into the app so it cannot be ripped out. Today, I will show you how to get custom fonts, not only in Visual Studio, but with Blend as well.

Read More Icon Read More

Creating MSBuild Tasks in C#


Posted in:

At some point with any decently complex project, you are going to need to start customizing your build process. Visual Studio makes this possible, and not too terribly painful, by giving developers the ability to write custom MSBuild project files. But eventually, you are going to hit the limit of what the MSBuild XML syntax can do for you - but when you reach that point, there is something else waiting - custom tasks! MSBuild gives you the ability to write custom build tasks in C# (or any .NET language), and use those tasks inside of MSBuild project files. We are going to be taking a look today at how to create these tasks and how to use them.

Read More Icon Read More

How to Minimize an Application to the Taskbar Tray in C#


Posted in:

One very convenient features in windows is the Taskbar. To make it even better, those little icons can make something so "out of the way" that you can forget what is even down there. But, sometimes you want your applications to hang down there, out of the way, doing something that requires little attention. You can even make some notification bubbles show up if you want.

Read More Icon Read More