mirror of
https://github.com/Leonmmcoset/CMLeonOS.git
synced 2026-03-03 15:30:27 +00:00
62 lines
1.2 KiB
C#
62 lines
1.2 KiB
C#
using Cosmos.System.Graphics;
|
|
using System.Drawing;
|
|
|
|
namespace CMLeonOS.Gui.UILib
|
|
{
|
|
internal class ImageBlock : Control
|
|
{
|
|
public ImageBlock(Window parent, int x, int y, int width, int height) : base(parent, x, y, width, height)
|
|
{
|
|
}
|
|
|
|
private Bitmap _image;
|
|
internal Bitmap Image
|
|
{
|
|
get
|
|
{
|
|
return _image;
|
|
}
|
|
set
|
|
{
|
|
_image = value;
|
|
Render();
|
|
}
|
|
}
|
|
|
|
private bool _alpha = false;
|
|
internal bool Alpha
|
|
{
|
|
get
|
|
{
|
|
return _alpha;
|
|
}
|
|
set
|
|
{
|
|
_alpha = value;
|
|
Render();
|
|
}
|
|
}
|
|
|
|
internal override void Render()
|
|
{
|
|
if (_image == null)
|
|
{
|
|
Clear(Color.Gray);
|
|
WM.Update(this);
|
|
return;
|
|
}
|
|
|
|
if (_alpha)
|
|
{
|
|
DrawImageAlpha(_image, 0, 0);
|
|
}
|
|
else
|
|
{
|
|
DrawImage(_image, 0, 0);
|
|
}
|
|
|
|
WM.Update(this);
|
|
}
|
|
}
|
|
}
|