English 中文(简体)
将接受Button设定为无保留地仍然关闭在ENTER上的表格
原标题:Setting AcceptButton to None still closes the form on ENTER

我有一个MDI窗户申请表,我的子女表格主要有“K”和“Cancel”县。 然而,我不想用ENTER/ESC钥匙来启动这些钥匙,以防止意外储蓄/浪费。 因此,该表既包括接受Button,也包括CancelButton。 《欧洲常规武装力量宪章》的确没有任何规定,但《欧洲常规武装力量宪章》通过在塔博尔发现的第一个纽州“lick”的形式仍然关闭。

为什么如此? Must 我真的开始做的是工作,抓住了ENTER的钥匙?

<><><> 而这正是我们的主人。 反观者告诉我,如果《塔普令》的首批控制(实际上,当表格开启时,这种控制会发生违约情况),那么它就被指定为违约控制。 否则就不会发生。 现在的问题是:工作队?

问题回答

在你将Button/CancelButton地产设定为无土地时,所有设计师将DialogResult地产交给你,不清。 因此,你必须手工操作(在你的法典或设计中)。

Button okButton = new Button();

// some code here

okButton.DialogResult = DialogResult.None;

它认为,由于Khton是表上第一种控制,当表格装满时,它就自动得到关键板的注意,这意味着点击进入该表。 如果你倾向于把重点放在另一个控制上,则试图将“积极财产”确定在论坛的另一部分。

Button okButton = new Button();
TextBox someOtherControl = new TextBox();

// Add controls to form.
this.Controls.Add(okButton);
this.Controls.Add(someOtherControl);

// Specifically set the ActiveControl on the form.
this.ActiveControl = someOtherControl;

我刚刚陷入了同样的问题。 难道不是长期利用温和派,那么,我认为,在如此简单的情况下,我会失踪吗?

在我的案件中,我想“Ok”纽芬兰语在有些任务执行期间是无形的(或残疾的),然后出现在最后......。 因此,一开始,就只显示“Cancel”,它总是“accept”! 不管我是否将Button定为“Ok”或“None”,在“Ok”形式出现之后,“Cancel”仍在生效。 如果这两个县都始终可见,并且能够做到正确。 ...... 我认为,这是正确的,但现在经过阅读,我尝试了转子订单,而是,它是第一个总是“接受”的县。

表格似乎是这样。 接受Button刚刚过时,现在未使用。 表格CancelButton仍在工作,尽管如此。 我知道,这是它如何以超文本处理,而是在温Forms开展工作。 我有同样的“问题”。 NET 4.5。





相关问题
Bring window to foreground after Mutex fails

I was wondering if someone can tell me what would be the best way to bring my application to the foreground if a mutex was not able to be created for a new instance. E.g.: Application X is running ...

How to start WinForm app minimized to tray?

I ve successfully created an app that minimizes to the tray using a NotifyIcon. When the form is manually closed it is successfully hidden from the desktop, taskbar, and alt-tab. The problem occurs ...

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. ...

Handle DataTable.DataRow cell change event

I have a DataTable that has several DataColumns and DataRow. Now i would like to handle an event when cell of this DataRow is changed. How to do this in c#?

Apparent Memory Leak in DataGridView

How do you force a DataGridView to release its reference to a bound DataSet? We have a rather large dataset being displayed in a DataGridView and noticed that resources were not being freed after the ...

ALT Key Shortcuts Hidden

I am using VS2008 and creating forms. By default, the underscore of the character in a textbox when using an ampersand is not shown when I run the application. ex. "&Goto Here" is not ...

WPF-XAML window in Winforms Application

I have a Winforms application coded in VS C# 2008 and want to insert a WPF window into the window pane of Winforms application. Could you explain me how this is done.

热门标签