Hide Form from Alt+Tab

33 Comments »

When you show a .NET Form, by default the form will appear in the Windows Start bar and in the list of open windows shown when the user presses Alt+Tab.

Read the rest of this entry »

.NET Assembly FAQ – Part 4 – Global Assembly Cache

29 Comments »

This multi-part article answers common questions about assemblies, the basic building blocks of .NET applications. This Part 4 covers shared assemblies and the Global Assembly Cache.

Read the rest of this entry »

List Drives and Volumes from .NET

2 Comments »

The .NET Framework v2.0 did a nice job filling many holes in the System.IO namespace, especially when it comes to managing the file system. One such addition is the DriveInfo class, which enables you to determine what drives are available, their type, capacity and available free space.

Read the rest of this entry »

Determine if a Loaded .NET Assembly is Signed

9 Comments »

A .NET assembly is “signed” if the developer compiled the assembly with the private key of a digital signature. When the system later loads the assembly, it verifies the assembly with the corresponding public key. Occasionally you may need to determine whether an assembly you have loaded has been signed.

Read the rest of this entry »

Lighten and Darken Colors in .NET

7 Comments »

There is a very handy .NET class called ControlPaint in the System.Windows.Forms namespace that enables you to draw your own controls and control elements using the standard Windows style and theme. Buried in this rich class are four methods that enable you to lighten and darken colors:

Read the rest of this entry »

C# GetPixel and SetPixel

13 Comments »

It’s hard to believe the comprehensive .NET framework would omit such obvious functions as GetPixel and SetPixel from its Drawing library. Fortunately, we can access the GDI functions using Interop, as shown below. Notice the conversion required between the COLORREF integer used by the GDI methods and the Color structure used by our static .NET methods.

Read the rest of this entry »

.NET Assembly FAQ – Part 3 – Strong Names and Signing

39 Comments »

This multi-part article answers common questions about assemblies, the basic building blocks of .NET applications. This Part 3 discusses assembly security using strong names, signing and public-private key pairs.

Read the rest of this entry »

.NET Assembly FAQ – Part 2 – Attributes

1 Comment »

This multi-part article answers common questions about assemblies, the basic building blocks of .NET applications. This Part 2 discusses assembly attributes.

Read the rest of this entry »

C# Search/Replace in Files

35 Comments »

Sometimes you need a quick & easy way to search and replace text in a file. The following code shows how it can be done using the static methods on the Regex regular expression class. Because this sample loads the entire file contents in memory, is not appropriate for very large files.

Read the rest of this entry »

Console Output from a WinForms Application

45 Comments »

You may wish to enable your WinForms application to run from a console window or command line. And when it does, you probably want to send output messages to the console window that launched your WinForms application.

Unfortunately Console.WriteLine()–the standard method of writing to the console window–by default will not work from a WinForms application. That’s because the console window that launched your WinForms application belongs to the cmd.exe process, which is separate from your WinForms application process.

Read the rest of this entry »

keep looking »