samedi 16 mars 2019

if else statement with copy with ctrl-c and copy on select with notification and keypress event c#

I want to write an application with an if else statement that if you use the; button. You then get a windows notification with "copy on select in enabled" and if you still read; Press that you get a notification with the text "copy on select disabled" and that it then only copies via CTRL-C or right mouse click and then clicks copy. I have already looked at form1_keypress and KeyChar but that has not yielded anything yet.

This is my code:

        protected override void WndProc(ref Message m)
        {
            base.WndProc(ref m);
            {
                const int WM_DRAWCLIPBOARD = 0x308;
                if (m.Msg == WM_DRAWCLIPBOARD)
                {
                    // copy when selecting   
                    {
                        switch (MouseButtons)
                        {
                            case MouseButtons.Middle:
                                GetAnswer(Clipboard.GetText(TextDataFormat.UnicodeText));
                                break;
                        };
                    }
                    //copy on ctrl-c or right click copy
                    GetAnswer(Clipboard.GetText(TextDataFormat.UnicodeText));
                }
            }
        }
    }
}

Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire