Обновление формы просмотра
This commit is contained in:
@@ -26,6 +26,20 @@ internal class EntityTreeViewerControlRow
|
||||
}
|
||||
private Image? _cache;
|
||||
|
||||
public Image HoveredCache
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_hoveredCache == null)
|
||||
{
|
||||
UpdateCache();
|
||||
}
|
||||
return _hoveredCache!;
|
||||
}
|
||||
set => _hoveredCache = value;
|
||||
}
|
||||
private Image? _hoveredCache;
|
||||
|
||||
public List<LadderType> Ladder
|
||||
{
|
||||
get => _ladder;
|
||||
@@ -92,6 +106,11 @@ internal class EntityTreeViewerControlRow
|
||||
get => ParentControl.ButtonSize;
|
||||
set => ParentControl.ButtonSize = value;
|
||||
}
|
||||
public float TypeFontSize
|
||||
{
|
||||
get => ParentControl.TypeFontSize;
|
||||
set => ParentControl.TypeFontSize = value;
|
||||
}
|
||||
|
||||
// ValueText functions
|
||||
|
||||
@@ -120,7 +139,9 @@ internal class EntityTreeViewerControlRow
|
||||
return result;
|
||||
}
|
||||
}
|
||||
public Font TypeFont => new(Font.FontFamily, Font.Size * 0.6f, FontStyle.Italic);
|
||||
|
||||
// public Font TypeFont => new(Font.FontFamily, TypeFontSize, FontStyle.Italic);
|
||||
public Font TypeFont => new(Font.FontFamily, TypeFontSize);
|
||||
|
||||
public string ValueText => Item.GetValueString();
|
||||
public Font ValueFont =>
|
||||
@@ -181,21 +202,29 @@ internal class EntityTreeViewerControlRow
|
||||
|
||||
public void UpdateCache()
|
||||
{
|
||||
Cache = new Bitmap(Width, Height);
|
||||
Graphics g = Graphics.FromImage(Cache);
|
||||
Cache = RenderCache(BackColor);
|
||||
HoveredCache = RenderCache(HoverColor);
|
||||
}
|
||||
|
||||
private Image RenderCache(Color backColor)
|
||||
{
|
||||
Image cache = new Bitmap(Width, Height);
|
||||
Graphics g = Graphics.FromImage(cache);
|
||||
|
||||
g.FillRectangle(new SolidBrush(backColor), 0, 0, Width, Height);
|
||||
|
||||
RenderLadder(g);
|
||||
RenderContent(g);
|
||||
|
||||
g.Save();
|
||||
return cache;
|
||||
}
|
||||
|
||||
public void Invalidate(Graphics? g = null)
|
||||
{
|
||||
g ??= Graphics.FromImage(ParentControl.ContentImage);
|
||||
|
||||
g.FillRectangle(new SolidBrush(Hovered ? HoverColor : BackColor), Target);
|
||||
g.DrawImage(Cache, Target);
|
||||
g.DrawImage(Hovered ? HoveredCache : Cache, Target);
|
||||
|
||||
UpdateButton();
|
||||
}
|
||||
@@ -329,6 +358,7 @@ internal class EntityTreeViewerControlRow
|
||||
_ => ForeColor,
|
||||
},
|
||||
StructureFieldEnum => BlendColor(Color.Red),
|
||||
StructureFieldNull => BlendColor(BackColor),
|
||||
_ => ForeColor,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user