string x = "k"; 
            Keys Key = Keys.k;
           //怎样实现Key=Keys.(x值)
           // x="h";
           // Key=Keys.h;
            RegisterHotKey(this.Handle, 113, 3,Key); //注册热键怎样实现Key=Keys.(x值)

解决方案 »

  1.   

     keys key = null;
                string classname = "keys" ;
                string functionname = x.tostring();
                System.Type type = Type.GetType(classname);            if (type != null)
                {
                    object obj = Activator.CreateInstance(type);                System.Reflection.MethodInfo method = type.GetMethod(functionname);                if (method != null)
                    {
                        key = (keys)method.Invoke(obj, new object[] {});
                    }
                }
      

  2.   

    Keys i =  (Keys)Enum.Parse(typeof(Keys), "K", true);
      

  3.   

    Keys i = (Keys)Enum.Parse(typeof(Keys), "K", true);
      

  4.   


            [DllImport("user32")]
            public static extern bool RegisterHotKey(IntPtr hWnd, int id, uint control, Keys vk);   int i = 3;
      RegisterHotKey(this.Handle, 113, 3,Key); //怎样把3用i代替
      

  5.   


            [DllImport("user32")]
            public static extern bool RegisterHotKey(IntPtr hWnd, int id, uint control, Keys vk);   int i = 3;
      RegisterHotKey(this.Handle, 113, 3,Key); //怎样把3用i代替
      

  6.   

    这是另外一个问题了RegisterHotKey(this.Handle, 113,i,Key)不行?
    那试试
    RegisterHotKey(this.Handle, 113, (long)i,Key)