Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
DeviceType Enumeration
Collapse the table of content
Expand the table of content

DeviceType Enumeration

Specifies a device type.

Namespace:  Microsoft.WindowsMobile.DirectX.Direct3D
Assembly:  Microsoft.WindowsMobile.DirectX (in Microsoft.WindowsMobile.DirectX.dll)

public enum DeviceType

Member nameDescription
Supported by the .NET Compact FrameworkDefaultThe default device type.

The following example creates a device by using the DeviceType enumeration.

public class CreateDevice : Form
    // Set global variables for this project.
    Device device = null;

    public CreateDevice()
        // Set the initial size of the form. 
        this.ClientSize = new System.Drawing.Size(400, 300);
        // Set the caption for the form. 
        this.Text = "D3D Tutorial 01: CreateDevice";

    public bool InitializeGraphics()
            // Set up presentation parameters and create the  
            // Direct3D device.
            PresentParameters presentParams = new PresentParameters();
            presentParams.Windowed = true;
            presentParams.SwapEffect = SwapEffect.Discard;
            device = new Device(0, DeviceType.Default, this, CreateFlags.None, presentParams);
            return true;
        catch (DirectXException)
            return false;
    private void Render()
        if (device == null)

        //Clear the backbuffer to a blue color. 
        device.Clear(ClearFlags.Target, System.Drawing.Color.Blue, 1.0f, 0);
        //Begin the scene.

        // Rendering scene objects, if desired. 

        //End the scene.
    protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        // Render on painting. 
    protected override void OnKeyPress(System.Windows.Forms.KeyPressEventArgs e)
        if ((int)(byte)e.KeyChar == (int)System.Windows.Forms.Keys.Escape)
            // Handle the ESC key being pressed. 

    /// <Summary> 
    /// The main entry point for the application. 
    /// </Summary> 
    static void Main()

        using (CreateDevice DeviceForm = new CreateDevice())
            // Initialize Direct3D. 
            if (!DeviceForm.InitializeGraphics())
                MessageBox.Show("Could not initialize Direct3D.  This tutorial will exit.");

            // While the form is still valid, render and process messages. 
            // while (DeviceForm.Created) 

Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Compact Framework

Supported in: 3.5, 2.0

Community Additions

© 2015 Microsoft