The WinForms Notepad Project (2022): Coming to Terms with the Status Bar (Premium)

In an ideal world, .NETpad’s status bar would adapt its layout similarly to the real Notepad when the user resizes the window. But this isn’t an ideal world, and this isn’t a big enough issue to waste too much time on. So I’m going to make a few small adjustments to the Windows Forms version of .NETpad that get it a bit closer to how Notepad works. And then move on with life.

I listed this issue in The WinForms Notepad Project (2022): Fork Me, but the easiest way to understand it is to open Notepad and watch how its status bar items resize as you make the app window smaller. They each reach some minimum size and then stop shrinking, and at some point, the app window itself reaches some minimum size of its own and stops resizing. At its thinnest, you can still see all four of its status bar items.

.NETpad doesn’t work that way, and between the work I’ve done this week and last month---documented in The WinForms Notepad Project (2022): Reviving a Classic---I feel like I’ve already spent too much time on this. So here are the small changes I made:

First, I shrunk the amount of space between each status bar item---via their Margin properties---from 75 to 50. Then, I temporarily added some code to the app to determine the smallest acceptable size for the app window, such that you could still see all four of those status bar items. Basically 620 x 200 pixels.

Then, I changed the form’s MinimizeSize property to 620,200 to match that size. The trick here was to test it at various display scaling configurations. The PC I’m currently using has a Full HD (1920 x 1080) display and I’m using the system recommended scaling of 150 percent, and of course it looks fine at that scaling. But I also tested it at 100, 125, and 175 percent scaling to make sure it was reasonably similar. And it was, at least at 125 and 175 percent scaling.

At 100 percent scaling, however, the right-most status bar item, Zoom, gets cut off. And … whatever. I’m OK with that.

And that’s it. No actual code needed to be written, and while it’s not exactly like Notepad, it’s close enough. So I’m moving on.

I will incorporate this change and the previous two fixes I made---documented here and here---into the Windows Forms version of .NETpad on GitHub today.

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