set icon for hotkey dialog

This commit is contained in:
Kang Yu 2024-03-18 16:46:40 -07:00
parent 84a8ac5792
commit d3318e1443
5 changed files with 26 additions and 10 deletions

View file

@ -119,7 +119,7 @@ namespace PersistentWindows.Common
this.buttonPrevUrl.Size = new System.Drawing.Size(72, 45); this.buttonPrevUrl.Size = new System.Drawing.Size(72, 45);
this.buttonPrevUrl.TabIndex = 6; this.buttonPrevUrl.TabIndex = 6;
this.buttonPrevUrl.TabStop = false; this.buttonPrevUrl.TabStop = false;
this.buttonPrevUrl.Text = "Prev Url"; this.buttonPrevUrl.Text = "Prev Url";
this.buttonPrevUrl.UseVisualStyleBackColor = false; this.buttonPrevUrl.UseVisualStyleBackColor = false;
this.buttonPrevUrl.Click += new System.EventHandler(this.buttonPrevUrl_Click); this.buttonPrevUrl.Click += new System.EventHandler(this.buttonPrevUrl_Click);
// //
@ -131,7 +131,7 @@ namespace PersistentWindows.Common
this.buttonNextUrl.Size = new System.Drawing.Size(72, 45); this.buttonNextUrl.Size = new System.Drawing.Size(72, 45);
this.buttonNextUrl.TabIndex = 7; this.buttonNextUrl.TabIndex = 7;
this.buttonNextUrl.TabStop = false; this.buttonNextUrl.TabStop = false;
this.buttonNextUrl.Text = "Next Url"; this.buttonNextUrl.Text = "Next Url";
this.buttonNextUrl.UseVisualStyleBackColor = false; this.buttonNextUrl.UseVisualStyleBackColor = false;
this.buttonNextUrl.Click += new System.EventHandler(this.buttonNextUrl_Click); this.buttonNextUrl.Click += new System.EventHandler(this.buttonNextUrl_Click);
// //
@ -148,7 +148,7 @@ namespace PersistentWindows.Common
this.Controls.Add(this.buttonCloseTab); this.Controls.Add(this.buttonCloseTab);
this.Controls.Add(this.buttonNextTab); this.Controls.Add(this.buttonNextTab);
this.Controls.Add(this.buttonPrevTab); this.Controls.Add(this.buttonPrevTab);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.KeyPreview = true; this.KeyPreview = true;
this.MaximizeBox = false; this.MaximizeBox = false;
this.MinimizeBox = false; this.MinimizeBox = false;

View file

@ -30,6 +30,8 @@ namespace PersistentWindows.Common
Move += new EventHandler(FormMove); Move += new EventHandler(FormMove);
FormClosing += new FormClosingEventHandler(FormClose); FormClosing += new FormClosingEventHandler(FormClose);
Icon = PersistentWindowProcessor.icon;
aliveTimer = new System.Timers.Timer(2000); aliveTimer = new System.Timers.Timer(2000);
aliveTimer.Elapsed += AliveTimerCallBack; aliveTimer.Elapsed += AliveTimerCallBack;
aliveTimer.SynchronizingObject = this; aliveTimer.SynchronizingObject = this;

View file

@ -170,7 +170,7 @@ namespace PersistentWindows.Common
private readonly List<IntPtr> winEventHooks = new List<IntPtr>(); private readonly List<IntPtr> winEventHooks = new List<IntPtr>();
private User32.WinEventDelegate winEventsCaptureDelegate; private User32.WinEventDelegate winEventsCaptureDelegate;
public System.Drawing.Icon icon = null; public static System.Drawing.Icon icon = null;
private int leftButtonClicks = 0; private int leftButtonClicks = 0;

View file

@ -10,11 +10,10 @@ namespace PersistentWindows.SystrayShell
public class HotKeyForm : Form public class HotKeyForm : Form
{ {
static HotKeyWindow hkwin = null; static HotKeyWindow hkwin = null;
static Thread messageLoop = null;
public static void Start() public static void Start()
{ {
messageLoop = new Thread(() => Thread messageLoop = new Thread(() =>
{ {
hkwin = new HotKeyWindow(); hkwin = new HotKeyWindow();
Application.Run(new HotKeyForm()); Application.Run(new HotKeyForm());
@ -26,10 +25,10 @@ namespace PersistentWindows.SystrayShell
messageLoop.Start(); messageLoop.Start();
} }
public HotKeyForm() public HotKeyForm()
{ {
//InitializeComponent(); //InitializeComponent();
var r = User32.RegisterHotKey(this.Handle, 0, (int)User32.KeyModifier.Alt, 0x51); // Register Alt + Q var r = User32.RegisterHotKey(this.Handle, 0, (int)User32.KeyModifier.Alt, 0x51); // Register Alt + Q
} }
@ -58,12 +57,27 @@ namespace PersistentWindows.SystrayShell
base.SetVisibleCore(false); base.SetVisibleCore(false);
} }
~HotKeyForm() /*
#region IDisposable
public virtual void Dispose(bool disposing)
{ {
messageLoop.Abort(); //messageLoop.Abort();
User32.UnregisterHotKey(this.Handle, 0); User32.UnregisterHotKey(this.Handle, 0);
} }
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
~HotKeyForm()
{
Dispose(false);
}
#endregion
*/
} }
} }

View file

@ -310,7 +310,7 @@ namespace PersistentWindows.SystrayShell
else else
systrayForm.upgradeNoticeMenuItem.Text = "Enable upgrade notice"; systrayForm.upgradeNoticeMenuItem.Text = "Enable upgrade notice";
pwp.icon = IdleIcon; PersistentWindowProcessor.icon = IdleIcon;
if (fix_zorder_specified) if (fix_zorder_specified)
{ {
if (fix_zorder) if (fix_zorder)