Nếu bạn đang sử dụng một NotifyIcon
, hãy thử thay đổi ShowInTaskbar false.
Để xóa nó khỏi màn hình Alt + Tab, hãy thử thay đổi kiểu viền cửa sổ của bạn; Tôi tin rằng một số các công cụ của cửa sổ phong cách không xuất hiện ...
cái gì đó như:
using System;
using System.Windows.Forms;
class MyForm : Form
{
NotifyIcon sysTray;
MyForm()
{
sysTray = new NotifyIcon();
sysTray.Icon = System.Drawing.SystemIcons.Asterisk;
sysTray.Visible = true;
sysTray.Text = "Hi there";
sysTray.MouseClick += delegate { MessageBox.Show("Boo!"); };
ShowInTaskbar = false;
FormBorderStyle = FormBorderStyle.SizableToolWindow;
Opacity = 0;
WindowState = FormWindowState.Minimized;
}
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.Run(new MyForm());
}
}
Nếu nó vẫn xuất hiện trong Alt + Tab, bạn có thể thay đổi phong cách cửa sổ thông qua p/gọi (một chút tin tặc):
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
IntPtr handle = this.Handle;
int currentStyle = GetWindowLong(handle, GWL_EXSTYLE);
SetWindowLong(handle, GWL_EXSTYLE, currentStyle | WS_EX_TOOLWINDOW);
}
private const int GWL_EXSTYLE = -20, WS_EX_TOOLWINDOW = 0x00000080;
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern int SetWindowLong(IntPtr window, int index, int value);
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern int GetWindowLong(IntPtr window, int index);
Nguồn
2008-11-12 11:13:46