0

I have 3 buttons (in WinForm) Cut/Copy/Paste.

I need to bind the enabled and disabled state for each of them in dependence if the Clipboard contains or not "MyObject"s list.

How can I automatize that?

serhio
  • 28,010
  • 62
  • 221
  • 374

1 Answers1

0

If you are asking how to know when the Clipboard has changed, a great wrapper for this is answered in: Clipboard event C#

Handle the ClipboardChanged event and process accordingly.

Community
  • 1
  • 1
John Arlen
  • 6,539
  • 2
  • 33
  • 42
  • It works only on the first opened form... say if I have MyForm1 and myForm2, so I open myForm1, then MyForm2, the event ClipboardChanged will be raised only in MyForm1 – serhio Dec 05 '11 at 16:26
  • If you use the control-based example, it must be added to each form and the event registered. This works perfectly fine in tests I tried. – John Arlen Dec 06 '11 at 00:01
  • I am talking about "same" form (MyForm), opened multiple times. – serhio Dec 06 '11 at 11:01
  • Win32 doesn't care what the base .NET class is - works just fine. Pull the relevant code from the linked ClipboardMonitor class to not be a control. Just use SetClipboardViewer and others directly. – John Arlen Dec 06 '11 at 16:27