Here is a collection of hard-to-find C# source code and tutorials. All the C# Programming articles
include either code snippets or fully commented source code.
User articles are added based upon quality standards. All outgoing links and user source code are the responsibility of the reader.
All articles and source code are under the Visual C# Kicks license agreement
Vista-Style Task Dialog New
Integrate the visually-appealing TaskDialog Vista control into your C# applications, which works even on old versions of Windows.
Splash Screen New
Add a splash screen to C# applications based on any kind of image, shadows and transparency fully supported.
Remove Windows Form Titlebar New
Create a Windows Form's with no titlebar with simple C# code. Apply three different views to your titlebar-less Forms.
Custom Control Properties
Enhance your custom user controls by customizing the way the designer displays the custom properties of the control.
Animated Form
Create a Windows Form with a smooth constant animation across different systems.
Fading Form
Create a Windows Form that fades in when the mouse hovers over it and fades out when the cursor leaves its bounds.
Angle and Altitude Selector - Photoshop Style Custom Controls
Professional-looking C# custom controls with the look and functionaliy of Photoshop's angle selectors
Click-and-Drag Form
By using various Form events (OnMouseDown and OnMouseMove) and some adding and subtracting, we can create the same effect of a windows titlebar.
Drag-and-Drop Files
The program demonstrates the ability to take a file or a folder that was dragged to the Form and obtain the location. For dropped folders it can also read the content and obtain its file locations.
Screen Lock
In the internet you will find some fancy and expensive programs that can lock down your computer when you are away. In this project we will explore some fun brute-force techniques to create our very own screen locker application.
Custom Shape Form - Transperancy
Create Windows Forms that adapt to the shape of an imagine using a simple Form property. Custom shaped forms can be used to things such as creative splash screens.
Custom Shape Form - Region
Create custom shaped forms but with the use of Regions. Regions allows for finer tuned behavior and can yield more stable results.
Number Input Only Textbox
Luckily using built-in c# events we can create a textbox that accepts only keystrokes from numbers. This behavior is extremely helpful for reducing the amount of error-checking when the input has to be a number. It also makes an application more user friendly.
Degrees and Radians
The .Net Framework's Math class has useful functions like the trig functions Sin, Cos, Tan. However the fuctions take in radian angles. So what can we do when we have an angle in degrees?
True Random Number Generator
Enhance your C# applications by giving them to ability to generate truly random numbers.
Encryptor and Decryptor Class
Use this class of static methods to quickly encrypt and decrypt strings or directly a byte array. Encryption and decryption works based on a password.
Improved 3D Drawing New
Witness an improved 3D graphics GDI+ application. Built upon the original Euler 3D Rotation article, learn how to get around the Gimbal Lock problem and learn how to shade in 3D shapes in C#.
Four-Point Image Distortion
Distort a bitmap into any quadrilateral shape simply by specfiying the distinct locations of each of the corner points. All done in pure C# code.
Fast Bitmap Image Processing
Improve upon the .Net Framework's GetPixel and SetPixel GDI+ functions to increase the speed of your image processing applications exponentially.
Display GIF Animations
Witness two simple methods to display animated images using only C# functions, accomplishing the task automatically or manually by accessing the animation frames.
Page 1 | Page 2
Euler 3D Rotation and GDI+ 3D Drawing
When it comes to drawing in 3D space, GDI+ comes with no support. This program shows how to handle 3D points and convert them to 2D points to plot using GDI+. As an example we create a cube that can be rotated in any of the three axis (X, Y, Z) using Euler's matrix formulas.
Capture the Screen
To capture the screen with a program we could: use the Prnt Scrn key and then retrieve the image from memory, or we can use a combination of GDI and GDI+ in order to leave the clipboard intact. This program shows how to do so using the second method.
Sorting 2D Points
Sorting points can be an extremely useful algorithm. Image processing algorithms often if not always require points to have a certain order, this class will use the IComparer interface to sort points according to either the X or Y values.
URL Checker
Access a URL address with a simple C# application to determine the validity of a website link.
Download File from the Internet - FTP
Enable your C# applications to connect to the internet to download files and webpages from an FTP Server with nothing but pure C#.Net code.
Download File from the Internet - HTTP
Enable your C# applications to connect to the internet to download files and webpages using nothing but .Net Framework classes.
Randomize Array List
Discover how to randomize a list of items. Generate a new list where items are placed in random order.
Convert Bytes to File-Size
Derive a file's filesize from counting the number of bytes using simple C# classes.
The C# Data Structures
Explore the various built-in C# data structures and their applications in this three part article.
Page 1 | Page 2 | Page 3
String Processing Functions Library
A huge list of string processing functions that expand upon the built-in .Net Framework string functions.
Uploading a File with FTP
Easily upload a file through FTP using pure C#.
Scanning Through a Hard Drive
Scan through the files and directories of any drive using recursion. Additionally learn how to add a path to a TreeView control with the proper parent and child nodes.
Read Text File
Find out how to read a text file in C# with the System.IO namespace. Read it all at once or by lines, both methods are explained.
Ajax Control Toolkit
Great place to start in expanding your collection of AJAX-enabled user controls.
MessageBox
How to display a message box in ASP.Net using client-side code.
Obfuscation New
Although C# applictions are vulnerable to code decompilation, there are methods to protect against it, one of which is code obfuscation.
Upgrading to Visual Studio New
Despite the potential of the Visual Studio Express editions, there can be numerous reasons to upgrade to the full version of Visual Studio, even for small-to-medium sized projects.
Using Professional Icons
Raise the presentation quality of your finished applications by adding icons. Read about tips for designing your own or for purchasing professional application icons.
C# - Programming Language of Choice
Explore the advantages of the C#.Net programming language as a development platform for small and big applications.
6 Ways to Optimize C# Code
Discover five simple ways to improve the readability and performance of C# source code and applications.
Application Optimizing Utility
Test C# code segments against each other to compare their performance speed.
Assembly Custom Reference Path
Find out how to specify to a C# application on what subfolders to locate C# libraries that contain essential execution code.
Unique Hardware ID
Obtaining a true hardware serial from a user computer can be tricky business. Luckily the .Net Framework provides the means to obtain a reliable ID which can in turn be used in licensing processes.
The Link Cloaker
Let's say you have a giant url and you need to shorten it. A short url is just more professional and attractive. Savvy online affiliates know the trick is to create a redirection page. The link cloaker uses some very simple C# methods to automate creating cloaked pages
Time Calculator
This program finds the sum and differences of times by converting to seconds, doing the operations, and converting back to a 00:00 formatted time.
Detect .Net Framework
With the reliance of C#.Net on the .Net Framework, the ability to detect if the .Net Framework is installed on a computer can be quite useful. Check out a simple way to do it.
Compress and Decompress Bytes Without External Libraries
Luckily for .Net programmers, the .Net Framework comes with basic built-in compression support. What does this mean? It means not only can we utilize our own compressed files, but we can also compress bytes in memory. This class has two static functions, one for compression and one for decompress. Both are quite fast. Additionally an example program is included.
Backlashes (\)
So here's a small tip. Let's say you have a path, "C:\Program Files\Magical Program", and you need to handle that path as a string. If you try to directly assign it to a string variable, you are going to get errors. There are two ways to properly do this:
string magicString = @"C:\Program Files\Magical Program";
or
string magicString = "C:\\Program Files\\Magical Program";
Get Real Time From a Web Server
Sometimes programs need to able to check what time or day it is. Asking Windows for the information works but is unreliable. The Windows Clock is subject to change from the user and if your program is a demo that must expire within a certain time period, getting the correct date is essential. A solution then is to ask one of the many time servers on the internet for the date and time. This program comes with a list of servers and cycles through them until it gets a date that makes sense.
All C# Articles and source code are under the Visual C# Kicks license agreement