English 中文(简体)
• 如何在没有文字的箱子检查时添加捷径
原标题:How to Add shortcut key to checkbox without text

我要补充一下检查箱的关键。 检查箱没有文字。 我有标签,然后是检查箱。 Label对外加固有捷径。 因此,Label拥有V作为捷径。 如果有人使用Alt+V,那么che箱应该从选定国家改为没有选择的国家,相反。

最佳回答

你们可以检查一下,这指的是以下法典部分。

        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            // look for the expected key 
            if (keyData == Keys.Alt && keyData == Keys.V)
            {
                checkBox1.Checked = true;
                return true;
            }
            else
            {
                checkBox1.Checked = false;
                return false;
            }
        }
问题回答

骨质素控制是特殊的。 由于标签可能永远得不到重视,只要你试图把重点放在使用其关键板 m的标签上,标签就把重点放在了表格的下一个控制上。

This is intended for use with textboxes and comboboxes, which don t have any built-in facility for displaying a label (in contrast to the check box and option button controls). To set up a mnemonic for these controls, you position a label next to them, set a mnemonic for it, and ensure that it comes right before the textbox in the tab order. That way, when the user activates the keyboard mnemonic for the label, it automatically sets focus to the textbox control. You ve seen this all over the place in Windows:

“example

如果你必须(尽管我确实不肯定你为什么要这样做),你就能够完全控制检查箱。 贴上标签的门槛(&Visible),然后贴上你希望与之合作的检查箱的标签。 利用视频演播室中的“TbIndex配置选择,确保如果标签有制指数n,检查箱控制有制成指数n+1

没有必要凌驾于<代码>ProcessCmdKey或任何其他困难的东西。





相关问题
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.

热门标签