C# Copy and paste overrides

Started by
0 comments, last by benryves 13 years, 6 months ago
Hi all,

I am developing a level editor in C# and as such I want to have copy and paste functionality when focused on the DirectX window. The focus part is easy I know when the window has focus.

The trouble i'm having is that, when the Ctrl+C and Ctrl+V shortcuts are added to my program it seems to override their default functions to copy and paste for such things as textboxes within the form etc. I basically want to be able to decide whether or not to use the default copy and paste functions or to use my special copy method for all my DirectX window objects like geometry etc when the window has focus.

Im guessing there could be some base override call to be made for the default functionality, im just struggling to find out where / what it might be. So if anyone can shed some light on this, I'd be very thankful.

Cheers.
Advertisement
One way is to disable the menu item (set its Enabled property to false) until the DirectX window is focussed, at which point you enable the menu item. When the DirectX window loses focus, disable the menu item again.

An alternative is to not assign a shortcut to that menu at all, but to set ShortcutKeyDisplayString. You would then have to override IsInputKey and OnKeyDown in the form to handle the shortcut key presses yourself (only copying and marking the event as Handled if the DirectX window is in focus at the time).

[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]

This topic is closed to new replies.

Advertisement