diff --git a/app/AnimeMatrix/AnimeMatrixDevice.cs b/app/AnimeMatrix/AnimeMatrixDevice.cs index 7061e712..b454838b 100644 --- a/app/AnimeMatrix/AnimeMatrixDevice.cs +++ b/app/AnimeMatrix/AnimeMatrixDevice.cs @@ -1,7 +1,7 @@ // Source thanks to https://github.com/vddCore/Starlight with some adjustments from me using Starlight.Communication; -using System.Diagnostics; +using System.Drawing; using System.Management; using System.Text; @@ -90,7 +90,7 @@ namespace Starlight.AnimeMatrix { MaxColumns = 33; - FullRows = 6; + FullRows = 7; FullEvenRows = 6; MaxRows = 55; @@ -152,7 +152,7 @@ namespace Starlight.AnimeMatrix public int XEnd(int row) { - if (row <= FullEvenRows && row % 2 == 0) return MaxColumns-1; + if (row <= FullEvenRows && row % 2 == 0) return MaxColumns - 1; return MaxColumns; } @@ -273,8 +273,41 @@ namespace Starlight.AnimeMatrix static int GetColor(Bitmap bmp, int x, int y) { var pixel = bmp.GetPixel(Math.Max(0, Math.Min(bmp.Width - 1, x)), Math.Max(0, Math.Min(bmp.Height - 1, y))); - return (Math.Max((pixel.R + pixel.G + pixel.B) / 3, 0)); + return (Math.Min((pixel.R + pixel.G + pixel.B) / 3, 255)); } + + + public void PresentText(string text, int fontSize = 8) + { + int width = MaxColumns * 3; + int height = MaxRows; + + Bitmap bmp = new Bitmap(width, height); + + using (Graphics g = Graphics.FromImage(bmp)) + { + using (Font font = new Font("Arial", fontSize)) + { + + g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality; + g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; + SizeF textSize = g.MeasureString(text, font); + + /* + g.TranslateTransform(bmp.Width / 2, bmp.Height / 2); + g.RotateTransform(33); + g.DrawString(text, font, Brushes.White, -textSize.Width/2, -textSize.Height / 2); + */ + + g.DrawString(text, font, Brushes.White, bmp.Width - textSize.Width + 5, 0); + } + } + + GenerateFrame(bmp); + Present(); + + } + public void GenerateFrame(Image image) { diff --git a/app/ControlHelper.cs b/app/ControlHelper.cs index b769f0cc..1ef03a03 100644 --- a/app/ControlHelper.cs +++ b/app/ControlHelper.cs @@ -36,7 +36,7 @@ public static class ControlHelper foreMain = SystemColors.ControlText; foreAccent = Color.LightGray; borderMain = Color.LightGray; - buttonMain = SystemColors.ControlLight; + buttonMain = Color.FromArgb(255, 230, 230, 230); } container.BackColor = formBack; diff --git a/app/CustomControls.cs b/app/CustomControls.cs index 1e344354..b6af7f46 100644 --- a/app/CustomControls.cs +++ b/app/CustomControls.cs @@ -71,8 +71,8 @@ namespace CustomControls } } } - private Color buttonColor = Color.LightGray; - [DefaultValue(typeof(Color), "LightGray")] + private Color buttonColor = Color.FromArgb(255,230, 230, 230); + [DefaultValue(typeof(Color), "230, 230, 230")] public Color ButtonColor { get { return buttonColor; } diff --git a/app/Fans.Designer.cs b/app/Fans.Designer.cs index 472f7996..23361586 100644 --- a/app/Fans.Designer.cs +++ b/app/Fans.Designer.cs @@ -232,7 +232,7 @@ namespace GHelper // buttonReset.Activated = false; buttonReset.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; - buttonReset.BackColor = SystemColors.ControlLight; + buttonReset.BackColor = Color.FromArgb(230, 230, 230); buttonReset.BorderColor = Color.Transparent; buttonReset.BorderRadius = 2; buttonReset.FlatStyle = FlatStyle.Flat; @@ -249,7 +249,7 @@ namespace GHelper // buttonApply.Activated = false; buttonApply.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; - buttonApply.BackColor = SystemColors.ControlLight; + buttonApply.BackColor = Color.FromArgb(230, 230, 230); buttonApply.BorderColor = Color.Transparent; buttonApply.BorderRadius = 2; buttonApply.FlatStyle = FlatStyle.Flat; @@ -320,7 +320,7 @@ namespace GHelper // buttonApplyPower.Activated = false; buttonApplyPower.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; - buttonApplyPower.BackColor = SystemColors.ControlLight; + buttonApplyPower.BackColor = Color.FromArgb(230, 230, 230); buttonApplyPower.BorderColor = Color.Transparent; buttonApplyPower.BorderRadius = 2; buttonApplyPower.FlatStyle = FlatStyle.Flat; diff --git a/app/GHelper.csproj b/app/GHelper.csproj index b9f60cff..db50f5ff 100644 --- a/app/GHelper.csproj +++ b/app/GHelper.csproj @@ -16,7 +16,7 @@ x64 False True - 0.35 + 0.36 diff --git a/app/Settings.Designer.cs b/app/Settings.Designer.cs index 2e7b0866..db655b0d 100644 --- a/app/Settings.Designer.cs +++ b/app/Settings.Designer.cs @@ -179,7 +179,7 @@ namespace GHelper // buttonMatrix // buttonMatrix.Activated = false; - buttonMatrix.BackColor = SystemColors.ControlLight; + buttonMatrix.BackColor = Color.FromArgb(230, 230, 230); buttonMatrix.BorderColor = Color.Transparent; buttonMatrix.BorderRadius = 2; buttonMatrix.Dock = DockStyle.Top; @@ -202,7 +202,7 @@ namespace GHelper comboMatrixRunning.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point); comboMatrixRunning.FormattingEnabled = true; comboMatrixRunning.ItemHeight = 32; - comboMatrixRunning.Items.AddRange(new object[] { "Binary Banner", "Rog Logo", "Picture" }); + comboMatrixRunning.Items.AddRange(new object[] { "Binary Banner", "Rog Logo", "Picture", "Clock" }); comboMatrixRunning.Location = new Point(197, 10); comboMatrixRunning.Margin = new Padding(4, 10, 4, 8); comboMatrixRunning.Name = "comboMatrixRunning"; @@ -327,7 +327,7 @@ namespace GHelper // buttonQuit.Activated = false; buttonQuit.Anchor = AnchorStyles.Top | AnchorStyles.Right; - buttonQuit.BackColor = SystemColors.ControlLight; + buttonQuit.BackColor = Color.FromArgb(230, 230, 230); buttonQuit.BorderColor = Color.Transparent; buttonQuit.BorderRadius = 2; buttonQuit.FlatStyle = FlatStyle.Flat; @@ -494,7 +494,7 @@ namespace GHelper // buttonFans // buttonFans.Activated = false; - buttonFans.BackColor = SystemColors.ControlLight; + buttonFans.BackColor = Color.FromArgb(230, 230, 230); buttonFans.BorderColor = Color.Transparent; buttonFans.BorderRadius = 5; buttonFans.Dock = DockStyle.Fill; @@ -881,7 +881,7 @@ namespace GHelper // buttonKeyboard // buttonKeyboard.Activated = false; - buttonKeyboard.BackColor = SystemColors.ControlLight; + buttonKeyboard.BackColor = Color.FromArgb(230, 230, 230); buttonKeyboard.BorderColor = Color.Transparent; buttonKeyboard.BorderRadius = 2; buttonKeyboard.Dock = DockStyle.Top; diff --git a/app/Settings.cs b/app/Settings.cs index 63a695cf..5a0ebf1c 100644 --- a/app/Settings.cs +++ b/app/Settings.cs @@ -21,6 +21,7 @@ namespace GHelper public Keyboard keyb; static AnimeMatrixDevice mat; + static int matrixMode = 0; public SettingsForm() { @@ -265,14 +266,23 @@ namespace GHelper private static void MatrixTimer_Elapsed(object? sender, ElapsedEventArgs e) { if (mat is null) return; - mat.PresentNextFrame(); + + switch (Program.config.getConfig("matrix_running")) + { + case 2: + mat.PresentNextFrame(); + break; + case 3: + mat.PresentText(DateTime.Now.ToString("H:mm:ss")); + break; + } + } void SetMatrixPicture(string fileName) { if (mat is null) return; - StopMatrixTimer(); Image image; @@ -315,8 +325,6 @@ namespace GHelper mat.GenerateFrame(image); mat.Present(); } - - } @@ -397,14 +405,20 @@ namespace GHelper mat.SetDisplayState(true); mat.SetBrightness((BrightnessMode)brightness); - if (running == 2) + switch (running) { - string fileName = Program.config.getConfigString("matrix_picture"); - SetMatrixPicture(fileName); - } - else - { - mat.SetBuiltInAnimation(true, animation); + case 2: + string fileName = Program.config.getConfigString("matrix_picture"); + SetMatrixPicture(fileName); + break; + case 3: + mat.SetBuiltInAnimation(false); + StartMatrixTimer(); + break; + default: + mat.SetBuiltInAnimation(true, animation); + break; + } }