 |
Example
Program |
Below is the full code required to make the minimal sketch program
1) Save the SDG Toolkit dll file
somewhere to disk
2) Open Visual Studio .NET and create a new C# Windows Application
3) In the solution explorer right click on the references folder
and choose to add a reference

4) Click "Browse" and find the location
where you saved the SDG Toolkit. Click "Open" then
click "Ok" to add the reference
5) In the solution explorer right click on Form1.cs
and choose "View Code"
6) Insert the following code into your C# windows
application
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using Grouplab;
namespace ToolkitTester
{
public class Form1 : System.Windows.Forms.Form
{
private sdgControl g;
...
public Form1()
{
...
g = new sdgControl();
g.setRelativeTo(this);
g.OnMouseMove += new sdgMouseEventHandler(this.newMouseMove);
if (g.TotalMice >= 2)
{
g.Mouse(1).Text = "Silly Rabbit";
g.Mouse(1).Picture = "c:\\windows\\cursors\\lcross.cur"; // or your default windows directory
}
if (g.TotalMice >= 1)
{
g.Mouse(0).Text = "Tricks are for kids";
g.Mouse(0).Font = new Font("Times New Roman", 14);
g.Mouse(0).DegreeRotation = 180;
}
}
private void newMouseMove(object sender, sdgMouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
Graphics d = this.CreateGraphics();
d.DrawLine(System.Drawing.Pens.Black, new Point(e.X,e.Y), new Point(e.X+2,e.Y+2));
}
}
}
}
7) Compile and run your cool new application (Press F5)
This web site was created by Edward Tse, the last
update was
February 23, 2003 09:20 PM
Please send comments or suggestions to webdude@edwardtse.com |