Tuesday, November 21, 2006

Drag and Drop Objects

Did you know drag-and-drop supports objects and not just strings? In a Winforms app load up a list box with objects. Make sure to define a ToString() method on your object, Add another control with the AllowDrop property set to True. Implement the MouseDown event on the list as:


private void listBox1_MouseDown(object sender, MouseEventArgs e)

{

if (listBox1.SelectedItem != null )

listBox1.DoDragDrop(listBox1.SelectedItem,

DragDropEffects

.Move);

}

Then implement the following 2 events on the destination control:

private void flowLayoutPanel1_DragEnter(object sender, DragEventArgs e)

{

if (e.Data.GetDataPresent(typeof(Script)))

e.Effect = DragDropEffects.Move;

}

private void flowLayoutPanel2_DragDrop(object sender, DragEventArgs e)

{

Script x = e.Data.GetData(typeof(WindowsApplication1.Script)) as Script;

//todo now do something with the Script x

}

Note that the Script object was the object that was dropped.

IE 7 Search Providers

One of the cool things on IE 7 is the Search Provider feature. It's a quick search window in the upper right corner. You can add search providers from a Microsoft list (a web page) or create your own by specifying the URL (on that same web page). For instance, I've added Google, Wikipedia, and my own for theFreeDictionary. I simply specified http://www.thefreedictionary.com/TEST as the URL, and now a dictionary is a click away.

Saturday, November 18, 2006

Zune - Searching for device ...

I love my Dell 400sc. It's a ridiculously cheap, was sold as a unloaded server system, and is quiet as a church mouse. However, I spent 3 hours trying to load the Zune software and get it to recognize my Zune device. I almost went to metal. I did 2 system restores, Intel chipset driver upgrades, and 3 Zune software loads. I even called the Zune hotline from Zune.net (they answered in a heartbeat on day 2 of launch - nice!). I knew my 400sc had suspicious USB ports. Some other things didn't work. So what solved it?

Solution: In Device Manager, update each USB port's driver by having the Device Manager search the original 400sc install disk.

Friday, November 17, 2006

I got my Zune


"I want to spend $250 guilt free bucks on a Zune", I told my wife.
"Why are you telling me?", she said.
"Because; You're the guilt part."
Oh yea - It's brown. Chris Sells made a comment on Hanselminutes like, "I don't get it. Why brown?". I lol-ed. That pretty much sealed it for me.