在Visual Basic 6中删除所有对象的焦点 [英] Removing focus from all objects in Visual Basic 6

查看:232
本文介绍了在Visual Basic 6中删除所有对象的焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法,使用户可以单击窗体本身,并在这样做从任何对象(文本框,组合框等)中删除焦点目前有它?基本上,可以集中从所有的东西一律删除?



将焦点设置到表单本身不起作用。



我想到做旧的隐藏一个占位符后面的另一个对象的窍门,但我真的不是一个粉丝。



谢谢!

在VB6中,一个 PictureBox 可以获得焦点,即使它不包含任何控制。



在你的情况下,你可以把 PictureBox TabStop false, BorderStyle 设置为0, TabIndex 设置为0,但不包含任何可调焦在运行时通过 ScaleHeight 控制并扩展到 ScaleWidth

你必须在这个背景中放置标签和任何无窗口的控件 PictureBox

当用户点击表单时,焦点将消失。使用无焦点 Tab键键将会把第一个控件(使用 TabIndex 设置为1的控件)关闭。 >

Is there a method such that a user can click on the form itself, and in doing so remove focus from whatever object (textbox, combobox, etc) currently has it? Basically, can focus be uniformly removed from everything at once?

Setting the focus to the form itself does not work.

I thought about doing the old "hide a placeholder button behind another object" trick, but I'm really not a fan of that.

Thanks!

解决方案

In VB6 a PictureBox can get focus, even if it does not contain any control.

In your case you can put a PictureBox with TabStop false, BorderStyle set to 0, TabIndex set to 0 behind every other control but not containing any focusable control and stretch it to ScaleWidth by ScaleHeight at run-time.

You have to put the labels and any windowless control in this background PictureBox too.

This way when the user clicks "on the form" the focus will "go away". With "no focus" Tab key will focus first control (the one with TabIndex set to 1).

这篇关于在Visual Basic 6中删除所有对象的焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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