update invertermon window

This commit is contained in:
djnitehawk 2025-03-18 17:12:52 +05:30
parent e4b874ffa2
commit 68b33186f7
3 changed files with 1235 additions and 1275 deletions

View File

@ -13,45 +13,55 @@ partial class Main
base.Dispose(disposing);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Main));
web = new Microsoft.Web.WebView2.WinForms.WebView2();
TrayIcon = new NotifyIcon(components);
TrayIcon = new System.Windows.Forms.NotifyIcon(components);
((System.ComponentModel.ISupportInitialize)web).BeginInit();
SuspendLayout();
//
// web
//
web.AllowExternalDrop = false;
web.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
web.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right));
web.CreationProperties = null;
web.DefaultBackgroundColor = Color.White;
web.Location = new Point(-1, 1);
web.DefaultBackgroundColor = System.Drawing.Color.White;
web.Location = new System.Drawing.Point(-1, 1);
web.Name = "web";
web.Size = new Size(642, 556);
web.Source = new Uri("http://inverter.djnitehawk.com", UriKind.Absolute);
web.Size = new System.Drawing.Size(642, 540);
web.Source = new System.Uri("http://inverter.djnitehawk.com", System.UriKind.Absolute);
web.TabIndex = 0;
web.ZoomFactor = 1D;
//
// TrayIcon
//
TrayIcon.Icon = (Icon)resources.GetObject("TrayIcon.Icon");
TrayIcon.Icon = ((System.Drawing.Icon)resources.GetObject("TrayIcon.Icon"));
TrayIcon.Text = "TrayIcon";
//
// Main
//
AutoScaleDimensions = new SizeF(7F, 17F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(639, 558);
AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
BackColor = System.Drawing.SystemColors.Desktop;
ClientSize = new System.Drawing.Size(639, 542);
Controls.Add(web);
FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
MaximizeBox = false;
Name = "Main";
ShowIcon = false;
ShowInTaskbar = false;
StartPosition = FormStartPosition.CenterScreen;
StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
Text = "InverterMon Window";
TopMost = true;
TransparencyKey = System.Drawing.Color.FromArgb(((int)((byte)0)), ((int)((byte)0)), ((int)((byte)64)));
((System.ComponentModel.ISupportInitialize)web).EndInit();
ResumeLayout(false);
}

View File

@ -12,9 +12,21 @@ public partial class Main : Form
[return: MarshalAs(UnmanagedType.Bool)]
private static partial bool UnregisterHotKey(IntPtr hWnd, int id);
void SetTitleBarColor(Color color)
{
var colorValue = color.R | (color.G << 8) | (color.B << 16);
DwmSetWindowAttribute(Handle, DWMWA_CAPTION_COLOR, ref colorValue, sizeof(int));
}
[DllImport("dwmapi.dll")]
static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, ref int attrValue, int attrSize);
const int DWMWA_CAPTION_COLOR = 35;
public Main()
{
InitializeComponent();
SetTitleBarColor(Color.Black);
TrayIcon.Click += TrayIcon_Click;
Load += Main_Load;
FormClosed += Main_FormClosed;
@ -62,13 +74,10 @@ public partial class Main : Form
{
case 1: // Alt+I hotkey
if (WindowState == FormWindowState.Normal)
{
WindowState = FormWindowState.Minimized;
}
else
{
TrayIcon_Click(null, null!);
}
break;
}
}

File diff suppressed because it is too large Load Diff