Add Shaded Rows to ListView Details View

1 Comment »

Sometimes it can be challenging to read the Details view in a ListView, especially if the rows are long.  This article shows how to add shading to every second row to make a ListView easier to read.

ListView Shaded Rows

Read the rest of this entry »

Popularity: 29% [?]

Show Continuous Progress with .NET ProgressBar and MarqueeAnimationSpeed

1 Comment »

For some operations such as logging on to a web site or downloading a web page, you may not know how long it will take the operation to finish.  So instead of showing a progress bar with a specified percent complete, you can set the .NET ProgressBar to cycle continuously.

ProgressBarMarquee

Read the rest of this entry »

Popularity: 42% [?]

Manipulating Controls Across Threads

No Comments »

Methods that affect a Windows Forms control can be executed only on the thread that created the control. .NET does not permit directly manipulating controls across threads. The Visual Studio compiler under .NET 2.0 will mark these attempts as errors. .NET 1.1 will allow them, but these will often result in unexpected behavior like incorrectly-painted controls.

Read the rest of this entry »

Popularity: 52% [?]

Convert Handle to Form, and Vice Versa

No Comments »

This is one of those things that's obvious once you know it.  When dealing with COM, there is often a need to convert a WinForms Form object to an IntPtr handle, and vice versa.

Read the rest of this entry »

Popularity: 43% [?]

NotifyIcon.ShowBalloonTip Issues

5 Comments »

NotifyIcon is .NET's version of the system tray icon, those little icons that appear next to the clock in the Windows Start bar.  .NET 2.0 added the ability to display a pop-up balloon tip pointing at a tray icon.  However, this capability doesn't always work as you would expect.

Read the rest of this entry »

Popularity: 72% [?]

See All Key Events with KeyPreview

No Comments »

Handling keyboard shortcuts in your application can sometimes get a bit tricky.  Consider the standard Ctrl+C shortcut, which every application should support as a "Copy" to clipboard command.  When you users type in textboxes in your application's form, they will expect that Ctrl+C will copy the selected text.  But this feature is not supported by default; you have to explicitly write some code.

Read the rest of this entry »

Popularity: 37% [?]

Enter Key in DataGridView

1 Comment »

The DataGridView is a terrific control built into .NET that provides a customizable table for entering and displaying data. If you provide the DataGridView in your software as a means for the user to enter multiple rows of data, you may wish to redefine the default behavior of the Enter key. Read the rest of this entry »

Popularity: 28% [?]

Hide Form from Alt+Tab

1 Comment »

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 »

Popularity: 38% [?]

Console Output from a WinForms Application

5 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 »

Popularity: 36% [?]

Embedded Image Resources

1 Comment »

If you use images in a .NET application, chances are you will find it more convenient to embed those images as resources in your project, rather than leaving them as separate files and trying to locate and load the images from disk when the application runs.

Read the rest of this entry »

Popularity: 34% [?]

keep looking »
  • Featured Articles

  • Recent Posts

  • Search C# 411

     
  • Categories

  • Archives

  • Tags