小弟请问各位大侠:我用C#做个类似键盘的时候遇到了这样一个情况:我做到了用”这个字符时候要用到ACSII转换了,但是小弟不是很清楚,希望各位大哥大姐帮忙一下。我只知道 System.Text.Encoding.ASCII.后面不知道怎么写了。知道的请说一下。

解决方案 »

  1.   

    ASCII码转换直接用short就可以
    例如 short a = (short)'a';
    这样就行.
      

  2.   

    string s = System.BitConverter.ToString(System.Text.Encoding.ASCII.GetBytes(input));
      

  3.   

    我的意思就是要把键盘上的"转换到我自己做的哪个键盘上去的嘛。 例如:txtLogInfo.Text += ">";
    但是我不能写成 txtLogInfo.Text += """;这样啥,就是这个意思 哪个大哥能帮一下忙不嘛  我在线等拉
      

  4.   

    [Quote=引用 4 楼 wuyi8808 的回复:]
    C# codestring s = System.BitConverter.ToString(System.Text.Encoding.ASCII.GetBytes(input));我改成这样怎么输出是33-34?
     string s = System.BitConverter.ToString(System.Text.Encoding.ASCII.GetBytes("34"));
                    txtLogInfo.Text += s;
    空军在来帮一下忙嘛。
      

  5.   

    应该可以用using (MemoryStream stream = new MemoryStream())
                {
                    using (Channel channel = new Channel(null, stream))
                    {
                        channel.WriteBytes(buffer);
                        message = channel.Read<T>();
                    }
                }
                return message;
    不知道可以不可以
      

  6.   

    txtLogInfo.Text += (char)34;