Skip to content

Commit 62b9ef7

Browse files
committed
Handle ApplyTheme event
1 parent cb81498 commit 62b9ef7

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

Controls/ToolStripSearchTextBox.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,17 @@ public ToolStripRenderer Renderer
8282
set { _dropdown.Renderer = value; }
8383
}
8484

85+
public void ApplyTheme()
86+
{
87+
var foreColor = PluginBase.MainForm.GetThemeColor("ToolStripTextBoxControl.ForeColor");
88+
if (foreColor != Color.Empty)
89+
ForeColor = foreColor;
90+
91+
var backColor = PluginBase.MainForm.GetThemeColor("ToolStripTextBoxControl.BackColor");
92+
if (backColor != Color.Empty)
93+
BackColor = backColor;
94+
}
95+
8596
private void ApplyWatermark()
8697
{
8798
TextBoxHelper.SetWatermark(TextBox, _watermarkText);

PluginMain.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,10 @@ public void Dispose()
118118
/// </summary>
119119
public void HandleEvent(object sender, NotifyEvent e, HandlingPriority prority)
120120
{
121-
121+
if (e.Type == EventType.ApplyTheme)
122+
{
123+
_quickLaunchBox.ApplyTheme();
124+
}
122125
}
123126

124127
void _settings_OnSettingsChanged()
@@ -186,7 +189,7 @@ public void InitBasics()
186189
public void AddEventHandlers()
187190
{
188191
// Set events you want to listen (combine as flags)
189-
EventManager.AddEventHandler(this, EventType.Command);
192+
EventManager.AddEventHandler(this, EventType.ApplyTheme);
190193
ToolStripMenuItem menu = (ToolStripMenuItem)PluginBase.MainForm.FindMenuItem("SearchMenu");
191194
_activateItem = new ToolStripMenuItem(ResourceHelper.GetString("QuickLaunch.Label.ActivateQuickLaunch"), null, new EventHandler(ActivateQuickLaunch));
192195
_activateItem.Visible = false;
@@ -209,6 +212,7 @@ public void InitializeQuickLaunch()
209212
_quickLaunchBox.Font = PluginBase.Settings.DefaultFont;
210213
_quickLaunchBox.Alignment = ToolStripItemAlignment.Right;
211214
_quickLaunchBox.Search += new EventHandler(quickLaunchBox_Search);
215+
212216
}
213217

214218
void quickLaunchBox_Search(object sender, EventArgs e)

0 commit comments

Comments
 (0)