Added the bool property “AutomaticInvalidation” to the DrawWindow and UpdateWindow / GameControl classes, so it’s possible to turn the invalidation of the controls on and off.
This is useful when working with NodeGraphEditors where the automatic invalidations would block the whole NodeGraph.
Disabling AutomaticInvalidation on an UpdateWindow now also blocks the GameLoop (update logic) to further enhance performance when using multiple MonoGame.Forms controls.
MonoGame.Forms 1.6.3.0 - DisplayStyle & DebugInfo per Control
Added DisplayStyle enumeration with the options to place the integrated display in the TopLeft or TopRight corner using the new SetDisplayStyle property, which defaults to TopLeft.
Moved Settings values to GFXService to turn the display options on and off for each custom control individual. The old static Settings class was removed from the class library.
Private display style members according to the changes in IGFXInterface, where the user shouldn’t be confused with basically internal properties.
The ServiceContainer class now checks if a specific service was already added to the services dictionary to prevent a crash after reinitializing a custom control.
Fixed that on reinitializing a custom control of the type UpdateWindow, the GameLoop function was reatached multiple times to the Application.Idle event, which caused that the Update method in custom controls was also called multiple times accordingly.
Fixed that on reinitializing a custom control of the type UpdateWindow also reinitialized the StopWatch, which sets the elapsed time to 0 and so could possibly cause errors in the GameLoop.
Moved the bool AutomaticInvalidation to the GraphicsDeviceControl as it is used by all custom controls.
Added the protected event Action<SwapChainRenderTarget> to the GraphicsDeviceControl to reflect the changes on window resizing and giving the editor service classes the new SwapChainRenderTarget. This fixes a NullReferenceException when working with RenderTargets in custom controls.
It’s now possible to change the font color of the integrated display.
But nothing actually happens when I use the mouse wheel. I noticed similiar code in the MapHost source from the samples, but when running it, the mousewheel also does not do anything.
Please check if the mouse cursor is inside the control of the MapHost when using the mouse wheel. The event won’t be triggered if the mouse cursor is outside of the control.
You could check if the event triggers by placing a breakpoint in the OnMouseWheelUpwards event.
I’ve tried it with the mouse cursor inside the control, and it doesn’t trigger any breakpoints I put on the event. I tried getting a fresh copy of the sample project to make sure I hadn’t made any changes to it as well.
I can get around not using the mouse wheel, but I guess I just found it kinda weird since it looks like it should be working.
Correct. All of those do work, including clicking the mouse wheel button to re-center the map image. It just seems to be scrolling the mouse wheel that isn’t working.
I already applied a patch on the dev branch (not public). It will be available on the master branch in the next iteration of MonoGame.Forms, so you don’t need to fiddle around with OnMouseEnter and OnMouseLeave in your custom controls.
MonoGame.Forms 1.6.5.0 - MouseWheel Event Fixes and DebugPanel
Added the public Texture Pixel and the public Color DisplayBackColor to draw a panel behind the text of the integrated display and make them useable by the end user.
Also rewrote the drawing logic of the integrated display accordingly.
Fixed that the MouseWheel events didn’t fire for some users, because custom controls didn’t get Focus() when the mouse cursor entered a custom control.
Set the cached float FontHeight in GFXService to public as it is also useful in custom controls, when working with the integrated display font.
Relative and absolute MousePositions switched from Microsoft.Xna.Framework.Vector2 to System.Drawing.Point, as it’s more fluent in a WindowsForms environment.
Added protected bool IsMouseInsideControl to the GraphicsDeviceControl, so that it’s easily possible to check if the mouse cursor is inside a (resized) control.
MonoGame.Forms 1.6.5.1 - Removed IGFXInterface and added global MousePositions
Access modifier of UpdateFrameCounter() and UpdateDisplay() are now internal.
Removed IGFXInterface as it’s not needed anymore.
Added internal void UpdateMousePositions to the GraphicsDeviceControl and calling it in the DrawWindow and UpdateWindow (GameControl) to make them available in all custom controls through the Editor service classes.
This makes it possible to use the relative- and absolute mouse positions in the DrawWindow (updated through invalidation).