Files
mRemoteNG/mRemoteV1/UI/Controls/Base/NGTextBox.cs
Camilo Alvarez 991d1d82b8 Misc fixes
- Clear redundant settings form app.config
- Deleted DesignModeTest as ThemeManager can now be used in design time without adjustements, removed usage from all custo elements
- Instance _themeManager in NGNumericUpDown at object creation to avoid null reference errors
- Errorsform instancing is now defaulted to DockBottomAutoHide  in frmMain
-Fix missing panel at startup by adding a blank panel, temporary solution as magic library is beign phased out
2017-12-26 12:15:11 -05:00

56 lines
1.9 KiB
C#

using mRemoteNG.Themes;
using System;
using System.Windows.Forms;
namespace mRemoteNG.UI.Controls.Base
{
//This class is only minimally themed as textboxes onPaint are hard to theme (system wm paint control most of the drawing process
//There are some glitches on the initial draw of some controls
public class NGTextBox : TextBox
{
private ThemeManager _themeManager;
public NGTextBox()
{
ThemeManager.getInstance().ThemeChanged += OnCreateControl;
}
protected override void OnCreateControl()
{
base.OnCreateControl();
_themeManager = ThemeManager.getInstance();
if (!_themeManager.ThemingActive) return;
ForeColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("TextBox_Foreground");
BackColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("TextBox_Background");
Invalidate();
}
protected override void OnEnabledChanged(EventArgs e)
{
_themeManager = ThemeManager.getInstance();
if (_themeManager.ThemingActive)
{
_themeManager = ThemeManager.getInstance();
if(_themeManager.ThemingActive)
{
if (Enabled)
{
ForeColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("TextBox_Foreground");
BackColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("TextBox_Background");
}
else
{
BackColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("TextBox_Disabled_Background");
}
}
}
base.OnEnabledChanged(e);
Invalidate();
}
}
}