The WinForms Notepad Project: New Icon, Auto Save (Premium)

As I continue to put off the really hard bits, here’s how to change the icon and add a quick and dirty auto-save feature.
New icon
Way back at the beginning of this project, I wrote about how you can add an icon to your application and to each form that needs to display it. Of course, I also borrowed the icon from the real Notepad, which is out-of-date (it literally dates back to 2006 and Windows Vista) and not something we can really use in our own application. But I just needed a placeholder until I could figure out a better icon.

Over the past two months, I’ve explored creating an icon from scratch and editing an existing icon to make something acceptably unique. But I’ve been unhappy with the results. Here’s a particularly terrible example, in which I lightly edited the Microsoft Word icon (which I’m not even that big of a fan of).

For now, I’m giving up on this. Instead, I’ll be using a free (for non-commercial use) icon I found online back in October and have been holding onto ever since, just in case. It’s not perfect, but it does meet a few of my requirements: Unlike the actual Notepad icon, it faces forward instead of at an angle, and it’s colorful and vibrant. I may replace it again in the future if I find something better. But let’s just use this for now.

To use it in our application, we need to download the icon (in ICO format) and then add it to the Resources folder in our project. (We did this before for the original Notepad icon as well, so the folder is already there.)

To change the icon in application settings, right-click the project name in Solution Explorer and choose Properties. Then, navigate to the Application tab and select the icon from the list under “Icon:”.

Save and close application settings. Then, open Form1.vb [Design], select the form’s title bar to select Form1, and find the Icon property in the Properties pane. Change this to the same icon. (It will be located in C:\Users\<your user name.\source\repos\NotePadWF\Resources by default when you’re presented with an Open File dialog.)

Run the application to make sure the icon appears in both the application title bar and in the taskbar.

There’s one more thing to do: The icon we’re using requires that we credit its creator for making the icon and that we provide a link to them. The obvious place to do this is the About box, and Visual Basic even provides a control called a LinkLabel that looks like a web URL and lets us open a web browser and navigate to any URL.

If you open AboutBox1.vb [Design], you’ll see that this dialog was pre-fabbed by Visual Studio, and it has a specific layout which makes adding a LinkLabel (or any other arbitrary control) a bit difficult. But since the Company Name label is pretty pointless in our case, we can just delete that and replace it with a LinkLabel. So just select that control in the designer and press DELETE. Gone.

Now, drag in a LinkLabel from...

Gain unlimited access to Premium articles.

With technology shaping our everyday lives, how could we not dig deeper?

Thurrott Premium delivers an honest and thorough perspective about the technologies we use and rely on everyday. Discover deeper content as a Premium member.

Tagged with

Share post

Please check our Community Guidelines before commenting

Windows Intelligence In Your Inbox

Sign up for our new free newsletter to get three time-saving tips each Friday

"*" indicates required fields

This field is for validation purposes and should be left unchanged.

Thurrott © 2024 Thurrott LLC