using System.Windows.Forms; using System.Drawing; using Drawing3d; namespace Sample { public partial class Form1 : Form { MyDevice Device = new MyDevice(); public Form1() { InitializeComponent(); Device.WinControl = this; } } public class MyDevice:OpenGlDevice { Torus MyTorus = new Torus(); Torus MyTorusLines = new Torus(); public override void OnPaint() { base.OnPaint(); Material = Materials.Gold; // draw bounded surface MyTorus.Paint(this); // draw skeleton PolygonMode = PolygonMode.Line; MyTorusLines.Paint(this); PolygonMode = PolygonMode.Fill; } protected override void OnCreated() { base.OnCreated(); BackColor = Color.White; MyTorus.InnerRadius = 1; MyTorus.OuterRadius = 3; Loca L = new Loca(); CurveArray Curves = new CurveArray(); L.Add(Curves); // In clockwise sense Curves.Add(new Line(new xy(0.1, 0.1), new xy(0.2, 0.5))); Curves.Add(new Line(new xy(0.2, 0.5), new xy(0.5, 0.4))); Curves.Add(new Line(new xy(0.5, 0.4), new xy(0.1, 0.1))); // Set curves as bounding curves MyTorus.BoundedCurves = L; // only to show the lines of the torus MyTorusLines.InnerRadius = 1; MyTorusLines.OuterRadius = 3; MyTorusLines.CompileEnable = false; } } }