SleepingTroll Posted February 14, 2012 Posted February 14, 2012 (sorry about the repost, just realized the original was in the wrong place) I create a form and it displays fine, however as soon as I create my directX device the form stops displaying! Here is my code, please note that I can eliminate all of the DirectX code and the form displays, however just the line 'private Device device = null;' will prevent my form from displaying. using System; using System.Drawing; using System.Windows.Forms; using Microsoft.DirectX; using Microsoft.DirectX.Direct3D; namespace Model { public partial class MainForm : Form { private Device device = null; public MainForm() { InitializeComponent(); InitializeDevice(); } 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(); } } } I am new at directX and will likely stay that way if I can't get by this! Quote
Leaders snarfblam Posted February 14, 2012 Leaders Posted February 14, 2012 Is there a reason why you are creating a reference device? I can't how this could cause a problem, but it seems unusual. The problem might be related to the fact that you are creating the device before your form creates its handle. Try calling the InitializeDevice method from the OnLoad event method rather than the constructor. Quote [sIGPIC]e[/sIGPIC]
SleepingTroll Posted February 17, 2012 Author Posted February 17, 2012 (edited) I do have more info, although it is not encouraging... It would seem that the compiler is having a problem with the DirectX framework, when it references it, it goes into limbo! I am redownloading the framework, somehow though... I don't expect that this is a solution, any ideas greatly appreciated! AHA! When searching for the DirectX download I was directed(no pun intended) to DirectX 11! Downloading Version 9 now... I can't imagine all the trouble this is going to cause for nubes like myself... Edited February 17, 2012 by SleepingTroll Quote
SleepingTroll Posted February 24, 2012 Author Posted February 24, 2012 I found my solution! app.cfg needs to read like this... <startup useLegacyV2RuntimeActivationPolicy="true"> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> </startup> Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.