#endregion // Local Variables
#region NotifyIconWindow Class
- internal class NotifyIconWindow : Control {
+ internal class NotifyIconWindow : Form {
NotifyIcon owner;
Rectangle rect;
CreateControl();
- Paint += new PaintEventHandler(HandlePaint);
SizeChanged += new EventHandler(HandleSizeChanged);
// Events that need to be sent to our parent
cp.Style = (int)WindowStyles.WS_POPUP;
cp.Style |= (int)WindowStyles.WS_CLIPSIBLINGS;
- cp.ExStyle = (int)(WindowStyles.WS_EX_TOOLWINDOW);
+ cp.ExStyle = (int)(WindowExStyles.WS_EX_TOOLWINDOW);
return cp;
}
PaintEventArgs paint_event;
paint_event = XplatUI.PaintEventStart(Handle, false);
- OnPaint(paint_event);
+ OnPaintInternal (paint_event);
XplatUI.PaintEventEnd(Handle, false);
break;
}
+ //
+ // NotifyIcon does CONTEXTMENU on mouse up, not down
+ // so we swallow the message here, and handle it on our own
+ //
+ case Msg.WM_CONTEXTMENU:
+ return;
+
case Msg.WM_USER: {
switch ((Msg)m.LParam.ToInt32()) {
case Msg.WM_LBUTTONDOWN: {
}
}
- private void HandlePaint(object sender, PaintEventArgs e) {
+ internal override void OnPaintInternal (PaintEventArgs e) {
if (owner.icon != null) {
e.Graphics.FillRectangle(ThemeEngine.Current.ResPool.GetSolidBrush(SystemColors.Window), rect);
e.Graphics.DrawImage(owner.icon_bitmap, rect);
}
}
+ internal void InternalRecreateHandle () {
+ base.RecreateHandle ();
+ }
+
+
private void HandleSizeChanged(object sender, EventArgs e) {
CalculateIconRect();
}
set {
if (icon != value) {
- if (icon != null) {
- icon.Dispose();
- }
icon = value;
ShowSystray(true);
}
#region Protected Instance Methods
protected override void Dispose(bool disposing) {
- if (icon != null) {
- icon.Dispose();
- }
-
if (icon_bitmap != null) {
icon_bitmap.Dispose();
}
+
+ if (disposing)
+ icon = null;
+
base.Dispose (disposing);
}