C# Class TransvoxelXnaStudio.Host.GraphicsDeviceControl

Custom control uses the XNA Framework GraphicsDevice to render onto a Windows Form. Derived classes can override the Initialize and Draw methods to add their own drawing code.
Inheritance: System.Windows.Forms.Control
Mostrar archivo Open project: BinaryConstruct/Transvoxel-XNA

Protected Properties

Property Type Description
graphicsDeviceService GraphicsDeviceService

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Disposes the control.

Draw ( ) : void

Derived classes override this to draw themselves using the GraphicsDevice.

EndDraw ( ) : void

Ends drawing the control. This is called after derived classes have finished their Draw method, and is responsible for presenting the finished image onto the screen, using the appropriate WinForms control handle to make sure it shows up in the right place.

Initialize ( ) : void

Derived classes override this to initialize their drawing code.

OnCreateControl ( ) : void

Initializes the control.

OnPaint ( PaintEventArgs e ) : void

Redraws the control in response to a WinForms paint message.

OnPaintBackground ( PaintEventArgs pevent ) : void

Ignores WinForms paint-background messages. The default implementation would clear the control to the current background color, causing flickering when our OnPaint implementation then immediately draws some other color over the top using the XNA Framework GraphicsDevice.

OnSizeChanged ( EventArgs e ) : void
PaintUsingSystemDrawing ( Graphics graphics, string text ) : void

If we do not have a valid graphics device (for instance if the device is lost, or if we are running inside the Form designer), we must use regular System.Drawing method to display a status message.

Private Methods

Method Description
BeginDraw ( ) : string

Attempts to begin drawing the control. Returns an error message string if this was not possible, which can happen if the graphics device is lost, or if we are running inside the Form designer.

HandleDeviceReset ( ) : string

Helper used by BeginDraw. This checks the graphics device status, making sure it is big enough for drawing the current control, and that the device is not lost. Returns an error string if the device could not be reset.

Method Details

Dispose() protected method

Disposes the control.
protected Dispose ( bool disposing ) : void
disposing bool
return void

Draw() protected abstract method

Derived classes override this to draw themselves using the GraphicsDevice.
protected abstract Draw ( ) : void
return void

EndDraw() protected method

Ends drawing the control. This is called after derived classes have finished their Draw method, and is responsible for presenting the finished image onto the screen, using the appropriate WinForms control handle to make sure it shows up in the right place.
protected EndDraw ( ) : void
return void

Initialize() protected abstract method

Derived classes override this to initialize their drawing code.
protected abstract Initialize ( ) : void
return void

OnCreateControl() protected method

Initializes the control.
protected OnCreateControl ( ) : void
return void

OnPaint() protected method

Redraws the control in response to a WinForms paint message.
protected OnPaint ( PaintEventArgs e ) : void
e PaintEventArgs
return void

OnPaintBackground() protected method

Ignores WinForms paint-background messages. The default implementation would clear the control to the current background color, causing flickering when our OnPaint implementation then immediately draws some other color over the top using the XNA Framework GraphicsDevice.
protected OnPaintBackground ( PaintEventArgs pevent ) : void
pevent PaintEventArgs
return void

OnSizeChanged() protected method

protected OnSizeChanged ( EventArgs e ) : void
e System.EventArgs
return void

PaintUsingSystemDrawing() protected method

If we do not have a valid graphics device (for instance if the device is lost, or if we are running inside the Form designer), we must use regular System.Drawing method to display a status message.
protected PaintUsingSystemDrawing ( Graphics graphics, string text ) : void
graphics System.Drawing.Graphics
text string
return void

Property Details

graphicsDeviceService protected_oe property

protected GraphicsDeviceService,TransvoxelXnaStudio.Host graphicsDeviceService
return GraphicsDeviceService