SDG不同鼠标输入数据的识别及与Windows标准控件的交互(以下代码在VS .NET 2005 上编译通过)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace SDG_TEST
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
//设置鼠标文字标识内容, 此例仅以文字标识区别不同鼠标
String[] sdgText = { "Mouse 1", "Mouse 2", "Mouse 3" };
//迭代遍历所有鼠标,这里以3个鼠标为例
for (int i=0; i < sdgManager1.Mice.Count && i < 3; ++i)
{
sdgManager1.Mice[i].Text = sdgText[i];
}
//改变系统鼠标模式为跟随模式
sdgManager1.EmulateSystemMouseMode = Sdgt.EmulateSystemMouseModes.FollowMouse;
//制定第1个鼠标为系统鼠标
sdgManager1.MouseToFollow = 1;
}
//鼠标移动的事件响应
private void sdgManager1_MouseMove(object sender, Sdgt.SdgMouseEventArgs e)
{
//通过识别不同的鼠标ID来改变不同的textBox属性
switch (e.ID)
{
case 0:
this.tB_mouse1.Text = "X " + e.X + " Y " + e.Y;
break;
case 1:
this.tB_mouse2.Text = "X " + e.X + " Y " + e.Y;
break;
case 2:
this.tB_mouse3.Text = "X " + e.X + " Y " + e.Y;
break;
default:
break;
}
}
//有鼠标键按下时的事件响应
private void sdgManager1_MouseDown(object sender, Sdgt.SdgMouseEventArgs e)
{
//首先识别鼠标ID
switch (e.ID)
{
case 0:
//识别不同按键来改变不同的checkBox值为选中
if (e.Button == MouseButtons.Left)
this.cb_mouse<chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="1" unitname="l">1L</chmetcnv>.Checked = true;
if (e.Button == MouseButtons.Middle)
this.cb_mouse<chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="1" unitname="m">1M</chmetcnv>.Checked = true;
if (e.Button == MouseButtons.Right)
this.cb_mouse1R.Checked = true;
break;
case 1:
//识别不同按键来改变不同的checkBox值为选中
if (e.Button == MouseButtons.Left)
this.cb_mouse<chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="2" unitname="l">2L</chmetcnv>.Checked = true;
if (e.Button == MouseButtons.Middle)
this.cb_mouse<chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="2" unitname="m">2M</chmetcnv>.Checked = true;
if (e.Button == MouseButtons.Right)
this.cb_mouse2R.Checked = true;
break;
case 2:
//识别不同按键来改变不同的checkBox值为选中
if (e.Button == MouseButtons.Left)
this.cb_mouse<chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="3" unitname="l">3L</chmetcnv>.Checked = true;
if (e.Button == MouseButtons.Middle)
this.cb_mouse<chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="3" unitname="m">3M</chmetcnv>.Checked = true;
if (e.Button == MouseButtons.Right)
this.cb_mouse3R.Checked = true;
break;
default:
break;
}
}
//有鼠标键松开时的事件响应
private void sdgManager1_MouseUp(object sender, Sdgt.SdgMouseEventArgs e)
{
//首先识别鼠标ID
switch (e.ID)
{
case 0:
//识别不同按键来改变不同的checkBox值为取消选中
if (e.Button == MouseButtons.Left)
this.cb_mouse<chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="1" unitname="l">1L</chmetcnv>.Checked = false;
if (e.Button == MouseButtons.Middle)
this.cb_mouse<chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="1" unitname="m">1M</chmetcnv>.Checked = false;
if (e.Button == MouseButtons.Right)
this.cb_mouse1R.Checked = false;
break;
case 1:
//识别不同按键来改变不同的checkBox值为取消选中
if (e.Button == MouseButtons.Left)
this.cb_mouse<chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="2" unitname="l">2L</chmetcnv>.Checked = false;
if (e.Button == MouseButtons.Middle)
this.cb_mouse<chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="2" unitname="m">2M</chmetcnv>.Checked = false;
if (e.Button == MouseButtons.Right)
this.cb_mouse2R.Checked = false;
break;
case 2:
//识别不同按键来改变不同的checkBox值为取消选中
if (e.Button == MouseButtons.Left)
this.cb_mouse<chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="3" unitname="l">3L</chmetcnv>.Checked = false;
if (e.Button == MouseButtons.Middle)
this.cb_mouse<chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="3" unitname="m">3M</chmetcnv>.Checked = false;
if (e.Button == MouseButtons.Right)
this.cb_mouse3R.Checked = false;
break;
default:
break;
}
}
private void sdgManager1_MouseWheel(object sender, Sdgt.SdgMouseEventArgs e)
{
//首先识别鼠标ID
switch (e.ID)
{
case 0:
//当progressBar控件没有超出范围时,进行操作
if (this.pb_mouse1.Value == this.pb_mouse1.Minimum
&& e.Delta < 0) break;
if (this.pb_mouse1.Value == this.pb_mouse1.Maximum
&& e.Delta > 0) break;
this.pb_mouse1.Value += e.Delta / 120;
break;
case 1:
//当progressBar控件没有超出范围时,进行操作
if (this.pb_mouse2.Value == this.pb_mouse2.Minimum
&& e.Delta < 0) break;
if (this.pb_mouse2.Value == this.pb_mouse2.Maximum
&& e.Delta > 0) break;
this.pb_mouse2.Value += e.Delta / 120;
break;
case 2:
//当progressBar控件没有超出范围时,进行操作
if (this.pb_mouse3.Value == this.pb_mouse3.Minimum
&& e.Delta < 0) break;
if (this.pb_mouse3.Value == this.pb_mouse3.Maximum
&& e.Delta > 0) break;
this.pb_mouse3.Value += e.Delta / 120;
break;
default:
break;
}
}
}
}
以下为各控件在Form1.Designer.cs中的声明:
private Sdgt.SdgManager sdgManager1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox tB_mouse3;
private System.Windows.Forms.TextBox tB_mouse2;
private System.Windows.Forms.TextBox tB_mouse1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.CheckBox cb_mouse1R;
private System.Windows.Forms.CheckBox cb_mouse<chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="1" unitname="m">1M</chmetcnv>;
private System.Windows.Forms.CheckBox cb_mouse<chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="1" unitname="l">1L</chmetcnv>;
private System.Windows.Forms.CheckBox cb_mouse3R;
private System.Windows.Forms.CheckBox cb_mouse2R;
private System.Windows.Forms.CheckBox cb_mouse<chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="3" unitname="m">3M</chmetcnv>;
private System.Windows.Forms.CheckBox cb_mouse<chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="2" unitname="m">2M</chmetcnv>;
private System.Windows.Forms.CheckBox cb_mouse<chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="3" unitname="l">3L</chmetcnv>;
private System.Windows.Forms.CheckBox cb_mouse<chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="2" unitname="l">2L</chmetcnv>;
private System.Windows.Forms.ProgressBar pb_mouse1;
private System.Windows.Forms.ProgressBar pb_mouse3;
private System.Windows.Forms.ProgressBar pb_mouse2;
<shape id="_x0000_i1027" style="WIDTH: 361.5pt; HEIGHT: 178.5pt" type="#_x0000_t75"><imagedata o:title="SDGtoolkitData" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image004.jpg"></imagedata></shape>
图4.3 SDG Toolkit中数据的识别及与Windows标准控件的交互
4.4 Single Display Groupware Toolkit控件的使用
为了不受制于Windows标准控件的局限性,SDG Toolkit为了多鼠标的使用特意开发了一组相关控件,并在示例文件Simple Widget Application中详细演示了相关控件的使用,这里仅以此例来说明具体使用方法。
SDG Toolkit控件一共包含sdgRadioButton, sdgCheckBox, sdgTrackBar 3个,与名字相近的Windows标准控件用途一致,实现多鼠标控制的方式是为每个控件建立一个动态数组,以鼠标ID为索引,并且在显示上采用了同一控件分区域识别,使用户能知道自己相关控件的状态设置,在设计器层面使用方法与标准Windows控件完全相同。sdgRadioButton, sdgCheckBox控件数据主要利用CheckChanged事件来传递,事件的第二参数即为鼠标ID标识。sdgTrackBar主要利用Scroll事件来传递,鼠标的第二参数为sdgManager事件Sdgt.SdgMouseEventArgs形式,参数含义与4.3节介绍的一致。程序具体代码可在SDG Toolkit官方网站的example中找到,在此不详细列出,运行效果如图4.4所示。有一点要说明的是,到本文结稿之日为止,SDG Toolkit程序最终版本已经出到<chsdate w:st="on" year="1899" month="12" day="30" islunardate="False" isrocdate="False"><span lang="EN-US" style="FONT-SIZE: 12pt; LINE-HEIGHT: 150%; mso-font-kerning: 0pt; mso-no-proof: yes">2.0.1</span></chsdate>.0,而控件程序的版本仍然只有2.0.0.8,所以,假如要使用其控件,就不得不使用2.0.0.8版的SDG Toolkit程序。
<shape id="_x0000_i1028" style="WIDTH: 306pt; HEIGHT: 209.25pt" type="#_x0000_t75"><imagedata o:title="sdgwig" src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image005.jpg"></imagedata></shape>
图4.4 SDG Toolkit控件使用演示
最后说明,由于本人对C#理解不深,可能写出来的程序有些问题,请指正。
相关推荐
Simple Groupware是一个完全开源的企业办公应用程序,提供功能有:电子邮件,日历,联系人,任务,带有WebDAV的文档管理,手机同步,Outlook数据同步,全文检索等等。 Simple Groupware 0.745 更新记录: *增加...
PHP实例开发源码—Simple Groupware 开源php企业办公应用系统.zip PHP实例开发源码—Simple Groupware 开源php企业办公应用系统.zip PHP实例开发源码—Simple Groupware 开源php企业办公应用系统.zip
基于PHP的Simple Groupware 开源php企业办公应用系统.zip
Simple Groupware 是一个完整的协同工作套件包。它采用PHP,XML,SQL,...Simple Groupware与其它同类型系统不同之处在于使用了新的编程语言sgsML。该语言能够实现快速开发Web应用系统。支持MySQL,Oracle和PostgreSQL。
Simple Groupware 是一个完整的协同工作套件包。它采用PHP,XML,SQL,...Simple Groupware与其它同类型系统不同之处在于使用了新的编程语言sgsML。该语言能够实现快速开发Web应用系统。支持MySQL,Oracle和PostgreSQL。
arch-for-sync-groupware-tr1999-425
Ceica-GW是一个用于通过Internet在项目中工作的人们的系统,其中一些功能包括上载和下载文件系统,论坛,聊天,标签栏,待办事项列表等等!
PHP group Ware - free board - admin
Tiki Wiki CMS Groupware 认证绕过漏洞CVE-2020-15906POC Tiki Wiki CMS Groupware或简称为Tiki(最初称为TikiWiki)是一种免费且开源的基于Wiki的内容管理系统和在线办公套件。在如下这些版本21.2, 20.4, 19.3, ...
“软件使Wiki方式”使用PHP,MySQL的功能齐全的基于Web的多语言(40多种语言),紧密集成的多合一Wiki + CMS + Groupware,免费源软件(GNU / LGPL) ,Zend Framework,jQuery和Smarty。 Tiki可用于创建各种Web应用...
Eisti GroupWare,一种软件开发协同工作应用程序。 它包括一个 UML 设计器(可以导入 .java 文件和导出 xml 内容)、一个内置的聊天系统和一个分布式存储库系统。 用java-C编写,用法语为我们学校项目a
AGIS代表Asterisk组件集成服务器。 它提供了一个SOAP后端,用于访问和配置Asterisk PBX。 此外,它为E-Groupware实现了一个基于SOAP的Asterisk应用程序,并具有针对用户和管理员的管理功能。
SOGo的ZEG(零努力小组软件)版旨在为SOGo(开源消息传递和日历软件)提供完整的现成测试环境。
Axis Groupware是一个基于phpGroupWare构建的用于工作组和企业的组件套件。 Axis Groupware不是phpGroupWare的分支,而是专注于高质量生产部署的phpGroupware的自定义发行版。
Jaram_groupware Jaram组件
ivata组件是Groupware / Exchange / Intranet / Extranet系统。 包括联系人/通讯录,日历,CMS库和网络邮件。 Java J2EE,EJB(可选),Hibernate,Struts和JSP。 在WebSphere / Tomcat / Resin / JBoss上运行。 请...
GroupWare_Web
安装说明可以在这里找到:https://groupoffice.readthedocs.io/en/latest/install/install.html Group Office 是一个开源的群件应用程序。 它使您的日常办公任务更轻松。 在线共享项目、日历、文件和电子邮件。 它是...
一个主要在具有不同智能手机的移动学习环境中进行同步协作活动的平台。 aCME-groupware(协作移动环境)提供了多种工具来与学生进行协作式教育活动。
Nextcloud Hub 将 Nextcloud 四个关键产品 Files、Talk、Groupware 和 Office 集成到一个平台中,优化了协作流程。