Device Class
.NET Framework 2.0
The parent object of all graphical objects in the scene.
Namespace: Microsoft.WindowsMobile.DirectX.Direct3D
Assembly: Microsoft.WindowsMobile.DirectX (in microsoft.windowsmobile.directx.dll)
Assembly: Microsoft.WindowsMobile.DirectX (in microsoft.windowsmobile.directx.dll)
The following code example creates a device.
Public Class Form1 Inherits Form ' Global variables for this project. Private device As Device = Nothing ' Rendering device. Public Sub New() ' Set the initial size and caption of the form. Me.ClientSize = New System.Drawing.Size(400, 300) Me.Text = "D3D Tutorial 01: CreateDevice" End Sub 'New Public Function InitializeGraphics() As Boolean Try ' Setup Direct3D. Dim presentParams As New PresentParameters() presentParams.Windowed = True presentParams.SwapEffect = SwapEffect.Discard device = New Device(0, DeviceType.Default, Me, CreateFlags.None, presentParams) Return True Catch Return False End Try End Function Private Sub Render() If device Is Nothing Then Return End If 'Clear the backbuffer to a blue color. device.Clear(ClearFlags.Target, System.Drawing.Color.Blue, 1.0F, 0) 'Begin the scene device.BeginScene() 'Rendering of scene objects can happen here. 'End the scene device.EndScene() device.Present() End Sub Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs) Me.Render() ' Render on painting. End Sub Protected Overrides Sub OnKeyPress(ByVal e As System.Windows.Forms.KeyPressEventArgs) If Fix(System.Convert.ToByte(e.KeyChar)) = Fix(System.Windows.Forms.Keys.Escape) Then Me.Close() ' Esc was pressed End If End Sub Shared Sub Main() Dim DeviceForm As New Form1() Try If Not DeviceForm.InitializeGraphics() Then ' Initialize Direct3D MsgBox("Could not initialize Direct3D. This tutorial will exit.") Return End If DeviceForm.Show() 'While the form is still valid, render and process messages 'While DeviceForm.Created ' DeviceForm.Render() ' Application.DoEvents() 'End While Finally DeviceForm.Dispose() End Try End Sub End Class
System.Object
Microsoft.WindowsMobile.DirectX.Direct3D.BaseMesh
Microsoft.WindowsMobile.DirectX.Direct3D.Device
Microsoft.WindowsMobile.DirectX.Direct3D.BaseMesh
Microsoft.WindowsMobile.DirectX.Direct3D.Device
Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
Community Additions
ADD
Show: