在键盘上按Alt键,然后通过代码启动URL-C# [英] Press Alt Key on keyboard and then launch URL through code - C#

查看:114
本文介绍了在键盘上按Alt键,然后通过代码启动URL-C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在尝试在Visual Studio中使用C#启动URL.

I am trying to launch a URL using C# in Visual Studio.

我需要先按ALT键,然后启动我的URL.

I need to first press ALT key and then launch my URL.

类似于Keydown-ALT和IE中的启动URL.

Something like Keydown - ALT and launch URL in IE.

请帮助

谢谢

NK.

推荐答案

我假设您正在谈论Windows窗体应用程序.这样做处理"KeyDown"消息吗?您的表单事件.在KeyDown功能中,检查键码"e.Modifiers"是否正确.与"Alt"匹配打开网址.

I assume that you are talking about windows form application. Do this handle the "KeyDown" event of your form. in KeyDown function check the keycode "e.Modifiers" match with "Alt" the open url.

private void frmKeys_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Modifiers == Keys.Alt)
            {
                System.Diagnostics.Process.Start("http://www.microsoft.com");
            }
        }


这篇关于在键盘上按Alt键,然后通过代码启动URL-C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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