//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
using System;
using System.Drawing;
using System.Windows.Forms;
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
class Fullscreen : Form
{
private Device device = null;
public Fullscreen()
{
this.FormBorderStyle = FormBorderStyle.None;
}
public void InitDirect3D()
{
PresentParameters presentParams = new PresentParameters();
presentParams.BackBufferCount = 1;
presentParams.BackBufferFormat = Manager.Adapters[0].CurrentDisplayMode.Format;
presentParams.BackBufferHeight = 768;
presentParams.BackBufferWidth = 1024;
presentParams.FullScreenRefreshRateInHz = Manager.Adapters[0].CurrentDisplayMode.RefreshRate;
presentParams.SwapEffect = SwapEffect.Discard;
presentParams.Windowed = false;
device = new Device(0, DeviceType.Hardware, this, CreateFlags.SoftwareVertexProcessing, presentParams);
}
public void Render()
{
device.Clear(ClearFlags.Target, Color.Black, 1.0f, 0);
device.BeginScene();
device.EndScene();
device.Present();
}
public static void Main()
{
using(Fullscreen frm = new Fullscreen())
{
frm.InitDirect3D();
frm.Show();
while(frm.Created)
{
frm.Render();
Application.DoEvents();
}
}
}
}