MonoGame.Forms - Create your Editor Environment!

Do you placed the DrawWindow control on a Panel with scroll bars enabled?

Because normally you wouldn’t have scroll bars on a MonoGame.Forms control.

Yeah, the DrawWindow is inside a smaller panel, which is what’s being scrolled around.

I’ve not tested this with MonoGame.Forms but i’m pretty sure it’s a bug in WindowsForms.

I once had a simular issue with a different library and scrollable panels.

You can fix this issue by creating your own Panel class like this:

public class PanelNoScrollOnFocus : Panel
{
    protected override System.Drawing.Point ScrollToControl(Control activeControl)
    {
        return DisplayRectangle.Location;
    }
}

And place the MonoGame.Forms control onto this new Panel.

I hope this also fixes your issue.

Yup, that works. Thank you!

1 Like

Created an issue for it together with the solution to inform other users:

Test: MonoGame.Framework + Libretro + MonoGame.Forms


In my last post I talked about the guy who wanted to create a GameBoy Emulator with MonoGame.Forms and - coincidentally (hacked my SNES MINI and installed RetroArch on it) - I just played around a little - literally:

There are no P/Invokes for embding a window of a different emulator application or such tricks; an original Super Mario World.sfc rom was natively loaded using the snes9x_libretro.dll core.

Using the LibretroAPI it was possible to get the Framebuffer and process this data to a Texture2D which I then draw using the SpriteBatch of MonoGame.

I also converted the GamePadState to be used with Libretro, so that I can use my Xbox360 gamepad to control the SNES rom.

With Libretro it’s also possible to load different cores such as for a GameBoy, Playstation and so on, so that it would become possible to create an application like RetroArch.

RetroArch is - by the way - the official frontend of Libretro. With that in mind MonoGame would be the frontend of Libretro using a c# wrapper of Libretro. You can find one here (the one which inspired me).

I just thought to share this with you because it’s interesting and fun, isn’t it? :wink:

3 Likes

I tried the demo latest version from github. but why it’s flickering? (Solved with latest version)

Hey @11110 and thanks for reporting this issue!

Fortunately this bug was only in the test project of MonoGame.Forms and I already fixed it.

Just download the new version from GitHub and you are good to go.

All the NuGet packages and the core libraries are still working as before.

Cheers! :slight_smile:

PS: Can you please delete the flickering image from your last post? Because some people have problems with seeing flickering images. This would be very polite :wink: Thank you very much!

2 Likes

Thanks for update :slight_smile:

1 Like

anyway to increase draw interval in directx? current is only 60fps

There is no built-in solution.

Currently the game loop of MonoGame.Forms is simply attached to the Application.Idle event (See explanation on StackOverflow).

will it possible to have built-in interval control in the future?

There is a built-in intervall for the OpenGL version. But even if you set it to 1ms the fps are around 60fps.

It would be the same for the WindowsDX version of the library, because the content already renders as soon as the application enters the idle state. This at least leads to a smooth editing experience.

But i’m always open to see different approaches, when they are practical enough.

But without it, it will be hard to measure the potential framerate. Is there any other option without using idle state

Hello Sir sqrMin1^_^y may I ask how do you set GraphicsProfile to HiDef when in winform where there is no Game instance and can’t create a GameDeviceManager ?

Heyya @DexterZ :wink:

Take a look at this post (expand it to see a picture):

In MonoGame.Forms this is a property since v1.5.7. You can set it during design time.

2 Likes

Cool that was fast… I’ll take a look… many thanks Sir ^_^y

Early Celebration - 10k views!

Despite the fact that MonoGame.Forms birthday is in November, we have already reached 10.000 views here in the MonoGame community!

I want to thank you all for your support and great suggestions / ideas to make this library more awesome by doing a recap with some important milestones and stats we’ve achieved.

So… Let’s start!


MonoGame.Forms library recapitulation

  • Age: 11 Months
  • Support: 11 Months

Stats:

MonoGame Community:

  • 10.000 Views
  • 62 Likes on:
  • 142 Replies with:
  • 36 Minutes estimated read time and:
  • 95 Links posted

GitHub:

  • 270 Commits
  • 51 Stars
  • 155 Wiki Pages
  • 18 Releases
  • ~840 Views (per month)
  • ~150 Unique Visitors (per month)

NuGet:

MonoGame.Forms (old Core):

  • 2014 Total Downloads
  • 6 Downloads Per Day (avg)

MonoGame.Forms.DX:

  • 204 Total Downloads
  • 2 Downloads Per Day (avg)

MonoGame.Forms.GL:

  • 161 Total Downloads
  • 2 Downloads Per Day (avg)

Most Important Milestones:

GitHub Releases:

  • Native Mouse & Keyboard Input [ 1.5 ]
  • Window Resizing [ 1.6 ]
  • Antialising (MSAA) [ 1.6.5.3 ]
  • Render Target Manager (DX) [ 1.6.7.1 ]
  • DirectX and OpenGL (Multi Platform Support) [ 2.0 ]
  • Audio Support [ 2.1 ]

I hope you enjoyed this little recap and that you raise a little glass or two! :beers: :coffee: :tea: :tropical_drink: :grin:

Have a nice day and take care! :heart:

Long live MonoGame.Forms! (hrhrhr)

7 Likes

Hi, sqrMin1. Here’s the situation I bumped into when following github’s README.md:
vs2017 complained that it can’t instantiate abstract class MonoGame.Forms.Controls.DrawWindow when adding DrawTest into toolbox.

Hey @Jack-Ji and thanks for your message!

I just tried the tutorial from the Readme with Visual Studio 2017 and for me it works.

Please try to delete any possible references from the designer class and close visual studio. Reopen it and clean & rebuild your solution. Then try again to place the generated DrawTest control directly onto the form.

Trying this with VS17 helped me to find a different (and interesting) bug by the way:

I don’t know why it is like that but when creating a MonoGame control the OnCreateControl() function is getting called 2 times instead of 1 time like in VS15, but the second time it getting called the ClientSize.Width and ClientSize.Height are both 0, which leads to a -> System.ArgumentOutOfRangeException: “Texture width must be greater than zero” in the SwapChainRenderTarget ctor.

For me this is a weired behavior of VS17. Does anyone know why VS17 is doing this? Would be nice to know.

Anyway, I will push a fix soon by checking that the ClientSize is greater than 0 before creating the control.

Edit: The fix is up! Corresponding nuget packages are updated accordingly.