C#禁用文本框专注于表单加载 [英] C# disable textbox focus on form load

查看:59
本文介绍了C#禁用文本框专注于表单加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文本框,我想为其禁用焦点 如何通过编程为文本框禁用焦点

I have a textbox which I want to disable focus for it How do I disable focus for Textbox with Programming

使用编程C#禁用文本框焦点, 我使用了以下两个无效的代码:

disable textbox focus using programming c# , I have used below two codes not working:

textBox1.focus()=false;

textBox1.focused()=false;

推荐答案

您可以使用此表单设置this.ActiveControl = null;

You can set this.ActiveControl = null; with this is your Form

private void YourForm_Load(object sender, EventArgs e)  
{ 
    this.ActiveControl = null;       
}

这篇关于C#禁用文本框专注于表单加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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