Questions tagged [windows-forms]

Windows Forms is a graphical API of Microsoft .NET Framework, a wrapper providing access to native Microsoft Windows interface elements.

Filter by
Sorted by
Tagged with
35
votes
3answers
29k views

What is the standard C# / Windows Forms game loop?

When writing a game in C# that uses plain-old Windows Forms and some graphics API wrapper like SlimDX or OpenTK, how should the main game loop be structured? A canonical Windows Forms application has ...
7
votes
4answers
1k views

Game Editor - When screen is clicked, how do you identify which object that is clicked?

I'm trying to create a Game Editor, currently just placing different types of Shapes and such. I'm doing this in Windows Forms while drawing the 3D with XNA. So, if I have a couple of Shapes on the ...
6
votes
2answers
1k views

Is the viewport meant to be an absolute representation of where the underlying device is drawing?

I know this may sound like an odd question but I just wanted to confirm which way it is. Currently I am using XNA within Windows Forms (MDI) and I am just wondering about the viewport, as I have ...
5
votes
1answer
762 views

Does using [STAThread] with XNA have any negative implications?

I'm working on a game in XNA, which has an inbuilt level editor. To facilitate this I want use the FileOpenDialog from Winforms. I followed the instructions as per ...
4
votes
1answer
8k views

XNA + Windows Forms: How make them work together without making the trick of the custom GraphicsDeviceControl?

What I've found is a solution where you have to code a custom GraphicsDeviceControl to put inside the form (the well known tutorial from the APPHub), but that's not what I'm searching for. I would ...
4
votes
0answers
1k views

Developing user interface [closed]

i am beginner in graphic development and have no experience with it, i only developed always with standard win controls. Now i want to create interface in c# for my sports management simulation game, ...
3
votes
1answer
2k views

XNA mouse position in windows forms

I am using this code in Update method in XNA RenderControl in Windows Forms: ... Mouse.WindowHandle = renderControl1.Handle; MouseState stat=Mouse.GetState(); ... ...
2
votes
3answers
1k views

Stuck in an infinite recursion in Minesweeper

I am trying to build a simple minesweeper game. The game gets stuck in an infinite recursion whenever a user clicks on a tile which is not a mine... I have used the following function code for the ...
2
votes
1answer
795 views

Monitor external window events with SDL2

I'm trying to render my game (SDL2, C++) in a Windows Form application (C#) using C++/CLI to interface with my underlying C++ code. The purpose of the form is to create an editor which can monitor/...
2
votes
1answer
112 views

How can I show xna graphics content in a control on a form in xna?

I was able to create a form in xna using "Add Windows Form", named "Form1" then adding: ...
2
votes
3answers
308 views

In XNA, how do I get forms to display in front of my full-screen game?

I'm trying to open a form in front of my game, which is full-screen. However, the form seems to appear only behind the game window. At the moment, I'm doing this: ...
2
votes
3answers
1k views

Arrow key control on winforms RichTextBox

I am making a faux console using winforms for the game I am working on. Right now I am moving a '0' across the screen using the arrow keys. In order to provide fine grain formatting on the text, I ...
2
votes
2answers
2k views

What basic windows form games should I build as a newbie in game development? [closed]

I am a complete newbie in game development. I want to know about some basic games that I can start building with simple algorithms and basic knowledge. I have already made few basic games like ...
2
votes
2answers
216 views

Re-sizing the form without scaling the GUI

I am writing a turn based strategy game in C#. My GUI implementation consists of class that extends Form containing a class that extends Panel. When I render the GUI I draw to the paint method in ...
1
vote
2answers
301 views

Set vertex position

Can anyone tell me how to set the positions of model vertices? I want to be able to change the position of some of the vertices of a Model. Is there any way to make that happen? And make the changed ...
1
vote
2answers
626 views

How to show my XNA game in form C#

I have a game in XNA, I want to connect this game with WindowForm to show for example the distance and the position. I tried to apply many tutorials that talking about this. but here is my problem : ...
1
vote
2answers
228 views

Point[] and Tri not “could not be found”

