SDGT - The Single Display Groupware Toolkit

Examples

Advanced Applications

More advanced applications are provided for users already familiar with using the toolkit.  To view the more advaned applications please click on one of the links below.

Simple Sketch

Below is the full code required to make the minimal sketch program.  In this tutorial you will learn how to

  • Add an Sdg Control and make all coordinates relative to a form
  • Handle Sdg Mouse Events
  • Set Icons used
  • Set Cursor Text Captions
  • Set Cursor Rotations
  • Iterate through each mouse
  • Use the ID parameter to draw different colours on the screen

1) Save the SDG Toolkit files somewhere to disk 

2) Open Visual Studio .NET and create a new C# Windows Application

3) In the toolbox on the left of the screen right click in the general tab and choose Customize Toolbox (2002) or Add/Remove Items (2003)

Visual Studio .NET 2002

Visual Studio .NET 2003

 

4) Click on the ".NET Framework Components" tab then press the "Browse" button and find the location where you saved the SDG Toolkit.  Click "Open" then click "Ok" to add the toolbox items

5) You should now see an Sdg Manager Component in the General Tab (optionally you can add a new tab called SDG Toolkit).  Click on the SdgManager Tab and drag an instance onto the form.  Your screen should look like below.

6) Click on the sdgManager1 component instance and set it's RelativeTo property to the Form.  This makes all Sdg Mouse Events relative to the form and will be useful in our cool sdg drawing application

7) Now click on the event tab of the properties window (the lightning bolt) and in the MouseMove event type sdgMouseMove.  This will create a sdgMouseMove event handler.

 

5) When you press enter you will be sent to the sdgMouseMove code.  Type in the following code in the sdgMouseMove function:

	Graphics g = this.CreateGraphics();
	Pen penColour = Pens.Black;
	if (e.ID > 0)
		penColour = Pens.Red;

	if ((e.Button & MouseButtons.Left) > 0)
		g.DrawLine(penColour, new Point(e.X, e.Y), new Point(e.X+2, e.Y+2));

6) You should be able to compile your code now and draw little dots on the screen.  Lets play around with the toolkit a bit more.  Goto the Form1() function at the beginning of the class declaration.  Add the following code after the InitializeComponent() call.

	Cursor[] sdgCursors = {Cursors.Arrow, Cursors.Hand, Cursors.Cross, Cursors.IBeam};
	String[] sdgText = {"Edward", "Saul", "Mike", "Sheelagh"};
	int[] sdgDegreeRotations = {0, 45, 90, 180};

	for (int i=0; i < sdgManager1.Mice.Count && i < 4; ++i)
	{
		sdgManager1.Mice[i].Cursor = sdgCursors[i];
		sdgManager1.Mice[i].Text = sdgText[i];
		sdgManager1.Mice[i].DegreeRotation = sdgDegreeRotations[i];
	}

7) Compile and run your cool new application (Press F5).  It should look something like below with two cursors.

If you give up you can download my example here.

This web site was created by Edward Tse, the last update was September 10, 2003 01:28 PM

Please send comments or suggestions to webdude@edwardtse.com

 

License Terms