Im starting to learn Managed Direct X and Im having a little problem.
Im using a pictureBox as the device and I have other components in my window as well. When I run my application none of the other components show up; instead, I have empty rectangles and I can see whatever is behind my form(i.e. the Visual Studio window)
Does anybody know why this happen? Im overriding the OnPaint method like this:
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
device.Clear(ClearFlags.Target, System.Drawing.Color.CornflowerBlue, 1.0f, 0);
SetupCamera();
// some code to draw something
device.BeginScene();
device.VertexFormat = CustomVertex.PositionColored.Format;
device.DrawUserPrimitives(PrimitiveType.TriangleList, 1, verts);
device.EndScene();
device.Present();
this.Invalidate();
}
Im using a pictureBox as the device and I have other components in my window as well. When I run my application none of the other components show up; instead, I have empty rectangles and I can see whatever is behind my form(i.e. the Visual Studio window)
Does anybody know why this happen? Im overriding the OnPaint method like this:
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
device.Clear(ClearFlags.Target, System.Drawing.Color.CornflowerBlue, 1.0f, 0);
SetupCamera();
// some code to draw something
device.BeginScene();
device.VertexFormat = CustomVertex.PositionColored.Format;
device.DrawUserPrimitives(PrimitiveType.TriangleList, 1, verts);
device.EndScene();
device.Present();
this.Invalidate();
}