Hi I'm trying to learn how to load a .obj file using OpenTK in windows Forms. I have seen a lot of examples out there, but I do see almost everyone uses ...
1
vote
2answers
312 views

Creating installer for WinForms XNA with compiled content

I have a Windows Forms application that uses a custom Graphics Device control based on Microsoft's "WinForms Series 1: Graphics Device" sample. The application makes use of a single model (the ...
1
vote
2answers
217 views

How do I replace the enemy with a different graphic when it gets hit?

I am able to draw my space ship and a an enemy (called "bug_one" in the code below) and move my bullet. When the bullet hits the enemy, it draws a collision bmp. But currently my code draws both the ...
1
vote
1answer
156 views

Bitmap drawn with Graphics.DrawImage flickers

I am working on a space invaders clone using bugs as aliens. Everything works ok but the bug bitmap flickers on the screen. ...
1
vote
1answer
556 views

System.Windows.Form.Control.FromHandle returns null for current window

I was following the book "XNA 4.0 Game Development By Example" and in the eighth chapter, the author adds windows form to an XNA game. I was following the book for a MonoGame project, but I get null ...
1
vote
2answers
294 views

Spritebatch not working in winforms

I'm using the Winforms sample on the app hub and everything is working fine except my spritebatch won't draw anything unless I call Invalidate in the Draw method. I have this in my initialize method: ...
1
vote
2answers
285 views

2D tilemap editor UI--how do I disable editing while save/load dialog is open?

I'm working on a basic 2D tilemap editor in C#/XNA. Currently, it displays the map through a picturebox through which XNA's output is being routed, and editing is accomplished through simply checking ...
1
vote
3answers
1k views

interaction with WinForm and Xna

Okay, this is may be very simple. I embedded my XNA project in WinForms through "this tutorial" and it works fine even with XNA 4. Now I have a 3D CoilSpring object and the number of loops for this ...
1
vote
1answer
243 views

Present fails randomly on mixed C++ Direct3D9 app

I have a mixed .NET application (managed and unmanaged code bridged by C++/CLI wrappers) which uses unmanaged Direct3D9 9.0c to do rendering inside a control which is wrapped inside a C++/CLI class ...
1
vote
1answer
186 views

Should have one device per application or per form when doing MDI Forms work with XNA?

I am just making a simple editor for a project I am working on and as part of this I need to add a few different MDI forms within a larger container form. Now the XNA (4.0) example Windows Forms ...
1
vote
1answer
63 views

How to properly manage game music and sounds?

I'm developing a WinForms customized version of Pac-Man for a Software Engineering project and I reached the point where I have to implement music and sound effects. I used the MVC architectural ...
1
vote
0answers
25 views

MonoGame minimises when I click on second game window

I've problem with my MonoGame project. I have one full-screen game window and one window form with some info (part of the game too). And the problem lies in when I click on the window form, the main ...
1
vote
0answers
281 views

Monogame intermediateSerializer with winforms

I want my xml files to be game ready on save in my winforms. Right now I am trying to serialize a simple object like this and it is accessing the XML file, but not outputting anything. Am I missing ...
1
vote
1answer
61 views

Strange anomalies when using WinForms with XNA

I haven't seen any questions related to my issue, and this leads me to believe I'm missing something minor, however; The Problem I'm creating a game that is effectively launched from a windows form. ...
1
vote
0answers
128 views

Custom Keyboard run by Arduino not working in XNA

I'm trying to make a stenotype-teaching game using the stenoboard as input. The Stenoboard emulates an NKRO keyboard, using this code: https://github.com/caru/StenoFW/blob/master/StenoFW.ino, with an ...
1
vote
2answers
2k views

Winform + XNA (Microsoft Example) - Issues with Drawing Texture2D

Before I get started I would just like to say that I have been using the Microsoft Winform + Xna examples found here: WinForms Series 1: Graphics Device I think I somewhat understand how its working ...
0
votes
2answers
2k views

How can I guarantee a solvable Fifteen Puzzle shuffle?

