Archive for the ‘windows forms’ Category

Debugging UI

Posted on December 15th, 2008 by aaron
Filed under .net, debugging, windows forms | 7 Comments

I’ve talked before about System.Threading.SynchronizationContext, as well as BeginInvoke/InvokedRequired/IsHandleCreated. In a multi-threaded Windows Forms application they can easily be mis-used, introducing difficult to find bugs.
One such not-so-subtle bug (application hang) is particularly nasty, and is described fairly well here. Distilled down, the application hangs, usually when the computer comes out of sleep mode, unlocks, or [...]

Windows Forms Globalization

Posted on January 8th, 2008 by aaron
Filed under Uncategorized, windows forms | 1 Comment

It’s amazing how the process of making an application localizable can be both simple and confusing at the same time. At a basic level, the Visual Studio designer makes it very easy. Set the "Localizable" property on your form to True and you’re good to go. It’s very convenient.
On the other hand, there are a [...]

Watermarked edit controls

Posted on December 1st, 2007 by aaron
Filed under programming, ui, windows forms | 7 Comments

Recently I wanted to use a WinForms TextBox with some “watermark text”, but had some trouble finding anything existing on the web. Which was surprising because of how ubiquitous they are. Turns out the terminology varies: cue, prompt, or watermark. And “watermark” is the least used.
Once I got my ducks in a row (by perusing [...]

.NET 2.0 WinForms multithreading and a few long days

Posted on May 19th, 2007 by aaron
Filed under windows forms | 7 Comments

The .NET 2.0 SynchronizationContext class and its prominant children, WindowsFormsSynchronizationContext and AspNetSynchronizationContext (no docs), are used to encapsulate the marshalling of code execution back into an appropriate thread context. In the case of the SynchronizationContext class, it simply posts a job to the ThreadPool because there really isn’t a specific threading context that requires [...]

Lock updates for a control

Posted on February 24th, 2007 by aaron
Filed under windows forms | No Comments

Raymond Chen just finished a short series on LockWindowUpdate, including when to use it and when not to. I enjoy reading Raymond’s blog for a number of reasons. His posts are short, to the point, and well written, and he discusses topics that I, as a .NET developer who is younger (read: showed [...]

Control.Trifecta: InvokeRequired, IsHandleCreated, and IsDisposed

Posted on December 15th, 2006 by aaron
Filed under windows forms | 6 Comments

Talking about Control.InvokeRequired seems like something so old, yet as I do a Google blog search for InvokeRequired I see only partial explanations and haphazard examples. I guess that’s what happens in “sample code world”, but the problem is that too many developers live in that world. (I know I’ve lived there before, and [...]

Start small and work up

Posted on September 28th, 2006 by aaron
Filed under windows forms | No Comments

I re-learned an important lesson tonight: start small and work up from there.
I was working on creating a Form that intercepts the WM_MOUSEACTIVATE message to prevent a click from stealing focus from another form (i.e. a menu, or a drop down list). In my experimentation I had a “grand” idea to create a class [...]

Hawkeye

Posted on August 31st, 2006 by aaron
Filed under tools, windows forms | No Comments

I just installed Hawkeye, and I’m pretty impressed!
What is Hawkeye? From the website:
“Hawkeye is the only .Net tool that allows you to view, edit, analyze and invoke (almost) any object from a .Net application. Whenever you try to debug, test, change or understand an application, Hawkeye can help.”
I haven’t put it through any sort of [...]

Metadata Attributes for Custom Controls

Posted on April 6th, 2006 by aaron
Filed under windows forms | No Comments

This link (here) may not be exhaustive (but it might be), but it offers a useful list of attributes that can be applied to custom controls to support better design-time interaction.
I find it useful to be able to right-click a property in the designer and select “Reset” to return it to the control’s default value. [...]

Embedding Flash in C#

Posted on March 31st, 2006 by aaron
Filed under ui, visualization, windows forms | No Comments

This is something I think you’d want to avoid like the plague, but it might have it’s benefits (as in the article–cheap charting).
Here’s the article