C# WinForm 做个像瑞星的卡卡助手(就是那个爱打呼的小狮子) 有人做过么?
时间:2008-05-14
来源:互联网
我想做个个性桌面精灵 就像瑞星的那个卡卡助手一样的东西 要会动的 位置在桌面右下角 当然也可以用鼠标移动它(就像那个爱打呼的小狮子那个)
然后在它身上右击有个退出选项 点下小狮子就走的
可以提供想法 如果做过类似的 请提供下源码让小弟借鉴一下 好么 提供源码的立即给全分
即来之 请顶之 谢谢各位
作者: yangercha 发布时间: 2008-05-14
作者: yangercha 发布时间: 2008-05-14
作者: Kevin_LiuFeng 发布时间: 2008-05-15
作者: wzuomin 发布时间: 2008-05-15
帮顶
作者: sww5219999 发布时间: 2008-05-15
当然还可以利用鼠标事件来移动窗体了。
下面的代码示例阐释了如何通过创建圆形按钮来使用 Region 属性。若要运行该示例,请将下面的代码粘贴到一个包含 roundButton 按钮的窗体中。该示例要求 Paint 事件已连接到该示例中定义的事件处理程序。
C# code
// This method will change the square button to a circular button by // creating a new circle-shaped GraphicsPath object and setting it // to the RoundButton objects region. private void roundButton_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { System.Drawing.Drawing2D.GraphicsPath buttonPath = new System.Drawing.Drawing2D.GraphicsPath(); // Set a new rectangle to the same size as the button's // ClientRectangle property. System.Drawing.Rectangle newRectangle = roundButton.ClientRectangle; // Decrease the size of the rectangle. newRectangle.Inflate(-10, -10); // Draw the button's border. e.Graphics.DrawEllipse(System.Drawing.Pens.Black, newRectangle); // Increase the size of the rectangle to include the border. newRectangle.Inflate( 1, 1); // Create a circle within the new rectangle. buttonPath.AddEllipse(newRectangle); // Set the button's Region property to the newly created // circle region. roundButton.Region = new System.Drawing.Region(buttonPath); }
作者: zhoufoxcn 发布时间: 2008-05-15
using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms; namespace 市政资金管理系统 { public enum Action { /// <summary> /// 鼓掌 /// </summary> CONGRATULATE, /// <summary> /// 查找 /// </summary> CHECKINGSOMETHING, /// <summary> /// 眨眼 /// </summary> DEEPIDLE1, /// <summary> /// 缩小 /// </summary> HIDE, /// <summary> /// 销毁 /// </summary> EMPTYTRASH, /// <summary> /// 手势·下 /// </summary> GESTUREDOWN, /// <summary> /// 手势·左 /// </summary> GESTURELEFT, /// <summary> /// 手势·右 /// </summary> GESTURERIGHT, /// <summary> /// 手势·上 /// </summary> GESTUREUP, /// <summary> /// 靠近屏幕打招呼 /// </summary> GETATTENTION, /// <summary> /// 感汉号 /// </summary> WAVE, /// <summary> /// 鲜花 /// </summary> GETTECHY, /// <summary> /// 鞠躬 /// </summary> GETWIZARDY, /// <summary> /// 小助手下班 /// </summary> GOODBYE, /// <summary> /// 小助手上班 /// </summary> GREETING, /// <summary> /// 想一下 /// </summary> ALERT, /// <summary> /// 往下看 /// </summary> LOOKDOWN, /// <summary> /// 往左下看 /// </summary> LOOKDOWNLEFT, /// <summary> /// 往右下看 /// </summary> LOOKDOWNRIGHT, /// <summary> /// 往左看 /// </summary> LOOKLEFT, /// <summary> /// 往右看 /// </summary> LOOKRIGHT, /// <summary> /// 往上看 /// </summary> LOOKUP, /// <summary> /// 往左上看 /// </summary> LOOKUPLEFT, /// <summary> /// 往右上看 /// </summary> LOOKUPRIGHT, /// <summary> /// 打印 /// </summary> PRINT, /// <summary> /// 动作还原 /// </summary> RESTPOSE, /// <summary> /// 保存 /// </summary> SAVE, /// <summary> /// 后面找东西 /// </summary> SEARCHING, /// <summary> /// 邮件 /// </summary> SENDMAIL, /// <summary> /// 思考 /// </summary> THINKING, /// <summary> /// 挥手再见 /// </summary> PROCESSING, /// <summary> /// 写东西 /// </summary> WRITING, } public class 助手 { Timer timer = null; Timer speakTimer = null; Action _Action; public Action Action { get { return _Action; } set { if (value.ToString() != "") { _Action = value; this.Character.Stop(null); Character.Play(value.ToString()); } } } AgentObjects.IAgentCtlCharacterEx Character = null; AxAgentObjects.AxAgent Agent = null; string Name = string.Empty; string Path = string.Empty; Action[] actions = new Action[] { Action.CONGRATULATE, Action.DEEPIDLE1, Action.EMPTYTRASH, Action.GETATTENTION, Action.WAVE, Action.GETTECHY, Action.GETWIZARDY, Action.ALERT, Action.PRINT, Action.SAVE, Action.SENDMAIL }; bool visible = true; public bool Visible { get { return visible; } set { visible = value; if (visible) { Character.Show(Action.GREETING); timer.Enabled = true; } else { Character.Hide(Action.GOODBYE); timer.Enabled = false; } } } public 助手(ref AxAgentObjects.AxAgent axAgent, string name, string path, bool Visibled) { Agent = axAgent; Name = name; Path = path; visible = Visibled; Agent.Characters.Load(Name, (object)Path); Character = Agent.Characters[Name]; Character.AutoPopupMenu = false; Character.Balloon.Style = 3; Character.Left = (short)(Screen.PrimaryScreen.WorkingArea.Width - 160); Character.Top = (short)(Screen.PrimaryScreen.WorkingArea.Height - 140); timer = new Timer(); timer.Interval = 40000; timer.Tick += new EventHandler(timer_Tick); timer.Enabled = true; speakTimer = new Timer(); speakTimer.Interval = 5000; speakTimer.Tick += new EventHandler(speakTimer_Tick); if (visible) { Character.Show(Action.GREETING); this.Action = Action.GREETING; } } void speakTimer_Tick(object sender, EventArgs e) { if (Character.Balloon.Visible) { speakTimer.Enabled = false; Character.Balloon.Visible = false; } } //随机播放动画 void timer_Tick(object sender, EventArgs e) { if (!visible) return; this.timer.Enabled = false; this.Character.Stop(null); Random rand = new Random(); int number = rand.Next(10000); this.Action = actions[number % actions.Length]; this.Action = Action.RESTPOSE; this.timer.Enabled = true; } public void Speak(string Text) { if (!visible) return; this.Character.StopAll(null); this.Action = Action.RESTPOSE; this.Character.Speak(Text, ""); timer.Enabled = true; speakTimer.Enabled = true; } public void Think(string Text) { if (!visible) return; timer.Enabled = false; this.Character.Think(Text); timer.Enabled = true; } //退出 public void ExitAssistant() { this.timer.Enabled = false; Agent.Characters.Unload(Name); } } }
Info.form助手 = new 助手(ref this.axAgent1, "SAEKO", Application.StartupPath + "\\SAEKO.ACS", Properties.Settings.Default.小助手);
Info.form助手.Speak("欢迎使用市政资金管理系统!");
我没有去改动直接复制过来了。你上网找找 Agent编程 就有你要的答案了。它是一个控件(像上面的 this.axAgent1),助手的文件是 *.acs,还有一个后缀名,忘了。
作者: Choi57671452 发布时间: 2008-05-15
作者: aiyaoo 发布时间: 2008-05-15
在C#下用Microsoft Agent制作精灵
--------------------------------------------------------------------------------
源作者:波波 人气:15919
C#作为Microsoft .Net战略下的新兴语言,有其不可比拟的强大功能。作为一种RAD语言,它有Visual Basic快速开发应用程序的优点,又不乏C++语言的面相对象的优良特性。
本文就通过介绍利用Microsoft Agent来创建一个超酷用户界面(就像Office2000那种办公助手的界面,并有语音朗读功能)来向大家展示一下用C#进行Windows应用程序快速开发的优点。
一 概述
微软的Office2000中用到了一些被称为“办公助手”(Office Assistance)的精灵来给用户提供帮助,这样做的效果是显而易见的,大家可以得到很有效的帮助并且使用户界面显得非常友好。现在,我们只要使用Microsoft Agent(基于COM),我们就可以在自己的程序中使用这种精灵来给程序增光添彩。用这种精灵,我们可以实现语音的朗读、表演动画甚至还可以实现语音识别呢!
二 要求
(1)微软公司视窗2000服务器版或视窗 XP 版
(2).Net FrameWrok SDK Beta 2版
(3)Microsoft Agent核心组建
(4)Microsoft Agent的精灵:吉尼(Genie)、么林(Merlin)、罗比(Robby)和皮蒂(Peedy)
(5)至少有一个英语的Text-to-Speech引擎(现在还找不到中文的)
(6)微软运行时发音API4.0a
(如果还要实现语音识别功能的话,还要有微软的语音识别引擎)
所有这些都可以在http://microsoft.com/msagent/downloads.htm,下载下面六个文件:
Download selected language component
Download selected character
Download selected engine
Download the Microsoft SAPI 4.0a runtime binaries (824 KB exe)
Download the Microsoft® Speech Recognition Engine (6 MB exe)
Download the Speech Control Panel (927 KB exe)
下载完后,直接解压安装它们,重启电脑.
另外,必须要安装Office2000(Office97是不行的)。
三 实现方法
1.打开VS.Net,新建一个工程,不妨取名为CoolUI。图示如下:
2.创建用户界面。
选择菜单:工具->自定义工具箱,并选择Microsoft Agent Control 2.0组件,图示:
将Microsoft Agent Control控件添加到窗体上(在程序运行时是看不到窗体是的Microsoft Agent控件的,只有在设计界面时它才显示出来),并课设计窗体如下:
将主窗体的Text属性设置为“CoolUI”;将左边三个按钮的Text属性分别设置为“导入精灵”、“朗读文本”、“隐藏精灵”;将textBox的Text属性设置为“Type anything here for the character to read for you!(Only English)”,Multiline属性设置为True。
3.简单的用户界面已经完成,现在我们来进行代码部分的工作:
首先,添加using AgentObjects;到代码的开始处。
其次,在我们的类里添加私有数据成员:private IAgentCtlCharacterEx Character;(这就是我们要用到的精灵的对象)。修改构造函数如下:
C# code
public Form1() { InitializeComponent(); button2.Enabled=false;//先使下面的两个按钮无效 button3.Enabled=false; } 接着,添加左边三个按钮的鼠标单击的消息相应函数: private void button1_Click(object sender, System.EventArgs e) private void button2_Click(object sender, System.EventArgs e) private void button3_Click(object sender, System.EventArgs e) 代码如下: private void button1_Click(object sender, System.EventArgs e) { axAgent1.Characters.Load("Genie", (object)"GENIE.ACS");//导入吉尼这个精灵 Character = axAgent1.Characters["Genie"]; Character.LanguageID = 0x409;//把语言设置为英语,这里不能是中文 Character.Show(null);//显示精灵 button1.Enabled=false;//重新设置按钮的有效性 button2.Enabled=true; button3.Enabled=true; } private void button2_Click(object sender, System.EventArgs e) { if(textBox1.Text.Length == 0) //如果没有字符的话,就不读 return; Character.Speak(textBox1.Text, null);//让精灵朗读文本 } private void button3_Click(object sender, System.EventArgs e) { Character.Play("Wave"); Character.Play("Hide");//隐藏精灵 } 所有完整的代码如下: using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using AgentObjects; namespace CoolUI { public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button3; private System.Windows.Forms.TextBox textBox1; private System.ComponentModel.Container components = null; private AxAgentObjects.AxAgent axAgent1; private IAgentCtlCharacterEx Character; public Form1() { InitializeComponent(); button2.Enabled=false;//先使下面的两个按钮无效 button3.Enabled=false; } protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1)); this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.button3 = new System.Windows.Forms.Button(); this.textBox1 = new System.Windows.Forms.TextBox(); this.axAgent1 = new AxAgentObjects.AxAgent(); ((System.ComponentModel.ISupportInitialize)(this.axAgent1)).BeginInit(); this.SuspendLayout(); // // button1 // this.button1.Location = new System.Drawing.Point(32, 32); this.button1.Name = "button1"; this.button1.TabIndex = 1; this.button1.Text = "导入精灵"; this.button1.Click += new System.EventHandler(this.button1_Click); // // button2 // this.button2.Location = new System.Drawing.Point(32, 80); this.button2.Name = "button2"; this.button2.TabIndex = 2; this.button2.Text = "朗读文本"; this.button2.Click += new System.EventHandler(this.button2_Click); // // button3 // this.button3.Location = new System.Drawing.Point(32, 128); this.button3.Name = "button3"; this.button3.TabIndex = 3; this.button3.Text = "隐藏精灵"; this.button3.Click += new System.EventHandler(this.button3_Click); // // textBox1 // this.textBox1.Location = new System.Drawing.Point(120, 16); this.textBox1.Multiline = true; this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(184, 184); this.textBox1.TabIndex = 4; this.textBox1.Text = "Type anything here for the character to read for you!(Only English)"; // // axAgent1 // this.axAgent1.Enabled = true; this.axAgent1.Location = new System.Drawing.Point(56, 176); this.axAgent1.Name = "axAgent1"; this.axAgent1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axAgent1.OcxState"))); this.axAgent1.Size = new System.Drawing.Size(32, 32); this.axAgent1.TabIndex = 5; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.ClientSize = new System.Drawing.Size(336, 229); this.Controls.AddRange(new System.Windows.Forms.Control[] { this.axAgent1, this.textBox1, this.button3, this.button2, this.button1}); this.Name = "Form1"; this.Text = "CoolUI"; ((System.ComponentModel.ISupportInitialize)(this.axAgent1)).EndInit(); this.ResumeLayout(false); } #endregion [STAThread] static void Main() { Application.Run(new Form1()); } private void button1_Click(object sender, System.EventArgs e) { axAgent1.Characters.Load("Genie", "Genie.acs");//导入吉尼这个精灵 Character = axAgent1.Characters["Genie"]; Character.LanguageID = 0x409;//把语言设置为英语,这里不能是中文 Character.Show(null);//显示精灵 button1.Enabled=false;//重新设置按钮的有效性 button2.Enabled=true; button3.Enabled=true; } private void button2_Click(object sender, System.EventArgs e) { if(textBox1.Text.Length == 0) //如果没有字符的话,就不读 return; Character.Speak(textBox1.Text, null);//让精灵朗读文本 } private void button3_Click(object sender, System.EventArgs e) { Character.Play("Wave"); Character.Play("Hide");//隐藏精灵 } } }
4.好了,现在完成了所有的工作了,安Ctrl+F5试试效果吧!
怎么样,还不错吧。
四.总结
从以上的例子,我们可以发现用C#做Windows平台下的开发是相当迅速而有效的。其实上面的例子还可以大大扩充,使之实现像电子小说阅读、英文听力测试、英文单词学习等功能,读者不妨一试。
作者: wzuomin 发布时间: 2008-05-15
作者: ziseliuxingzh 发布时间: 2008-05-15
作者: jimmy_jpy 发布时间: 2008-05-15
作者: ZoNE17 发布时间: 2008-05-15
作者: heartdevil 发布时间: 2008-05-15
这个应该对你有所启发
作者: wdtclv 发布时间: 2008-05-15
有微软有个:Microsoft Agent专门用于这种的
作者: finando 发布时间: 2008-05-15
作者: jinjazz 发布时间: 2008-05-15
作者: YJJ_XXML 发布时间: 2008-05-26
作者: opf110 发布时间: 2009-02-24
作者: Roc_Lee 发布时间: 2009-02-24
作者: e8love 发布时间: 2009-03-08
哈哈,做一个不难,其实原理就是在一个可移动的窗体上显示动画(一般是gif格式,或连续显示几祯静态图象),不过要做的形象生动话,关键要设计出好的动画来,我也很想搞一个好的,可现在没时间搞
你可以到迅雷上找,我是搜“c#原代码”时搜到了一个在桌面活动的金鱼,有原代码的
作者: athwind 发布时间: 2009-03-08
作者: haifeng39 发布时间: 2009-03-08
作者: ccs02287 发布时间: 2009-03-08
mark
是“记下 ”的意思吗?
作者: longzhezs 发布时间: 2009-03-09
作者: zbc496218 发布时间: 2010-06-25
作者: zuoshouaini 发布时间: 2010-06-25
作者: xomix 发布时间: 2010-06-25
作者: qiu_770 发布时间: 2010-06-25
http://blog.csdn.net/jianuMan/archive/2010/06/23/5690258.aspx
然后把狮子的图绘制上去
http://blog.csdn.net/jianuMan/archive/2010/06/18/5677839.aspx
作者: jianuMan 发布时间: 2010-06-26
作者: rizher 发布时间: 2010-06-26
作者: happychou 发布时间: 2010-06-26
为什么捕图捕不到啊?
还有输入法也捕不到。
作者: kolosi 发布时间: 2010-06-26
http://download.csdn.net/source/2458035
作者: mide_c 发布时间: 2010-06-26
一個小精靈來的。。。
具體代碼要去找找。。。
作者: parellax 发布时间: 2010-06-26
作者: zyc8623203 发布时间: 2010-09-04

怎么是404?

作者: boringame 发布时间: 2010-09-04
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28