设置初始焦点 [英] setting the initial focus

查看:96
本文介绍了设置初始焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将初始焦点设置为控件(如图片框)?


假设我有一个带有单个图片框的表单。

当应用程序开始运行时,我想将焦点设置为

图片框,以便它可以响应KeyDown事件。


我试过将一个picBox.focus放在一个Form_load事件处理程序中但是没有
似乎有帮助。


有什么建议吗?

在此先感谢,

Raja

How does one set the initial focus to a control such as a picture box?

Suppose I have a form with a single picture box on it.
When the application starts to run I would like to set the focus to the
picture box so that it can respond to KeyDown events.

I tried placing a picBox.focus in a Form_load event handler but that didn''t
seem to help.

Any suggestions?

Thanks in advance,
Raja

推荐答案

图片框肯定没有KeyDown事件?


" Raja S." < RA ** @ cs.indiana.edu>在消息中写道

news:c1 ********** @ hood.uits.indiana.edu ...
Surely the picturebox doesn''t have a KeyDown event?

"Raja S." <ra**@cs.indiana.edu> wrote in message
news:c1**********@hood.uits.indiana.edu...
如何设置初始焦点如图片框这样的控件?

假设我有一个带有单个图片框的表单。
当应用程序开始运行时,我想将焦点设置为
图片框,以便它可以响应KeyDown事件。

我尝试在一个Form_load事件处理程序中放置一个picBox.focus但是
似乎没有帮助。 />
有什么建议吗?

提前致谢,
Raja
How does one set the initial focus to a control such as a picture box?

Suppose I have a form with a single picture box on it.
When the application starts to run I would like to set the focus to the
picture box so that it can respond to KeyDown events.

I tried placing a picBox.focus in a Form_load event handler but that didn''t seem to help.

Any suggestions?

Thanks in advance,
Raja



* ra ** @ cs.indiana.edu (Raja S.)scripsit:
* ra**@cs.indiana.edu (Raja S.) scripsit:
如何将初始焦点设置为一个控件,如图片框?

假设我有一个带有单个图片框的表单。
当应用程序开始运行时,我想将焦点设置为
图片框使它可以响应KeyDown事件。

我尝试在一个Form_load事件处理程序中放置一个picBox.focus,但这似乎没什么帮助。
How does one set the initial focus to a control such as a picture box?

Suppose I have a form with a single picture box on it.
When the application starts to run I would like to set the focus to the
picture box so that it can respond to KeyDown events.

I tried placing a picBox.focus in a Form_load event handler but that didn''t
seem to help.




将控件分配给最低的''TabIndex'',它将自动聚焦




-

Herfried K.瓦格纳[MVP]

< http://www.mvps.org/dotnet>



Assign the control the lowest ''TabIndex'' and it will be focused
automatically.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>


设置图片框的标签索引到0.


-

Paras

您的一站式娱乐指南 - http://www.paras.2ya.com/

" Raja S." < RA ** @ cs.indiana.edu>在消息中写道

news:c1 ********** @ hood.uits.indiana.edu ...
Set the picture box''s Tab Index to 0.

--
Paras
Your One Stop Entertainment Guide - http://www.paras.2ya.com/
"Raja S." <ra**@cs.indiana.edu> wrote in message
news:c1**********@hood.uits.indiana.edu...
如何设置初始焦点如图片框这样的控件?

假设我有一个带有单个图片框的表单。
当应用程序开始运行时,我想将焦点设置为
图片框,以便它可以响应KeyDown事件。

我尝试在一个Form_load事件处理程序中放置一个picBox.focus但是
似乎没有帮助。 />
有什么建议吗?

提前致谢,
Raja
How does one set the initial focus to a control such as a picture box?

Suppose I have a form with a single picture box on it.
When the application starts to run I would like to set the focus to the
picture box so that it can respond to KeyDown events.

I tried placing a picBox.focus in a Form_load event handler but that didn''t seem to help.

Any suggestions?

Thanks in advance,
Raja



这篇关于设置初始焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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