Do you tried the tutorial from the readme file of the git repo?
It should successfully lead you through the creation process of a custom control. When you build your solution the corresponding toolbox item will appear automatically inside your toolbox.
If this doesn’t work for you, can you please tell me if you are receiving any sort of error messages when trying to drag and place a custom control?
Ok, so when you create your control class it generates the MonoGame.Forms control successfully but it isn’t possible for you to drag this control onto the designer.
I just tried the tutorial from the readme and it still works for me in Visual Studio 2015 and Visual Studio 2017. In the moment it’s not possible for me to reproduce this issue.
Some questions:
Are you using the NuGet or source from GitHub?
Are you creating a fresh Windows Forms project with just MonoGame.Forms specific stuff referenced?
Can you drag and drop Windows Forms native controls from the toolbox onto the designer?
Can you upload your project somewhere so I can take a look?
Updated the MonoGame.Framework to bring back Mouse.GetState() functionallity from the MonoGame.Framework, which got overriden by the newer develop branch of MonoGame.Framework 3.8.0.270.
I just released this update as a hotfix because I detected that Mouse.GetState() always had the default values.
wasn’t merged so far. Back in time this PR solved the problem, that when using the MonoGame.Framework independently from its Game class, the user wouldn’t have had any mouse input events through Mouse.GetState() in his editor environment anymore.
This PR seemed good to me to become merged, but instead it became closed and I don’t know why, because it’s actually pretty helpful and, as far as I can see, it wouldn’t have had broken game specific stuff. But who knows, maybe i’m wrong.
Both will work to create an editor but there there are many differences between them.
WPF is a newer technology, WinForms is older.
WPF uses an XML based language called XAML, WinForms generates code based designer files.
If you use WPF you’ll learn about things like MVVM using a declarative Binding based approach, WinForms is all C# code (at first it feels easier, but many people prefer the declarative XAML based approach).
You can embed MonoGame into either, but doing so requires different code (if you look around you can find other people that have done this).
Both technologies are Windows based, although there are projects around to try and make them multi-platform (I’ve never seen one that works really well though).
There is a sample program which shows you how to use it together with MonoGame.
The advantage here is that you can integrate it into a DesktopGL project which makes your editor available on multiple platforms without extra work.
I also managed to make it work with MonoGame.Forms so you would have additional designing options in a WindowsForms environment, where it’s often painful to design things (like a property grid).
Another advantage is that you can still use WindowsForms controls / user controls or file dialogs which makes working with directories and files pretty easy.
But in the end it really depends on your ambition and technology knowledge. I would say:
Are you skilled with WPF? Then try to create your editor with the MonoGame.WpfInterop.
You just want a little tool window for manipulating level files? Maybe then MonoGame.Forms is simple enough.
You want a full blown multi platform editor? Maybe then you should try the ImGui.Net library with the MonoGame.Framework.
Are you experienced with WindowsForms but not with WPF and you want fast results without missing designing capabilities? Well, I can show you how to integrate ImGui.Net into a MonoGame.Forms project.
how rendertarget work on MonoGame.Forms. When i try to use do my rendertarget, it show red color output. 2nd Question can Mouse.GetState() work in Monogame.form?
It works likewise but you need to set the render target back to the SwapChainRenderTarget afterwards (GraphicsDevice.SetRenderTarget(SwapChainRenderTarget))
Added void RunFrames(int) to run a specific amount of frames of a MonoGameControl, when the bool MouseHoverUpdatesOnly was set to true.
Open up the ResourceContentManager to enable content loading from a resource file .
Using void ResourceContentManagerInitialize(ResourceManager) to initialize the ResourceContentManager, which is available for the user to load custom content from a resource file (.resource).
Property bool IsMouseInsideControl is now directly accessible through the GraphicsDeviceControl, so there is no need of using the editor service class for this.
Added protected bool IsMouseInsideControlArea(int, int, int, int), so the user can check if the mouse cursor is inside a specific control area.
Reattaching the Mouse.WindowHandle when entering a different GraphicsDeviceControl in case it gets lost.