IanG on Tap

Ian Griffiths in Weblog Form (RSS 2.0)

Blog Navigation

August (2014)

(1 item)

July (2014)

(5 items)

April (2014)

(1 item)

March (2014)

(1 item)

January (2014)

(2 items)

November (2013)

(2 items)

July (2013)

(4 items)

April (2013)

(1 item)

February (2013)

(6 items)

September (2011)

(2 items)

November (2010)

(4 items)

September (2010)

(1 item)

August (2010)

(4 items)

July (2010)

(2 items)

September (2009)

(1 item)

June (2009)

(1 item)

April (2009)

(1 item)

November (2008)

(1 item)

October (2008)

(1 item)

September (2008)

(1 item)

July (2008)

(1 item)

June (2008)

(1 item)

May (2008)

(2 items)

April (2008)

(2 items)

March (2008)

(5 items)

January (2008)

(3 items)

December (2007)

(1 item)

November (2007)

(1 item)

October (2007)

(1 item)

September (2007)

(3 items)

August (2007)

(1 item)

July (2007)

(1 item)

June (2007)

(2 items)

May (2007)

(8 items)

April (2007)

(2 items)

March (2007)

(7 items)

February (2007)

(2 items)

January (2007)

(2 items)

November (2006)

(1 item)

October (2006)

(2 items)

September (2006)

(1 item)

June (2006)

(2 items)

May (2006)

(4 items)

April (2006)

(1 item)

March (2006)

(5 items)

January (2006)

(1 item)

December (2005)

(3 items)

November (2005)

(2 items)

October (2005)

(2 items)

September (2005)

(8 items)

August (2005)

(7 items)

June (2005)

(3 items)

May (2005)

(7 items)

April (2005)

(6 items)

March (2005)

(1 item)

February (2005)

(2 items)

January (2005)

(5 items)

December (2004)

(5 items)

November (2004)

(7 items)

October (2004)

(3 items)

September (2004)

(7 items)

August (2004)

(16 items)

July (2004)

(10 items)

June (2004)

(27 items)

May (2004)

(15 items)

April (2004)

(15 items)

March (2004)

(13 items)

February (2004)

(16 items)

January (2004)

(15 items)

Blog Home

RSS 2.0

Writing

Programming C# 5.0

Programming WPF

Other Sites

Interact Software

XOR Still Considered Harmful

Friday 19 March, 2004, 12:55 PM

I've been meaning to write about this for ages. I've had a web browser window open on a page relating to this for well over a month now to remind me. I have to log out of my machine now, which has finally galvanised me into action. (Although that's not the only factor. Mozilla Firebird has been using more and more memory over the month or so it has kept that window open, which has made the need to blog about this so I can finally restart Firebird increasingly pressing. 150MB for one browser window can't be right...)

About a month and a half ago, I wrote an entry on drawing rubber band selection outlines in Avalon. Shortly after this, I got an email from Ethan Brown. He illustrates how to do resizable panels in Windows Forms here. The source is available at GotDotNet.

One of the interesting things about this example is that it illustrates exactly some of the problems with XOR that I discussed in my rubber banding blog entry. For example, if you Alt-Tab away from Ethan's demo application half way through a drag operation, it leaves some crud on the screen. (A direct result of the XOR-based drawing he is using for the drag outline.) Also, try opening the Windows Task Manager, making sure that the Always On Top option is enabled, and switch to one of the tabs that has moving stuff (e.g. the Performance tab with its CPU and memory usage graphs). Move the task manager partially over your application and then try dragging the rectangle around so that it moves over the task manager. You'll end up with cruft being left on the task manager window when it repaints. This illustrates that not only can you mess up your own window by using XOR, you can mess up other windows too! Popup windows showing up during a draw would also illustrate the same kinds of problems

But as Ethan said to me, he wasn't really aiming for production quality here - he wanted it to be good enough most of the time. And in many cases that's just fine. So if that describes your requirements, you may find the sample useful.

(And now I'm wondering why on earth it was it took me so long to get around to writing about this...)

Copyright © 2002-2013, Interact Software Ltd. Content by Ian Griffiths. Please direct all Web site inquiries to webmaster@interact-sw.co.uk