public void InitialiseGraphics()
{
PresentParameters pp = new PresentParameters();
pp.Windowed = true;
pp.SwapEffect = SwapEffect.Discard;
pp.EnableAutoDepthStencil = true;
pp.AutoDepthStencilFormat = DepthFormat.D16;
pp.DeviceWindowHandle = this.Handle;
device = new Device(0, DeviceType.Hardware, this, CreateFlags.HardwareVertexProcessing, pp);
//device.RenderState.FillMode = FillMode.WireFrame;
device.DeviceReset += new EventHandler(this.OnDeviceReset);
OnDeviceReset(device, null);
initialised = true;
}