Extending Controls

From Pointui

It’s possible to inherit from the available controls and extend them. The following shows a simple example where a new class called OverlayImage extends the capabilities of the default Image class to merge an overlay image onto the actual image:

class OverlayImage : Image
{
	void UpdateImage(String filename, String overlayFilename)
	{
		//load the image
		Surface.LoadFromFile(filename);
 
		//load the overlay image
		Surface overlay;
		overlay.LoadFromFile(overlayFilename);
 
		//draw the overlay onto the image
		Renderer.Draw(Surface, overlay, 0, 0);
	}
}