mirror of
https://github.com/2dust/v2rayN.git
synced 2025-08-23 11:26:54 +00:00
全局模式下系统托盘变为粉色
This commit is contained in:
parent
8ddddb66df
commit
b20c4ec564
2 changed files with 47 additions and 2 deletions
|
@ -8,11 +8,13 @@ namespace v2rayN.Forms
|
||||||
{
|
{
|
||||||
protected static Config config;
|
protected static Config config;
|
||||||
protected static System.Drawing.Icon icon;
|
protected static System.Drawing.Icon icon;
|
||||||
|
protected static System.Drawing.Icon globleAgentIcon;
|
||||||
|
|
||||||
public BaseForm()
|
public BaseForm()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
LoadCustomIcon();
|
LoadCustomIcon();
|
||||||
|
LoadGlobleAgentCustomIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadCustomIcon()
|
private void LoadCustomIcon()
|
||||||
|
@ -35,5 +37,37 @@ namespace v2rayN.Forms
|
||||||
Utils.SaveLog($"Loading custom icon failed: {e.Message}");
|
Utils.SaveLog($"Loading custom icon failed: {e.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//设置托盘图标
|
||||||
|
private void LoadGlobleAgentCustomIcon()
|
||||||
|
{
|
||||||
|
if (this.Icon == null)
|
||||||
|
{
|
||||||
|
globleAgentIcon = this.Icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
//原图标进行颜色变化
|
||||||
|
System.Drawing.Bitmap gImage = this.Icon.ToBitmap();
|
||||||
|
for (int x = 0; x < gImage.Width; x++)
|
||||||
|
{
|
||||||
|
for (int y = 0; y < gImage.Height; y++)
|
||||||
|
{
|
||||||
|
System.Drawing.Color pixelColor = gImage.GetPixel(x, y);
|
||||||
|
|
||||||
|
if ((0 == pixelColor.R
|
||||||
|
&& 0 == pixelColor.G
|
||||||
|
&& 0 == pixelColor.B)
|
||||||
|
|| (253 == pixelColor.R
|
||||||
|
&& 253 == pixelColor.G
|
||||||
|
&& 253 == pixelColor.B))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//粉色
|
||||||
|
gImage.SetPixel(x, y, System.Drawing.Color.FromArgb(255, 174, 210));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
globleAgentIcon = System.Drawing.Icon.FromHandle(gImage.GetHicon());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -385,6 +385,17 @@ namespace v2rayN.Forms
|
||||||
toolSslPacPort.Text = $"{HttpProxyHandle.GetPacUrl()}";
|
toolSslPacPort.Text = $"{HttpProxyHandle.GetPacUrl()}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//设置托盘图标
|
||||||
|
if (config.sysAgentEnabled && 1 == config.listenerType)
|
||||||
|
{
|
||||||
|
this.notifyMain.Icon = globleAgentIcon;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.notifyMain.Icon = this.Icon;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
private void ssMain_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
|
private void ssMain_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -1010,12 +1021,12 @@ namespace v2rayN.Forms
|
||||||
|
|
||||||
private void HideForm()
|
private void HideForm()
|
||||||
{
|
{
|
||||||
//this.WindowState = FormWindowState.Minimized;
|
|
||||||
this.Hide();
|
this.Hide();
|
||||||
this.notifyMain.Icon = this.Icon;
|
|
||||||
this.notifyMain.Visible = true;
|
this.notifyMain.Visible = true;
|
||||||
this.ShowInTaskbar = false;
|
this.ShowInTaskbar = false;
|
||||||
|
|
||||||
|
|
||||||
SetVisibleCore(false);
|
SetVisibleCore(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue