首先网吧上网的时候,你刷身份证的时候会有提示的声音,这个就很方便了。那么这个怎么实现呢?很简单!只需要引用一个小的dll文件。先给大家一个连接:公子之物
之后在引用一下:using SpeechLib;
之后写上这几句话:
SpeechVoiceSpeakFlags flag = SpeechVoiceSpeakFlags.SVSFlagsAsync;
SpVoice voice = new SpVoice();
string voice_txt = computername+"要充值100元"; //写上你要语音提示的话,我的是某某电脑要充值多少钱
voice.Voice = voice.GetVoices(string.Empty, string.Empty).Item(0);
voice.Speak(voice_txt, flag);
之后运行就能语音提示了。只不过这个提示声音不好听,有兴趣的可以自己去找更好的小插件。
大家在平常上网的时候想必都会遇到很多广告,很烦人吧。像网吧也有这种类似的广告推送功能,比如有了优惠的时候,需要介绍网吧改进的地方的时候。现在介绍一个特别简单的广告推送的小方法。
小广告窗体写:
private void Form1_Load(object sender, EventArgs e)
{
//为了防止窗体持续的刷新
this.DoubleBuffered = true;//设置本窗体
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景.
SetStyle(ControlStyles.DoubleBuffer, true); // 双缓冲
}
protected override void OnClosing(CancelEventArgs e)
{
DialogResult result = MessageBox.Show("是否确认关闭?", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
e.Cancel = result != DialogResult.Yes;
base.OnClosing(e);
}
调用小广告的服务器端写:
ChatClient.Form1 frmShowWarning = new ChatClient.Form1();
Point p = new Point(Screen.PrimaryScreen.WorkingArea.Width - frmShowWarning.Width,
Screen.PrimaryScreen.WorkingArea.Height);
frmShowWarning.PointToScreen(p);
frmShowWarning.Location = p;
frmShowWarning.Show();
for (int i = 0; i < frmShowWarning.Height; i++)
{
frmShowWarning.Location = new Point(p.X, p.Y - i);
Thread.Sleep(10);//加入进程睡眠时间,让窗体可以缓缓的出现
}
还有一个问题,那就是怎么能让广告出现在客户端界面,一种方法是你可以把广告界面写在客户端下面(这种方法经过试验似乎是不大好用),另一种方法是把客户端界面作为MDI父窗体,小广告窗体作为MDI子窗体,这个想必大家都会写,就不介绍代码了,这样就实现了广告推送!
最后给大家几个小玩意儿,很有意思的。
不用感谢我
真的不用感谢我,给点个赞就行!