English 中文(简体)
玩TextBox 和 SIP 控制游戏时, 我怎样才能摆脱一个无控制例外?
原标题:How can I get rid of an UnHandledException while playing with TextBox and SIP control?

我的情况是,我有一个TextBox和两个按钮按钮按钮1和按钮2。这就是我现在做的。。。。。。。。。。。。。。

private void Button1_click()
{
   TextBox.IsReadOnly = false;
}

private void Button2_click()
{
   TextBox.IsReadOnly = true;
   this.Focus()
}

现在,流动,我在做什么...

  1. Program loads, I click on the TextBox, the SIP appears and I click somewhere on the screen the keyboard disappears.
  2. I press Button2 and the TextBox becomes read only and the SIP disappears (if it was shown)
  3. I tap on the TextBox (while it is still in the read only mode)
  4. I press Button1, and click on the TextBox.. BOOOMM.. the program crashes with an UnHandledException.

.

我尝试了获得文本框的焦点( ) 和 丢失的焦点( LextBox ), 但似乎没有什么帮助, 就在坠毁前, 文本框的GotFocus 没有被调用。 我点击文本框, 突然它崩溃了 。

真正试图弄清楚过去9个小时里 可能有什么变化(哦,是的,我笨手笨脚的程序员:)

有没有人能告诉我 任何可能的解决办法?

非常感谢:)

最佳回答

在就这一问题进行了认真努力之后,我终于使用了两个单独的文本框,并在点击按钮时设定了可见度的真实/假象。

我删除了TextBox的所有事件,我尽可能简化了代码(财产值和事件),但代码崩溃了。

我注意到一件事,虽然,

正如我提问的第4点一样,我点击了按钮1,然后点击了文本框,它正在崩溃。但是当我在屏幕 的任何地方点击“ 按下按钮1,<坚固> 时,然后单击文本框没有崩溃)

奇怪! 怪怪的! 怪怪的!

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签