逃脱角色\ e不起作用 [英] Escape Character \e does not work

查看:71
本文介绍了逃脱角色\ e不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了逃避的问题。性格\。此代码在我的

Windows窗体KeyPress事件中。编译器给我无法识别的转义

序列即使这是在MSDN中记录的。不知道这是不是一个错误?


if(e.KeyChar ==''\''')

{

this.Close();

}

I am having a problem with the "escape" character \e. This code is in my
Windows form KeyPress event. The compiler gives me "unrecognized escape
sequence" even though this is documented in MSDN. Any idea if this is a bug?

if (e.KeyChar == ''\e'')
{
this.Close();
}

推荐答案




" pkaeowic" < PK ****** @ discussions.microsoft.com>在消息中写道

新闻:8F ********************************** @ microsof t.com ...
Hi,

"pkaeowic" <pk******@discussions.microsoft.com> wrote in message
news:8F**********************************@microsof t.com...
我遇到了逃避问题性格\。此代码在我的Windows窗体KeyPress事件中。编译器给我无法识别的逃逸序列。即使这是在MSDN中记录的。不知道这是否是一个
错误?

if(e.KeyChar ==''\ e'')
{
this.Close();
}
I am having a problem with the "escape" character \e. This code is in my
Windows form KeyPress event. The compiler gives me "unrecognized escape
sequence" even though this is documented in MSDN. Any idea if this is a
bug?

if (e.KeyChar == ''\e'')
{
this.Close();
}




奇怪,这里发生了同样的事情,它说它不会重新点燃,即使在MSND

说它这是有效的。


解决方法:只需使用值:

如果e.KeyChar ==(char)27)

-

Ignacio Machin,

ignacio.machin AT dot.state.fl.us

佛罗里达州交通局



Weird, here happens the same, it said it''s not recignized, even when MSND
says it''s valid.

Workaround: just use the value:
if e.KeyChar == (char)27 )

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


感谢Ignacio的回复。这就是我最终要做的事情。


Ignacio Machin(.NET / C#MVP)"写道:
Thanks for the reply Ignacio. That''s what I ended up doing.

"Ignacio Machin ( .NET/ C# MVP )" wrote:


" pkaeowic" < PK ****** @ discussions.microsoft.com>在消息中写道
新闻:8F ********************************** @ microsof t.com。 ..
Hi,

"pkaeowic" <pk******@discussions.microsoft.com> wrote in message
news:8F**********************************@microsof t.com...
我遇到了转义问题。性格\。此代码在我的Windows窗体KeyPress事件中。编译器给我无法识别的逃逸序列。即使这是在MSDN中记录的。不知道这是否是一个
错误?

if(e.KeyChar ==''\ e'')
{
this.Close();
}
I am having a problem with the "escape" character \e. This code is in my
Windows form KeyPress event. The compiler gives me "unrecognized escape
sequence" even though this is documented in MSDN. Any idea if this is a
bug?

if (e.KeyChar == ''\e'')
{
this.Close();
}



很奇怪,这里发生了同样的事情,它说它不会重新点燃,即使MSND
说这是有效的。

解决方法:只需使用值:
如果e.KeyChar ==(char)27)

-
Ignacio Machin,
ignacio。 machin AT dot.state.fl.us
佛罗里达州交通局



Weird, here happens the same, it said it''s not recignized, even when MSND
says it''s valid.

Workaround: just use the value:
if e.KeyChar == (char)27 )

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation



MSDN中的这个位置是什么?

我正在看C#语言参考 - 2.4.4.4字符文字

这里是转义码:


\\ \\''\ \\\\\ \\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\无论如何它是什么?

-


Stoitcho Goutsev(100)


" pkaeowic" < PK ****** @ discussions.microsoft.com>在留言中写道

新闻:1F ********************************** @ microsof t.com ...
Where is this in MSDN?
I''m looking at C# language reference - "2.4.4.4 Character literals"
and here are the escape codes:

\'' \" \\ \0 \a \b \f \n \r \t \v

I don''t see \e. What is it anyways?
--

Stoitcho Goutsev (100)

"pkaeowic" <pk******@discussions.microsoft.com> wrote in message
news:1F**********************************@microsof t.com...
感谢Ignacio的回复。这就是我最终要做的事情。

Ignacio Machin(.NET / C#MVP)"写道:
Thanks for the reply Ignacio. That''s what I ended up doing.

"Ignacio Machin ( .NET/ C# MVP )" wrote:


" pkaeowic" < PK ****** @ discussions.microsoft.com>在消息中写道
新闻:8F ********************************** @ microsof t.com。 ..
Hi,

"pkaeowic" <pk******@discussions.microsoft.com> wrote in message
news:8F**********************************@microsof t.com...
>我遇到了转义问题。性格\。这段代码在我的
> Windows形成KeyPress事件。编译器给了我无法识别的逃避
>序列"即使这是在MSDN中记录的。不知道这是不是
> bug?
>
> if(e.KeyChar ==''\''')
> {
> this.Close();
> }
>I am having a problem with the "escape" character \e. This code is in my
> Windows form KeyPress event. The compiler gives me "unrecognized escape
> sequence" even though this is documented in MSDN. Any idea if this is a
> bug?
>
> if (e.KeyChar == ''\e'')
> {
> this.Close();
> }



很奇怪,这里发生了同样的事情,它说它没有被重新点燃,即使MSND
说这是有效的。
解决方法:只需使用值:
如果e.KeyChar ==(char)27)

-
Ignacio Machin,
ignacio.machin AT dot。 state.fl.us
佛罗里达州交通局



Weird, here happens the same, it said it''s not recignized, even when MSND
says it''s valid.

Workaround: just use the value:
if e.KeyChar == (char)27 )

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation



这篇关于逃脱角色\ e不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