Ever wanted to compare two Dogs? Well now you can!
Dog(const int age = 1, const string name = "Un-named")
m_age = age;
m_name = name;
//Here's where it gets interesting...
bool operator ==(const Dog rhs); //rhs = right-hand side
bool Dog::operator ==(const Dog rhs)
return (m_age == rhs.m_age && m_name == rhs.m_name);
Dog spike(3, "Spike"), brownie(7, "Brownie");
//Notice that brownie is on the right-hand side
//of the == operator
bool dogs_are_equal = (spike == brownie); //false
In this tutorial I teach you how to save settings to an internal config!
Saving settings to a config is really easy in C#, so let’s begin the tutorial!
1. Right-click on the project root in the Solution Explorer:
2. Select “Properties” from the list:
3. You should see something similar to this:
4. Set the names, types, and default values to whatever you like. DO NOT change the scope to “Application” if you plan on being able to edit the settings from the code.
5. Getting and Setting the property:
[Variable Type] [Variable Name] = Properties.Settings.Default.[Name of Property];
Properties.Settings.Default.[Name of Property] = [String, Int, etc. (As long as it is the same type as the property)];
In this example, I am checking if the config property LastSaveDirectory is not empty. If it is not empty, set the SaveFileDialog‘s Initial Directory to the stored property.
How to loop through all Properties and display them in a MessageBox:
NOTE: I would recommend a String Builder if you plan on having a lot of properties.
Going border-less full-screen in C#.NET is actually really, really easy.
1. Set the
FormBorderStyle to None:
FormBorderStyle = FormBorderStyle.None;
2. Set the
WindowState to Maximized:
WindowState = FormWindowState.Maximized;
You may or may not have to adjust the width/height and location of various controls on the form.
To return the form to normal:
1. Set the
FormBorderStyle to Sizable:
FormBorderStyle = FormBorderStyle.Sizable;
2. Set the
WindowState to Normal:
WindowState = FormWindowState.Normal;
Again, you may or may not have to adjust various properties of controls on the form after doing this.
NOTE: I only have to adjust a few properties when going full-screen, and the form returns said properties to their original state when returning to normal mode.
Disclaimer: I have absolutely no connection with Blizzard or the Overwatch team. I am simply a fan of Overwatch.
Hello, class. My name is Hanzo Shimada, and I am here to teach you about programming. But, before I do that, I would like to give you some back story.
After reuniting with my brother Genji, I decided to do something with the spare time I gained from nolonger praying at the alter for my brother. I pondered for many, many nanoseconds before deciding on following in my cousin’s friend’s older brother’s footsteps. I decided to become a programmer.
Next time on Hanzo Programs: Idk yet, structure is boring. Probably something to do with programming.