Skip to content

62B63ABB

Marcel Härtel edited this page Aug 27, 2023 · 2 revisions

InvalidationControl Class

Inherit from this class in your custom class to create an invalidation control, which is selectable from the ToolBox during design time. It provides 'NO' game loop, but it's updated through invalidation (Invalidate()). You need to call 'Invalidate()' on a custom control by yourself to update its contents.

Remarks

This control is useful as a simple CPU gentle control, which doesn't need a classical game loop like a preview window for textures.

Definition

Namespace: MonoGame.Forms.NET.Controls
Assembly: MonoGame.Forms.NET (in MonoGame.Forms.NET.dll) Version: 3.2.0

C#

public abstract class InvalidationControl : GraphicsDeviceControl
Inheritance ObjectMarshalByRefObjectComponentControlGraphicsDeviceControl → InvalidationControl

Constructors

InvalidationControl Initializes a new instance of the InvalidationControl class

Properties

AlwaysEnableKeyboardInput If enabled the Keyboard input will work even if the current control has no focus (mouse cursor is outside of the control).
(Inherited from GraphicsDeviceControl)
BackColor Set the background color of this Control in the designer.
(Inherited from GraphicsDeviceControl)
Components Get the GameComponentCollection.
(Inherited from GraphicsDeviceControl)
Editor The InvalidationService of the InvalidationControl draws the actual content of the draw control.
ForeColor Set the foreground color of this Control in the designer.
(Inherited from GraphicsDeviceControl)
GraphicsProfile Set the GraphicsProfile in the property grid during Design-Time (HiDef or Reach). You shouldn't change this during runtime!
(Inherited from GraphicsDeviceControl)
IsMouseInsideControl Returns true when the mouse cursor is inside the control.
(Inherited from GraphicsDeviceControl)
Services Get the GameServiceContainer.
(Inherited from GraphicsDeviceControl)
SwapChainRenderTarget A swap chain used for rendering to a secondary GameWindow. Note: When working with different RenderTarget2D, you need to set the current render target back to the SwapChainRenderTarget as this is the real 'Back Buffer'. 'GraphicsDevice.SetRenderTarget(null)' will NOT work as you are doing usally in MonoGame. Instead use 'GraphicsDevice.SetRenderTarget(SwapChainRenderTarget)'. Otherwise you will see only a black control window.
(Inherited from GraphicsDeviceControl)

Methods

Dispose Disposes the contents of the attached Editor.
(Overrides GraphicsDeviceControl.Dispose(Boolean))
Draw Override to implement Drawing logic in your custom MonoGame.Forms.Control.
Initialize Override to implement Initialization logic in your custom MonoGame.Forms.Control.
IsMouseInsideControlArea Returns true when the mouse cursor is inside the specific area.
(Inherited from GraphicsDeviceControl)
OnClientSizeChanged Updates related Editor services when the ClientSize changes.
(Overrides GraphicsDeviceControl.OnClientSizeChanged(EventArgs))
OnCreateControl
(Inherited from GraphicsDeviceControl)
OnMouseEnter
(Inherited from GraphicsDeviceControl)
OnMouseLeave
(Inherited from GraphicsDeviceControl)
OnMouseWheel
(Inherited from GraphicsDeviceControl)
OnPaint
(Inherited from GraphicsDeviceControl)
OnPaintBackground
(Inherited from GraphicsDeviceControl)
OnVisibleChanged In case the ClientSize was changed before activating the control, the cam position gets updated according to this changes.
(Overrides Control.OnVisibleChanged(EventArgs))
PaintUsingSystemDrawing
(Inherited from GraphicsDeviceControl)
SetMultiSampleCount Set the "MultiSampleCount" for Multi Sampled AntiAlising (MSAA). The input value will be automatically clamped to the nearest power of two in relation of what the users GraphicsDevice can handle.
(Inherited from GraphicsDeviceControl)

Events

ComponentState Subscribe to get Update and Draw event info for all GameComponents (IUpdatable, IDrawable).
(Inherited from GraphicsDeviceControl)
ControlState Subscribe to get Update and Draw event info for this MonoGameControl.
MultiSampleCountRefreshed Subscribe to this event to react to MultiSampleCount changes in your custom controls.
(Inherited from GraphicsDeviceControl)
OnMouseWheelDownwards Scroll the mouse wheel downwards to trigger this event.
(Inherited from GraphicsDeviceControl)
OnMouseWheelUpwards Scroll the mouse wheel upwards to trigger this event.
(Inherited from GraphicsDeviceControl)

See Also

Reference

MonoGame.Forms.NET.Controls Namespace

Clone this wiki locally