mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-17 19:56:43 -05:00
50 lines
977 B
C#
50 lines
977 B
C#
using PKHeX.Core;
|
|
using System.Windows.Forms;
|
|
|
|
namespace PKHeX.WinForms.Controls;
|
|
|
|
public class RenderedString : TextBox
|
|
{
|
|
public bool DisableInGameFont
|
|
{
|
|
get;
|
|
set
|
|
{
|
|
if (value == field)
|
|
return;
|
|
field = value;
|
|
if (value)
|
|
ResetFont();
|
|
else
|
|
ChangeContext(DisplayContext);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Context the string is rendered in.
|
|
/// </summary>
|
|
public EntityContext DisplayContext
|
|
{
|
|
get;
|
|
set
|
|
{
|
|
if (value == field)
|
|
return;
|
|
field = value;
|
|
if (!DisableInGameFont)
|
|
ChangeContext(value);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Fetches the necessary font.
|
|
/// </summary>
|
|
private void ChangeContext(EntityContext context)
|
|
{
|
|
if (DesignMode)
|
|
return;
|
|
|
|
Font = FontUtil.GetFont(context);
|
|
}
|
|
}
|