Systray drag/drop functionality

J

Joseph De Guzman

Is it possible to make an application whose notifyicon can receive a
drag/drop messages? For instance, i would like to have certain files that
when drop to the application's notifyicon would let the app process it.

Any ideas?
 
G

Guest

I'm certainly not an expert on DnD, but the easiest way I can think I would
try to implement this is to NOT use the NotifyIcon class.

Instead, I would create my own EnhancedNotifyIcon class - extending
UserControl (which does support DnD right out of the box). Also, the
UserControl class has the mouse events plus all the DnD events that you would
have to create if you extend NotifyIcon.

Throw in a Timer event that starts once the Mouse has been captured by the
systray control, and after a predetermined amount of time display your new
EnhancedNotifyIcon object. Either add youself as a Paint() event handler or
override the method (better) so that you can present the unique look & feel
that NotifyIcon displays. For a great article on Timers go to
http://msdn.microsoft.com/msdnmag/issues/04/02/TimersinNET/default.aspx

Once your EnhancedNotifyIcon is visible you can use it within a DnD
operation. Either dispense of the ENI once some files have been dropped on
it or after a predetermined time has passed ... to emulate the regular L&F of
NotifyIcon.

I figure you'll either have to add DnD to an extended NotifyIcon class, or
you can take a class which already supports DnD and now make it look and
function like NotifyIcon. Either way, you've got some work ahead of you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top