Sign in to follow this  

C# Copy and paste overrides

Recommended Posts

Maddius    146
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.


Share this post

Link to post
Share on other sites
benryves    1999
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).

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this