Skip to content

Commit

Permalink
v1.6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueMystical authored May 27, 2024
1 parent e4f06eb commit 71df50a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 20 deletions.
29 changes: 19 additions & 10 deletions Example/DarkModeForms/DarkModeCS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ public static Color GetWindowsAccentColor()
{
var color = colors.ColorizationColor;

var colorValue = long.Parse(color.ToString("X"), System.Globalization.NumberStyles.HexNumber);
var colorValue = long.Parse(color.ToString(), System.Globalization.NumberStyles.HexNumber);

var transparency = (colorValue & 0xFF000000) >> 24;
var red = (colorValue & 0x00FF0000) >> 16;
Expand Down Expand Up @@ -739,13 +739,21 @@ public static Bitmap ChangeToColor(Bitmap bmp, Color c)
float tG = c.G / 255f;
float tB = c.B / 255f;

//System.Drawing.Imaging.ColorMatrix colorMatrix = new System.Drawing.Imaging.ColorMatrix(new float[][]
//{
// new float[] { 0, 0, 0, 0, 0 },
// new float[] { 0, 0, 0, 0, 0 },
// new float[] { 0, 0, 0, 0, 0 },
// new float[] { 0, 0, 0, 1, 0 }, //<- not changing alpha
// new float[] { tR, tG, tB, 0, 1 }
//});
System.Drawing.Imaging.ColorMatrix colorMatrix = new System.Drawing.Imaging.ColorMatrix(new float[][]
{
new float[] { 0, 0, 0, 0, 0 },
new float[] { 0, 0, 0, 0, 0 },
new float[] { 0, 0, 0, 0, 0 },
new float[] { 0, 0, 0, 1, 0 }, //<- not changing alpha
new float[] { tR, tG, tB, 0, 1 }
new float[] { 1, 0, 0, 0, 0 },
new float[] { 0, 1, 0, 0, 0 },
new float[] { 0, 0, 1, 0, 0 },
new float[] { 0, 0, 0, 1, 0 }, //<- not changing alpha
new float[] { tR, tG, tB, 0, 1 }
});

System.Drawing.Imaging.ImageAttributes attributes = new System.Drawing.Imaging.ImageAttributes();
Expand Down Expand Up @@ -1187,11 +1195,12 @@ protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
e.Graphics.DrawImage(adjustedImage, e.ImageRectangle);
}

}
}


else
{
base.OnRenderItemImage(e);
}
}

}
public class CustomColorTable : ProfessionalColorTable
Expand Down
6 changes: 3 additions & 3 deletions Example/DarkModeForms/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,11 @@ private void button5_Click(object sender, EventArgs e)
}
catch (Exception ex)
{
Messenger.MessageBox(ex);
Messenger.MesageBox(ex);
}


if (Messenger.MessageBox("Hello World!", "You got a Message:",
if (Messenger.MesageBox("Hello World!", "You got a Message:",
MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK)
{
//Do Something here.
Expand Down Expand Up @@ -198,7 +198,7 @@ private void button4_Click(object sender, EventArgs e)

//TODO: you can either Validate user and password individually as before or Send them to your Backend for validation here

Messenger.MessageBox(string.Format("The User '{0}' is Logged!", _userName), "Login Correct!",
Messenger.MesageBox(string.Format("The User '{0}' is Logged!", _userName), "Login Correct!",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
Expand Down
14 changes: 7 additions & 7 deletions Example/DarkModeForms/Messenger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,22 @@ private static void ResetEvents()

#region MessageBox

public static DialogResult MessageBox(string Message)
=> MessageBox(Message, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
public static DialogResult MesageBox(string Message)
=> MesageBox(Message, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

/// <summary>Shows an Error Message.</summary>
/// <param name="ex">an Exception error to show</param>
/// <returns></returns>
public static DialogResult MessageBox(Exception ex, bool ShowTrace = true) =>
MessageBox(ex.Message + (ShowTrace ? "\r\n" + ex.StackTrace : ""), "Error!", icon: MessageBoxIcon.Error);
public static DialogResult MesageBox(Exception ex, bool ShowTrace = true) =>
MesageBox(ex.Message + (ShowTrace ? "\r\n" + ex.StackTrace : ""), "Error!", icon: MessageBoxIcon.Error);

/// <summary>Displays a message window, also known as a dialog box, which presents a message to the user.</summary>
/// <param name="Message">The text to display in the message box.</param>
/// <param name="title">The text to display in the title bar of the message box.</param>
/// <param name="Icon">One of the 'Base64Icons.MsgIcon' values that specifies which icon to display in the message box.</param>
/// <param name="buttons">One of the MessageBoxButtons values that specifies which buttons to display in the message box.</param>
/// <returns>It is a modal window, blocking other actions in the application until the user closes it.</returns>
public static DialogResult MessageBox(
public static DialogResult MesageBox(
string Message, string title, MessageBoxButtons buttons = MessageBoxButtons.OK,
MessageBoxIcon icon = MessageBoxIcon.Information)
{
Expand All @@ -74,7 +74,7 @@ public static DialogResult MessageBox(
}


return MessageBox(Message, title, Icon, buttons);
return MesageBox(Message, title, Icon, buttons);
}

/// <summary>Displays a message window, also known as a dialog box, which presents a message to the user.</summary>
Expand All @@ -83,7 +83,7 @@ public static DialogResult MessageBox(
/// <param name="Icon">One of the 'Base64Icons.MsgIcon' values that specifies which icon to display in the message box.</param>
/// <param name="buttons">One of the MessageBoxButtons values that specifies which buttons to display in the message box.</param>
/// <returns>It is a modal window, blocking other actions in the application until the user closes it.</returns>
public static DialogResult MessageBox(
public static DialogResult MesageBox(
string Message, string title, MsgIcon Icon,
MessageBoxButtons buttons = MessageBoxButtons.OK)
{
Expand Down

0 comments on commit 71df50a

Please sign in to comment.