From iLab Cookbook

Toolkits: SimpleSDGWidget

<< Back to the SDG Toolkit page

Below is the full code required to make a minimal Sdg Widget and test it out.

In this tutorial you will learn how to

Unzip all files (executables plus dependancies) into a single folder


There are two interfaces which provide all of the required functionality for any sdg Widget. They are ISdgMouseWidget and ISdgKeyboardWidget. It is important to note that ISdgKeyboardWidget inherits from ISdgMouseWidget. So, if you wanted to create your own Sdg Widget from scratch you would have to implement each method of the interface.

To avoid this extra work you may want to use some of our pre built Sdg Controls and User Controls. A Control is the base class from which all other widgets inherit from. A user control is useful for using the visual designer to develop your own Sdg widget. We will use a user control for this example. This tutorial assumes you are already familiar with the basic drawing example.


1) Save the SDG Toolkit files somewhere to disk

2) Open Visual Studio .NET and create a new C# Control Library

3) In the Solution Explorer on the left of the screen right click in the references folder and choose Add Reference

4) Click on the "Browse" button and find the location where you saved the SDG Toolkit. Click "Open" then click "Ok" to add the Sdg Toolkit Reference


6) Now change the "Back Color" property of the label to Web -> Transparent.

7) Double click on the User Control to view the code. In the code section replace the line

public class UserControl1 : System.Windows.Forms.UserControl


public class UserControl1 : Sdgt.SdgUserControl

Now you have inherited all of the SdgUserControl functionality to your new control!


9) Add the following code to your program

if (e.ID > 0)
    this.BackColor = Color.Blue;
    this.BackColor = Color.Red;


public String Text
        return label1.Text;
        label1.Text = value;


12) To add you cool new UserControl click on it and then click on the form. It should automatically start at the default size.

13) Add an SdgManager and set it's RelativeTo property to "Form1" and run your application. It should look like below when it is clicked on by Mouse 0

Retrieved from
Page last modified on January 09, 2006, at 10:25 PM