Guest User

Form

a guest
Apr 2nd, 2016
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.81 KB | None | 0 0
  1. using Microsoft.DirectX.Direct3D;
  2. using System.Drawing;
  3. using System.Windows.Forms;
  4.  
  5. namespace Direct3D_Course
  6. {
  7.     public partial class Form1 : Form
  8.     {
  9.        private Device device;
  10.  
  11.         public Form1()
  12.         {
  13.             InitializeComponent();
  14.         }
  15.  
  16.         public void InitializeDevice()
  17.         {
  18.             PresentParameters presentParams = new PresentParameters();
  19.             presentParams.Windowed = true;
  20.             presentParams.SwapEffect = SwapEffect.Discard;
  21.             device = new Device(0, DeviceType.Hardware, this, CreateFlags.SoftwareVertexProcessing, presentParams);
  22.         }
  23.  
  24.         protected override void OnPaint(PaintEventArgs e)
  25.         {
  26.             device.Clear(ClearFlags.Target, Color.Azure, 1.0f, 0);
  27.             device.Present();
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment