mirror of
https://github.com/Leonmmcoset/CMLeonOS.git
synced 2026-03-03 15:30:27 +00:00
GUI桌面环境
This commit is contained in:
61
Gui/UILib/ImageBlock.cs
Normal file
61
Gui/UILib/ImageBlock.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user