Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding flip horizontally #136

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion RunCat/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public class RunCatApplicationContext : ApplicationContext
private const int ANIMATE_TIMER_DEFAULT_INTERVAL = 200;
private PerformanceCounter cpuUsage;
private ToolStripMenuItem runnerMenu;
private ToolStripMenuItem flipMenu;
private ToolStripMenuItem themeMenu;
private ToolStripMenuItem startupMenu;
private ToolStripMenuItem runnerSpeedLimit;
Expand Down Expand Up @@ -96,6 +97,8 @@ public RunCatApplicationContext()
}
});

flipMenu = new ToolStripMenuItem("Flip Horizontally", null, SetFlip);

themeMenu = new ToolStripMenuItem("Theme", null, new ToolStripMenuItem[]
{
new ToolStripMenuItem("Default", null, SetThemeIcons)
Expand Down Expand Up @@ -146,6 +149,7 @@ public RunCatApplicationContext()
contextMenuStrip.Items.AddRange(new ToolStripItem[]
{
runnerMenu,
flipMenu,
themeMenu,
startupMenu,
runnerSpeedLimit,
Expand Down Expand Up @@ -224,7 +228,12 @@ private void SetIcons()
List<Icon> list = new List<Icon>(capacity);
for (int i = 0; i < capacity; i++)
{
list.Add((Icon)rm.GetObject($"{prefix}_{runner}_{i}"));
Bitmap bm = ((Icon)rm.GetObject($"{prefix}_{runner}_{i}")).ToBitmap();
if (flipMenu.Checked)
{
bm.RotateFlip(RotateFlipType.RotateNoneFlipX);
}
list.Add(Icon.FromHandle(bm.GetHicon()));
}
icons = list.ToArray();
}
Expand Down Expand Up @@ -307,6 +316,12 @@ private void UserPreferenceChanged(object sender, UserPreferenceChangedEventArgs
if (e.Category == UserPreferenceCategory.General) UpdateThemeIcons();
}

private void SetFlip(object sender, EventArgs e)
{
flipMenu.Checked = !flipMenu.Checked;
SetIcons();
}

private void SetStartup(object sender, EventArgs e)
{
startupMenu.Checked = !startupMenu.Checked;
Expand Down