New to DirectX, My form is not displaying. - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

New to DirectX, My form is not displaying.

SleepingTrollSleepingTroll Posts: 9Member
This is code I copied from a video, I have tried many examples with the same results, no form is displayed.

[code]using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;

namespace Modeler
{
///
/// Description of MainForm.
///
public partial class Form1 : Form
{
private Device device = null;
public Form1()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
InitializeDevice();
//
// TODO: Add constructor code after the InitializeComponent() call.
//
}

private void InitializeDevice()
{
PresentParameters pp = new PresentParameters();
pp.Windowed = true;
pp.SwapEffect = SwapEffect.Discard;
device = new Device(0, DeviceType.Reference, this, CreateFlags.SoftwareVertexProcessing, pp);
}

protected override void OnPaint(PaintEventArgs e)
{
device.Clear(ClearFlags.Target, Color.CornflowerBlue, 0, 1);
device.Present();
}

}
}[/code]

Sign In or Register to comment.