Click here to Skip to main content
15,916,019 members
Home / Discussions / C#
   

C#

 
GeneralRe: SQL and loops Pin
mhmo27-Jun-05 22:35
mhmo27-Jun-05 22:35 
GeneralRe: SQL and loops Pin
J4amieC28-Jun-05 2:48
J4amieC28-Jun-05 2:48 
GeneralRe: SQL and loops Pin
Matt Gerrans28-Jun-05 9:42
Matt Gerrans28-Jun-05 9:42 
GeneralRe: SQL and loops Pin
mhmo28-Jun-05 19:30
mhmo28-Jun-05 19:30 
GeneralADOX table Pin
Bruzak27-Jun-05 19:43
Bruzak27-Jun-05 19:43 
GeneralMultiple Forms Pin
Shashidharreddy27-Jun-05 19:39
Shashidharreddy27-Jun-05 19:39 
GeneralRe: Multiple Forms Pin
Christian Graus27-Jun-05 19:49
protectorChristian Graus27-Jun-05 19:49 
GeneralNeed help in C#.NET 2005 beta 2 Pin
tom_dx27-Jun-05 15:03
tom_dx27-Jun-05 15:03 
using System;<br />
using System.Drawing;<br />
using System.Windows.Forms;<br />
using Microsoft.DirectX;<br />
using Microsoft.DirectX.Direct3D;<br />
<br />
<br />
namespace XSkate<br />
{<br />
	public partial class MainForm : Form<br />
	{<br />
		Device device = null; // Our rendering device<br />
<br />
		public MainForm()<br />
		{<br />
			InitializeComponent();<br />
		}<br />
<br />
		public bool InitializeGraphics()<br />
		{<br />
			try<br />
			{<br />
				PresentParameters presentParams = new PresentParameters();<br />
				presentParams.Windowed = true;<br />
				presentParams.SwapEffect = SwapEffect.Discard;<br />
				device = new Device(0, DeviceType.Hardware, this, CreateFlags.HardwareVertexProcessing, presentParams);<br />
				return true;<br />
			}<br />
			catch (DirectXException)<br />
			{<br />
				DisplayError("Could not initialize Direct3D, now exiting.", true);<br />
				return false;<br />
			}<br />
		}<br />
<br />
		private void Render()<br />
		{<br />
			if (device == null)<br />
			{<br />
				return;<br />
			}<br />
<br />
			device.Clear(ClearFlags.Target, System.Drawing.Color.Blue, 1.0f, 0);<br />
			device.BeginScene();<br />
<br />
			// Rendering of scene objects can happen here<br />
<br />
			device.EndScene();<br />
			device.Present();<br />
		}<br />
<br />
		protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)<br />
		{<br />
			this.Render();<br />
		}<br />
<br />
		protected override void OnKeyPress(System.Windows.Forms.KeyPressEventArgs e)<br />
		{<br />
			if ((int)(byte)e.KeyChar == (int)System.Windows.Forms.Keys.Escape)<br />
			{<br />
				this.Close();<br />
			}<br />
		}<br />
<br />
		static void Main()<br />
		{<br />
			using (MainForm frm = new MainForm())<br />
			{<br />
				if (!frm.InitializeGraphics())<br />
				{<br />
					return;<br />
				}<br />
<br />
				frm.Show();<br />
<br />
				while (frm.Created)<br />
				{<br />
					frm.Render();<br />
					Application.DoEvents();<br />
				}<br />
			}<br />
		}<br />
<br />
		private void DisplayError(string Message, bool Fatal)<br />
		{<br />
			if (Fatal)<br />
			{<br />
				MessageBox.Show(Message, "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);<br />
			}<br />
			else<br />
			{<br />
				MessageBox.Show(Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);<br />
			}<br />
		}<br />
	}<br />
}


It works but I don't know why the console window pops up along with the form, I don't want it to but what am I doing wrong? I am using Visual C#.NET 2005 beta 2, plz help, this is all the code I have in the project, except for the form code which is probably unnecessary for this problem, again plz help. Frown | :( confused:Confused | :confused:

IM PROUD TO BE A GMAIL;
GeneralRe: Need help in C#.NET 2005 beta 2 Pin
S. Senthil Kumar27-Jun-05 16:29
S. Senthil Kumar27-Jun-05 16:29 
GeneralRe: Need help in C#.NET 2005 beta 2 Pin
Christian Graus27-Jun-05 16:39
protectorChristian Graus27-Jun-05 16:39 
GeneralRe: Need help in C#.NET 2005 beta 2 Pin
tom_dx28-Jun-05 6:24
tom_dx28-Jun-05 6:24 
GeneralRe: Need help in C#.NET 2005 beta 2 Pin
tom_dx28-Jun-05 6:40
tom_dx28-Jun-05 6:40 
GeneralManipulating TreeView Nodes and C# Pin
crazy_girl27-Jun-05 13:13
crazy_girl27-Jun-05 13:13 
GeneralRe: Manipulating TreeView Nodes and C# Pin
S. Senthil Kumar27-Jun-05 16:31
S. Senthil Kumar27-Jun-05 16:31 
GeneralRe: Manipulating TreeView Nodes and C# Pin
crazy_girl29-Jun-05 6:40
crazy_girl29-Jun-05 6:40 
GeneralUsing Passport .NET for SSI Pin
dgap27-Jun-05 13:07
dgap27-Jun-05 13:07 
Generalgraphics.Clear(color) - Incorrect color! Pin
redact20727-Jun-05 9:26
redact20727-Jun-05 9:26 
GeneralRe: graphics.Clear(color) - Incorrect color! Pin
Daniel Monzert27-Jun-05 10:01
Daniel Monzert27-Jun-05 10:01 
GeneralRe: graphics.Clear(color) - Incorrect color! Pin
redact20727-Jun-05 10:20
redact20727-Jun-05 10:20 
GeneralRe: graphics.Clear(color) - Incorrect color! Pin
Dan Neely27-Jun-05 10:47
Dan Neely27-Jun-05 10:47 
GeneralRe: graphics.Clear(color) - Incorrect color! Pin
Roger Alsing28-Jun-05 2:30
Roger Alsing28-Jun-05 2:30 
GeneralRe: graphics.Clear(color) - Incorrect color! Pin
Anthony Baraff28-Jun-05 2:32
Anthony Baraff28-Jun-05 2:32 
GeneralRichTextBox, manipulating RTF directly Pin
Daniel Monzert27-Jun-05 7:31
Daniel Monzert27-Jun-05 7:31 
GeneralUser Control MouseEnter MouseLeave Problems Pin
notacake27-Jun-05 6:36
notacake27-Jun-05 6:36 
GeneralRe: User Control MouseEnter MouseLeave Problems Pin
david cohoon27-Jun-05 7:38
david cohoon27-Jun-05 7:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.