I am making a 15 Puzzle game in C# that allows the user to enter a custom row and column value up to a maximum of a 10 x 10 puzzle. I am having problems with the shuffle method. I want to make it so ...
0
votes
1answer
1k views

Problems when randomizing x and y position of a picturebox [closed]

So, I'm making a simple game. It's like snake but the picturebox doesn't grow. In the game, you have to get fruits and other objects. Look at berry's code: ...
0
votes
2answers
182 views

MenuStrip in XNA 4.0

Is it possible to place a MenuStrip into a XNA 4.0 project. This project is intended for PC-s only and I already have openFile dialogs, but I cant get the MenuStrip drawn. If this is not possible what ...
0
votes
4answers
265 views

How do I move the paddle with the arrow keys?

I am making a pong game using gdi+ and c#. I want to move the paddle using the arrow keys by using the move variable, but it does not work; the paddle does move when I use the int move=0; global ...
0
votes
1answer
73 views

Monogame sprite rotation issue

I'm having interesting problem with rotating a sprite in MonoGame. Here is how origin, destination rectangle and scale are created: ...
0
votes
1answer
339 views

Write my own level editor, questions [closed]

I just finished to code the most important parts of my game engine (not a tile-map one), such as lights, shadows, objects update/draw, input, ecc. Now I'm making a level editor to simplify the ...
0
votes
1answer
583 views

Multiple glControl on same winform is not working - OpenTK C#

I have to show frames from two cameras in two openGl control separately at same time. For that I have put two opengl control in my form and pass those frames to opengl accordingly. But when running ...
0
votes
2answers
171 views

How do I hide the bug image once it's hit by a bullet?

I have almost solved my problem. I am able to shoot a bullet and hit a bug and it then draws a collision bitmap. but then it redraws a bug, I want to clear the bug bitmap after the collision happens. ...
0
votes
1answer
877 views

Windows Forms game loop

There is a very good game loop in the link which is tailored for windows forms. I need it in c++/cli so I converted the code as below. Here is my main loop. ...
0
votes
1answer
266 views

Stuck the ball in the board (pingpong game)

this game isn't completed yet, i've created the part where the ball hits the board, but there's problem in playing and that's the ball stucking in the board. For a better comprehension and ...
0
votes
1answer
627 views

How can I load another form containing a new level when my player reaches the current level's exit?

I am coding a very basic side-scrolling game in C#, using Windows Forms. I want to connect my game's levels with 'exit points'. When the player touches an exit point, a new form should be loaded ...
0
votes
1answer
326 views

How to call game Update from another form

I have three projects in one solution: a form with some tool (see it as a level-editor), in which there is PictureBox where I want to redirect drawing of the game. My game, with some methods and its ...
0
votes
1answer
888 views

Client Server Multiplayer Project

I have reviewed the relevant WinForms/XNA samples here and here. However, my requirements are slightly different. Given the following: I am developing a multiplayer (Client - Server) game There ...
0
votes
2answers
220 views

Windows Form code not executing?

Ok, I've got a weird one here. I'm trying to make a basic tile engine using a windows form, but some of my code is just...not happening. I'll post the chunks in question. ...
0
votes
2answers
2k views

Thread problem updating Windows Forms control in XNA C#

I'm development a network card game, and for now i've two players connected but there is a problem with one of them, this one can't do anything on the game. Looks that screen was blocked. I'm think ...
0
votes
0answers
17 views

Getting a control name/Displaying tooltip text

I am developing a character creator using Windows Forms (because apparently I can't create menus in Unity), and I want to display some tips and descriptions in a ...
0
votes
1answer
595 views

How do I handle window resizing in SlimDX?

I'm considering the use of SlimDX in a managed Windows Forms Application. Available with DirectX is DXUT. I use DXUT to handle events such as window resizing and 'lost devices.' How well does SlimDX ...
0
votes
0answers
60 views

Invalidate not working (winforms & xna) [duplicate]

I'm using winforms with xna. Everything's working so far except for the drawing because invalidate won't refresh the screen unless repeated. This is the initial code I had: ...