http://www.sufeinet.com/plugin.php?id=keke_group

苏飞论坛

 找回密码
 马上注册

QQ登录

只需一步,快速开始

分布式系统框架(V2.0) 轻松承载百亿数据,千万流量!讨论专区 - 源码下载 - 官方教程

HttpHelper爬虫框架(V2.7-含.netcore) HttpHelper官方出品,爬虫框架讨论区 - 源码下载 - 在线测试和代码生成

HttpHelper爬虫类(V2.0) 开源的爬虫类,支持多种模式和属性 源码 - 代码生成器 - 讨论区 - 教程- 例子

查看: 3877|回复: 0

[Winform] merlin.acs的使用方法 merlin.acs添加右键菜单

[复制链接]
发表于 2012-7-6 19:42:10 | 显示全部楼层 |阅读模式
看看这个怎么样吧
muolin.jpg
直接看代码吧我就不多说了
1.先下载一下这个控件 吧
网上多的是Google一下就可以下载的到了,文件名子是merlin.acs可能有2MB多点,下载完成以后放在bin\Debug里就可以了
下面我们添加一个引有控件的名称是Microsoft Agent Control 2.0
现在把我下面的程序就可以直接 用了
[C#] 纯文本查看 复制代码
action[0]=" Acknowledge "; //承认
action[1]=" LookDown "; //向下看
action[2]=" Sad "; //悲伤
action[3]=" Alert "; //警告
action[4]=" LookDownBlink "; //向下看眨眼
action[5]=" Search "; //寻找
action[6]=" Announce "; //声明
action[7]=" LookUp "; //向上看
action[8]=" StartListening "; //开始聆听
action[9]=" Blink "; //眨眼
action[10]=" LookUpBlink "; //向下看眨眼
action[11]=" StopListening "; //停止聆听
action[12]=" Confused "; //迷惑
action[13]=" LookLeft "; //向左看
action[14]=" Suggest "; //建议
action[15]=" Congratulate "; //祝贺
action[16]=" LookLeftBlink "; //向左看眨眼
action[17]=" Surprised "; //吃惊
action[18]=" Declines "; //拒绝
action[19]=" LookRight "; //向右看
action[20]=" Think "; //思考
action[21]=" DontRecognize "; //不承认
action[22]=" LookRightBlink "; //向右看眨眼
action[23]=" Wave "; //挥动
action[24]=" Explain "; //解释
action[25]=" MoveDown "; //向下移动
action[26]=" Write "; //书写
action[27]=" GestureDown "; //向下姿势
action[28]=" MoveUp "; //向上移动
action[29]=" Processing "; //计算
action[30]=" GestureUp "; //向上姿势
action[31]=" MoveRight "; //向右移动
action[32]=" Reading "; //阅读
action[33]=" GestureLeft "; //向左姿势
action[34]=" MoveLeft "; //向左移动
action[35]=" Searching "; //寻找
action[36]=" GestureRight "; //向右姿势
action[37]=" Pleased "; //高兴
action[38]=" Writing "; //书写
action[39]=" GetAttention "; //获得注意
action[40]=" Read "; //阅读
action[41]=" Greet "; //问候


这里是怎么样添加右键菜单 的
«
  -  
»
0000000
0000000
0000000
0000000
0000000
0000000
23 ? 23 : zerofill(this.value);controlid.value=controlid.value.replace(/\d+(:\d+)/ig, this.value+"$1")' value="" size="1" type="text">点 59 ? 59 : zerofill(this.value);controlid.value=controlid.value.replace(/(\d+\d+/ig, "$1"+this.value)' value="" size="1" type="text">分分
确定


2020
2019
2018
2017
2016
2015
2014
2013
2012
2011

2010
2009
2008
2007
2006
2005
2004
2003
2002
2001

2000
1999
1998
1997
1996
1995
1994
1993
1992
1991

1990
1989
1988
1987
1986
1985
1984
1983
1982
1981

1980
1979
1978
1977
1976
1975
1974
1973
1972
1971

1970
1969
1968
1967
1966
1965
1964
1963
1962
1961

1960
1959
1958
1957
1956
1955
1954
1953
1952
1951

1950
1949
1948
1947
1946
1945
1944
1943
1942
1941

1940
1939
1938
1937
1936
1935
1934
1933
1932
1931


1  月
2  月
3  月
4  月
5  月
6  月
7  月
8  月
9  月
10 月
11 月
12 月

[C#] 纯文本查看 复制代码
写在前面:AgentObject是很好玩的东西,像office2007之前的版本都有这个小精灵,用来show的话,是不错的。但是它是com的组件,要使用这个组件就必须要了解一定的接口知识。这就是问题所在,因为调试又不方法,实在是好烦的。下面介绍一个简单的方法使用AgentObject,并可以增加小精灵右键的菜单。

初始化控件
.net对之前的技术是有打包的,也就是说com组件的使用一点问题也没有。那我们就使用最简单的方法来设置com组件,也就是拖控件的办法。这也是最好使的,如果不使用拖控件的办法,如果你在设置的过程中发现了不可解决的问题,你会很头大的。
也就是很建一个UserControl,然后调出工具箱,添加项,选中Com组件,然后是Microsoft Agent Control。这样,工具箱就多出了这个控件,你可以把它拖出来。
这样,new的动作就完成了,你会发现你的项目引入了新的dll两个。一个是源com组件,一个是经过.net打包的控件。这个经过.net打包的控件,如果不是拖放控件,你怎么也找不到的。Dll的名称是AxInterop.AgentObjects。

效果图
下面的方法,可以为Agentobject增加右键菜单。
 

使用AgentObject
使用时,可以参考下面的代码
    public partial class AgentControl : UserControl
    {

        private AgentObjects.IAgentCtlCharacter axAgent1Character = null;

        public AgentControl()
        {
            InitializeComponent();
        }

        private void AgentControl_Load(object sender, EventArgs e)
        {
            axAgent1.Connected = true;
            axAgent1.Characters.Load("merlin", "merlin.ACS");
            axAgent1Character = (AgentObjects.IAgentCtlCharacter)axAgent1.Characters["merlin"];
            axAgent1Character.Commands.Add("MessageBox", "弹出消息框", "", true, true);
            axAgent1.Show();
            axAgent1.Command += new AxAgentObjects._AgentEvents_CommandEventHandler(axAgent1_Command);
        }

        void axAgent1_Command(object sender, AxAgentObjects._AgentEvents_CommandEvent e)
        {
            AgentObjects.IAgentCtlUserInput _userInput = ((AgentObjects.IAgentCtlUserInput)e.userInput);
            if (_userInput.Name == "MessageBox")
            {
                MessageBox.Show("弹出消息框", "axAgent1提示");
            }
        }
}
这里就是使用的方法,而调用时就直接new这个控件就可以了。这个AgentObject自然就会被加载了。

呵呵,真是好简单的。
        private void Form1_Load(object sender, EventArgs e)
        {
            AgentObjectsTest.AgentControl _control = new AgentControl();            
        }





1. 开通SVIP会员,免费下载本站所有源码,不限次数据,不限时间
2. 加官方QQ群,加官方微信群获取更多资源和帮助
3. 找站长苏飞做网站、商城、CRM、小程序、App、爬虫相关、项目外包等点这里
您需要登录后才可以回帖 登录 | 马上注册

本版积分规则

QQ|手机版|小黑屋|手机版|联系我们|关于我们|广告合作|苏飞论坛 ( 豫ICP备18043678号-2)

GMT+8, 2024-6-14 12:47

© 2014-2021

快速回复 返回顶部 返回列表