Skip to content
This repository has been archived by the owner on Nov 27, 2020. It is now read-only.

Commit

Permalink
Update to v1.2
Browse files Browse the repository at this point in the history
- Fixed crush when trying to set the default font if the default font is already installed
- Added messagebox when you press 'Restart' button
- Added 'Back' button
- Fixed UI bugs
  • Loading branch information
alcortazzo committed Feb 7, 2020
1 parent daf8b29 commit 40972e6
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 29 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Windows-Font-Changer

Program can change font of your system. Or restore default if you didn't like custom font
Program can change font of your system... or restore default font if you didn't like changed font.

[![Version](https://github.com/alcortazzo/Windows-Font-Changer/blob/master/version.svg)](https://github.com/alcortazzo/Windows-Font-Changer/releases)

![Windows Font Changer](https://i.imgur.com/tUNTTEZ.png)
![Windows Font Changer](https://i.imgur.com/EAotqV6.png)

![Windows Font Changer](https://i.imgur.com/pCROF5y.png)
![Windows Font Changer](https://i.imgur.com/TjqjmEx.png)

![Windows Font Changer](https://i.imgur.com/7iZns5O.png)
![Windows Font Changer](https://i.imgur.com/sYvkU42.png)
23 changes: 21 additions & 2 deletions Windows Font Changer/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

89 changes: 72 additions & 17 deletions Windows Font Changer/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ namespace Windows_Font_Changer
{
public partial class Form1 : Form
{
readonly RegistryKey localMachineKey = Registry.LocalMachine;
readonly string RegWay1 = @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts";
readonly string RegWay2 = @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes";
readonly string FullRegWay2 = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes";
readonly string textRestart = "restart your computer to complete install";

public Form1()
{
InitializeComponent();
this.ActiveControl = btn2;
ActiveControl = btn2;
btn2.Focus();
}

Expand All @@ -28,18 +28,42 @@ void btn1_Click(object sender, EventArgs e)
btn2.Visible = false;
btnReset.Enabled = false;
btnReset.Visible = false;
label1.ForeColor = Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(41)))), ((int)(((byte)(77)))));
label1.ForeColor = Color.FromArgb(((int)(((byte)(255)))),
((int)(((byte)(41)))), ((int)(((byte)(77)))));
label1.Text = "enter font name WITHOUT ERRORS";
btnBack.Enabled = true;
btnBack.Visible = true;
btnCust.Enabled = true;
btnCust.Visible = true;
textBox1.Text = "Tahoma";
textBox1.ForeColor = Color.FromArgb(((int)(((byte)(80)))),
((int)(((byte)(80)))), ((int)(((byte)(80)))));
textBox1.Enabled = true;
textBox1.Visible = true;
label2.Text = "";
btnCust.Focus();
}
private void btnBack_Click(object sender, EventArgs e)
{
btn1.Enabled = true;
btn1.Visible = true;
btn2.Enabled = true;
btn2.Visible = true;
label1.ForeColor = Color.FromArgb(((int)(((byte)(255)))),
((int)(((byte)(255)))), ((int)(((byte)(255)))));
label1.Text = "what do you want to do";
label2.Text = "";
btnBack.Enabled = false;
btnBack.Visible = false;
btnCust.Enabled = false;
btnCust.Visible = false;
textBox1.Enabled = false;
textBox1.Visible = false;
}
void btnCust_Click(object sender, EventArgs e)
{
RegistryKey localMachineKey = Registry.LocalMachine.OpenSubKey(RegWay1, true);
RegistryKey localMachineKey2 = Registry.LocalMachine.OpenSubKey(RegWay2, true);

localMachineKey.SetValue("Segoe UI (TrueType)", "");
localMachineKey.SetValue("Segoe UI Bold (TrueType)", "");
Expand All @@ -49,10 +73,9 @@ void btnCust_Click(object sender, EventArgs e)
localMachineKey.SetValue("Segoe UI Semibold (TrueType)", "");
localMachineKey.SetValue("Segoe UI Symbol (TrueType)", "");

RegistryKey localMachineKey2 = Registry.LocalMachine.OpenSubKey(RegWay2, true);

localMachineKey2.SetValue("Segoe UI", textBox1.Text);
textBox1.ForeColor = Color.FromArgb(((int)(((byte)(44)))), ((int)(((byte)(212)))), ((int)(((byte)(25)))));
textBox1.ForeColor = Color.FromArgb(((int)(((byte)(44)))),
((int)(((byte)(212)))), ((int)(((byte)(25)))));
label2.Text = textRestart;
btnReset.Enabled = true;
btnReset.Visible = true;
Expand All @@ -62,7 +85,8 @@ void btnCust_Click(object sender, EventArgs e)

void textBox1_MouseClick(object sender, MouseEventArgs e)
{
textBox1.ForeColor = Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
textBox1.ForeColor = Color.FromArgb(((int)(((byte)(255)))),
((int)(((byte)(255)))), ((int)(((byte)(255)))));
if (textBox1.Text == "Tahoma")
{
textBox1.Text = "";
Expand All @@ -76,7 +100,7 @@ void textBox1_KeyDown(object sender, KeyEventArgs e)
btnCust_Click(this, new EventArgs());
}

void btn2_Click(object sender, EventArgs e)
void ReturnDefaultFont()
{
RegistryKey localMachineKey = Registry.LocalMachine.OpenSubKey(RegWay1, true);

Expand All @@ -100,15 +124,36 @@ void btn2_Click(object sender, EventArgs e)
localMachineKey.SetValue("Segoe Print Bold (TrueType)", "segoeprb.ttf");
localMachineKey.SetValue("Segoe Script (TrueType)", "segoesc.ttf");
localMachineKey.SetValue("Segoe Script Bold (TrueType)", "segoescb.ttf");
label1.ForeColor = Color.FromArgb(((int)(((byte)(44)))), ((int)(((byte)(212)))), ((int)(((byte)(25)))));
label1.Text = "default font has been installed";
label2.Text = textRestart;
btnReset.Enabled = true;
btnReset.Visible = true;
}

void btn2_Click(object sender, EventArgs e)
{
RegistryKey localMachineKey2 = Registry.LocalMachine.OpenSubKey(RegWay2, true);

localMachineKey2.DeleteValue("Segoe UI");
string valueName = "Segoe UI";

if (Registry.GetValue(FullRegWay2, valueName, null) == null)
{
ReturnDefaultFont();

label1.ForeColor = Color.FromArgb(((int)(((byte)(214)))),
((int)(((byte)(227)))), ((int)(((byte)(27)))));
label1.Text = "default font is already intalled";
}
else
{
ReturnDefaultFont();

label1.ForeColor = Color.FromArgb(((int)(((byte)(44)))),
((int)(((byte)(212)))), ((int)(((byte)(25)))));
label1.Text = "default font has been installed";

label2.Text = textRestart;
btnReset.Enabled = true;
btnReset.Visible = true;

localMachineKey2.DeleteValue("Segoe UI");
}
}

void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
Expand All @@ -118,17 +163,27 @@ void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)

void linkLabel1_MouseEnter(object sender, EventArgs e)
{
linkLabel1.LinkColor = Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
linkLabel1.LinkColor = Color.FromArgb(((int)(((byte)(255)))),
((int)(((byte)(255)))), ((int)(((byte)(255)))));
}

void linkLabel1_MouseLeave(object sender, EventArgs e)
{
linkLabel1.LinkColor = Color.FromArgb(((int)(((byte)(56)))), ((int)(((byte)(56)))), ((int)(((byte)(56)))));
linkLabel1.LinkColor = Color.FromArgb(((int)(((byte)(56)))),
((int)(((byte)(56)))), ((int)(((byte)(56)))));
}

private void btnReset_Click(object sender, EventArgs e)
{
Process.Start("shutdown.exe", "-r -t 0");
DialogResult result = MessageBox.Show("Are you sure you want to restart your pc right now?",
"",
MessageBoxButtons.YesNo,
MessageBoxIcon.Exclamation,
MessageBoxDefaultButton.Button2);
if (result == DialogResult.Yes)
{
Process.Start("shutdown.exe", "-r -t 0");
}
}
void btnExit_Click(object sender, EventArgs e)
{
Expand Down
4 changes: 2 additions & 2 deletions Windows Font Changer/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: NeutralResourcesLanguage("en")]
2 changes: 1 addition & 1 deletion Windows Font Changer/Windows Font Changer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.1.0.%2a</ApplicationVersion>
<ApplicationVersion>1.2.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion Windows Font Changer/app.manifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.1.0.0" name="Windows Font Changer.exe"/>
<assemblyIdentity version="1.2.0.0" name="Windows Font Changer.exe"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
Expand Down
4 changes: 2 additions & 2 deletions version.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 40972e6

Please sign in to comment.