关于在C Sharp Windows窗体中使用的Web浏览器 [英] About web browser using in c sharp windows forms

查看:209
本文介绍了关于在C Sharp Windows窗体中使用的Web浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Nmae是jimson,我是c语言编程的新手
在我的项目中,我有一个Windows窗体.在此Windows窗体中,有一个Web浏览器.

当我按CTRL + F1键的时候,在我的Web浏览器文本框中输入名称

例如:

我在google主页
我当时在Google搜索框中的光标,当时我按CTRL + F1则在该文本框中输入了一个字符串.
在Windows应用程序中是否可能
我按下ctrl的另一个键,那时候在文本框中输入了另一个字符串.

My Nmae is jimson , I am New In c sharp programming
in my project i have one windows form. In this windows form one web browser is there.

when i press CTRL + F1 key that time in my web browser textbox put a name

eg:

i am in home page of google
my cursor in search box in google that time i press CTRL+ F1 at that time one string is enterd in that textbox
is it possible for in windows application
i press another key with ctrl that time another string is entered in textbox

推荐答案

这很难找到一个不错的"解决方案,就像WebBrowser控件所做的那样不公开KeyDown或KeyPress事件.
它确实公开了PreviewKeyDown,并且可以正常工作(但是您可能需要对其进行微调)

处理事件,然后调用SendKeys.Send方法:
This is a little difficult to find a "nice" solution for, as the WebBrowser control does not expose KeyDown, or KeyPress events.
It does expose PreviewKeyDown though, and that should work (but you may need to fine tune it a bit)

Handle the event, and call the SendKeys.Send method:
SendKeys.Send("Hello");



请注意,这可能不适用于您的系统:因为您的激活序列包含CTRL键,所以很有可能会将其解释为CTRL + h,CTRL + e,CTRL + l ...



Be aware this probably will not work on your system: Because your activation sequence includes the CTRL key, there is a very, very good chance that this will be interpreted as CTRL+h, CTRL+e, CTRL+l...


这篇关于关于在C Sharp Windows窗体中使用的Web浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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