使我的窗口形式在C#中不可见 [英] making my window form invisible in c#
本文介绍了使我的窗口形式在C#中不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好用户,
我正在用C#开发一个窗口应用程序,需要在其中捕获键盘键.
我的问题是,我想使窗口窗体在运行时不可见,但我仍然希望一切都应该与窗体可见时一样.
有人可以帮我吗?
Hi users,
I am working on a window application in c# in which I need to trap keyboard keys.
My problum is, I want to make window forms invisible at run time but I still want that everything should work same as it will work when form is viSible.
Can someone please help me?
推荐答案
您可以为此使用javascriptonkeypress
事件,
http://www.w3schools.com/jsref/event_onkeypress.as [
You can use javascriptonkeypress
event for this,
http://www.w3schools.com/jsref/event_onkeypress.as[^]
换句话说,您尝试制作一个键盘记录程序?
尝试使用
In other words you trying to make a keylogger?
Try using
myForm.ShowInTaskbar = false;
myForm.Opacity = 0;
private void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
//Capture the key event and write to text file
}
仅当表单处于焦点位置时,这才起作用.
检查以下链接以获取更多信息.
键盘记录器
This will only work though when the form is in focus.
Check the following link for additional info.
Keylogger
这篇关于使我的窗口形式在C#中不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文