Ejemplo n.º 1
0
        // 通过监视系统消息,判断是否按下热键
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == 0x0312)                    // 如果m.Msg的值为0x0312那么表示用户按下了热键
            {
                switch (m.WParam.ToString())
                {
                case "1000":     // 截图翻译
                {
                    isFixedScreen = false;
                    tranMode      = TranMode.TranAndShowText;
                    StartThread(null);
                    break;
                }

                case "1001":       // 切换英译中模式
                {
                    if (!isEnToZh) // 如果当前翻译模式为 俄 译 中
                    {
                        showCont = "当前翻译模式:英译中";
                        isEnToZh = true;
                        tranMode = TranMode.ShowText;         // 显示“当前模式:英译中”这句话
                        StartThread(showCont);
                    }
                    break;
                }

                case "1002":     // 翻译
                {
                    ShowTranForm();
                    break;
                }

                case "1003":      // 切换俄译中模式
                {
                    if (isEnToZh) // 如果当前翻译模式为 英 译 中
                    {
                        showCont = "当前翻译模式:俄译中";
                        isEnToZh = false;
                        tranMode = TranMode.ShowText;          // 显示“当前模式:x译中”这句话
                        StartThread(showCont);
                    }
                    break;
                }

                case "1004":     // 固定区域截图翻译
                {
                    isFixedScreen = true;
                    tranMode      = TranMode.TranAndShowText;
                    StartThread(null);
                    break;
                }
                }
            }
            base.WndProc(ref m);
        }
        // 通过监视系统消息,判断是否按下热键
        protected override void WndProc(ref Message m)
        {
            if (m.Msg != 0x0312)                    // 如果m.Msg的值为0x0312那么表示用户按下了热键
            {
                base.WndProc(ref m);
                return;
            }

            base.WndProc(ref m);

            if (m.WParam.ToString() == "1000")      // 截图翻译
            {
                TM = TranMode.Tran;
                StartThread(null);
            }
            else if (m.WParam.ToString() == "1001") // 切换英译中模式
            {
                if (!EnToZh)                        // 如果当前翻译模式为 俄 译 中
                {
                    Show_cont = "当前翻译模式:英译中";
                    EnToZh    = true;
                    TM        = TranMode.Show; // 显示“当前模式:英译中”这句话
                    StartThread(Show_cont);
                }
            }
            else if (m.WParam.ToString() == "1002") // 翻译
            {
                ;                                   ///////////////////////////////////////////
            }
            else if (m.WParam.ToString() == "1003") // 切换俄译中模式
            {
                if (EnToZh)                         // 如果当前翻译模式为 英 译 中
                {
                    Show_cont = "当前翻译模式:俄译中";
                    EnToZh    = false;
                    TM        = TranMode.Show; // 显示“当前模式:x译中”这句话
                    StartThread(Show_cont);
                }
            }

            // base.WndProc(ref m);
        }