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); 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() private void InitializeComponent()
{ {
components = new System.ComponentModel.Container(); components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Main)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Main));
web = new Microsoft.Web.WebView2.WinForms.WebView2(); web = new Microsoft.Web.WebView2.WinForms.WebView2();
TrayIcon = new NotifyIcon(components); TrayIcon = new System.Windows.Forms.NotifyIcon(components);
((System.ComponentModel.ISupportInitialize)web).BeginInit(); ((System.ComponentModel.ISupportInitialize)web).BeginInit();
SuspendLayout(); SuspendLayout();
//
//
// web // web
// //
web.AllowExternalDrop = false; 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.CreationProperties = null;
web.DefaultBackgroundColor = Color.White; web.DefaultBackgroundColor = System.Drawing.Color.White;
web.Location = new Point(-1, 1); web.Location = new System.Drawing.Point(-1, 1);
web.Name = "web"; web.Name = "web";
web.Size = new Size(642, 556); web.Size = new System.Drawing.Size(642, 540);
web.Source = new Uri("http://inverter.djnitehawk.com", UriKind.Absolute); web.Source = new System.Uri("http://inverter.djnitehawk.com", System.UriKind.Absolute);
web.TabIndex = 0; web.TabIndex = 0;
web.ZoomFactor = 1D; web.ZoomFactor = 1D;
//
//
// TrayIcon // TrayIcon
// //
TrayIcon.Icon = (Icon)resources.GetObject("TrayIcon.Icon"); TrayIcon.Icon = ((System.Drawing.Icon)resources.GetObject("TrayIcon.Icon"));
TrayIcon.Text = "TrayIcon"; TrayIcon.Text = "TrayIcon";
//
//
// Main // Main
// //
AutoScaleDimensions = new SizeF(7F, 17F); AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
ClientSize = new Size(639, 558); BackColor = System.Drawing.SystemColors.Desktop;
ClientSize = new System.Drawing.Size(639, 542);
Controls.Add(web); Controls.Add(web);
FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
MaximizeBox = false; MaximizeBox = false;
Name = "Main"; ShowIcon = false;
ShowInTaskbar = false; ShowInTaskbar = false;
StartPosition = FormStartPosition.CenterScreen; StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
Text = "InverterMon Window"; Text = "InverterMon Window";
TopMost = true; TopMost = true;
TransparencyKey = System.Drawing.Color.FromArgb(((int)((byte)0)), ((int)((byte)0)), ((int)((byte)64)));
((System.ComponentModel.ISupportInitialize)web).EndInit(); ((System.ComponentModel.ISupportInitialize)web).EndInit();
ResumeLayout(false); ResumeLayout(false);
} }

View File

@ -12,9 +12,21 @@ public partial class Main : Form
[return: MarshalAs(UnmanagedType.Bool)] [return: MarshalAs(UnmanagedType.Bool)]
private static partial bool UnregisterHotKey(IntPtr hWnd, int id); 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() public Main()
{ {
InitializeComponent(); InitializeComponent();
SetTitleBarColor(Color.Black);
TrayIcon.Click += TrayIcon_Click; TrayIcon.Click += TrayIcon_Click;
Load += Main_Load; Load += Main_Load;
FormClosed += Main_FormClosed; FormClosed += Main_FormClosed;
@ -62,13 +74,10 @@ public partial class Main : Form
{ {
case 1: // Alt+I hotkey case 1: // Alt+I hotkey
if (WindowState == FormWindowState.Normal) if (WindowState == FormWindowState.Normal)
{
WindowState = FormWindowState.Minimized; WindowState = FormWindowState.Minimized;
}
else else
{
TrayIcon_Click(null, null!); TrayIcon_Click(null, null!);
}
break; break;
} }
} }
@ -83,4 +92,4 @@ public enum KeyModifier
Control = 0x0002, Control = 0x0002,
Shift = 0x0004, Shift = 0x0004,
Winkey = 0x0008 Winkey = 0x0008
} }

File diff suppressed because it is too large Load Diff