Link to home
Start Free TrialLog in
Avatar of jindalee
jindalee

asked on

Disable Ctrl-A, Ctrl-C

Hello Experts

I need to disable the ability of users to select and copy text in a Rich Text Control using Ctrl-A and Ctrl-C.

How do I go about this?

Many thanks
Avatar of Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs)
Flag of Australia image

Set the ShortCutsEnabled property to False.

Wayne
ASKER CERTIFIED SOLUTION
Avatar of Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs)
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial

        public bool PreFilterMessage(ref Message m)
        {
            if (m.Msg == WM_KEYDOWN)
            {
                return HandleKeys((Keys)((int)m.WParam) & Keys.KeyCode);
            }
            return false;
        }
        public bool HandleKeys(Keys keycode)
        {
            bool ret = true;
            switch (keycode)
            {
                case Keys.Alt | Keys.F4: this.Close();break;
                case Keys.Alt | Keys.N: MoveInList(Direction.FORWARD); break;
                case Keys.Alt | Keys.B: MoveInList(Direction.BACKWORD); break;
                //.........
                default: ret = false; break;
            }
            return ret;
        }

Open in new window

Avatar of jindalee
jindalee

ASKER

Thank you webtubbs. Worked first time.

BTW. It is good to see a moderator remind a contributor that a submission should add value to the question and should also address specifics such as programming language. Too many times you see a question asking for a response in (e.g.) VB.Net only to find loads of answers in some other language.