Page 1 of 1

How can I create a device in an UserControl

Posted: Mon Aug 06, 2007 11:53 am
by dec
Hi,

I'm trying to create a device into an UserControl in VB 2005 Express. But it's not working.

I'm using following code:

Code: Select all

Public Class _3d_Viewer
    Private Device As Irrlicht.IrrlichtDevice
    Private Driver As Irrlicht.Video.IVideoDriver

    Private Sub _3d_Viewer_Invalidated(ByVal sender As Object, ByVal e As System.Windows.Forms.InvalidateEventArgs) Handles Me.Invalidated
        Driver.BeginScene(True, True, New Irrlicht.Video.Color(255, 10, 200, 24))
        Driver.Draw2DLine(New Irrlicht.Core.Position2D(0, 0), New Irrlicht.Core.Position2D(Width, Height), New Irrlicht.Video.Color(255, 0, 200, 0))
        Driver.EndScene()
    End Sub
    Private Sub _3d_Viewer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Device = New Irrlicht.IrrlichtDevice(Irrlicht.Video.DriverType.DIRECT3D9, New Irrlicht.Core.Dimension2D(Width, Height), 32, False, False, False, True, Me.Handle)
        Driver = Device.VideoDriver
        Driver.BeginScene(True, True, New Irrlicht.Video.Color(255, 10, 200, 24))
        Driver.Draw2DLine(New Irrlicht.Core.Position2D(0, 0), New Irrlicht.Core.Position2D(Width, Height), New Irrlicht.Video.Color(255, 0, 200, 0))
        Driver.EndScene()
    End Sub
End Class
Can someone help me?