The WinForms Notepad Project: More Fit and Finish (Premium)

Here are a few minor changes and fixes to .NETpad related to the status bar, word wrap, and app publishing.
Cleaning up the status bar (again)
Now that I know we won’t be implementing the File encoding and line ending functionality from Notepad, we should clean up the status bar in our own app. Specifically, we don’t need the two panels that typically display “Windows (CRLF)” and “UTF-8” in Notepad.

But I’d also like to change the weird right-heavy weighting of the status bar panels we are going to keep, as I’ve never really understood why all the information in the Notepad status bar is jammed up against the right side of the window. It seems to me that it should all be on the left. In the shot below, you can see the real Notepad’s status bar on the top and the look I’m going for in .NETpad on the bottom.

To achieve this, we will only need four status bar panels, not five. And we’ll want to assign specific sizes to the leftmost three panels, and enable the Spring property—which lets it auto-fill any remaining space---on the fourth. (Currently, that property is enabled on the leftmost panel instead.)

So, open Form1.vb [Design] and select AutoSaveToolStripStatusLabel. Then, change the value of its Spring property to False in the Properties pane.

Next, select one of the two right-most status bar panels (really status labels)---one of the blank ones---right-click it, and choose Delete to remove it from the app. Then, select the rightmost (blank) status label---it’s called ToolStripStatusLabel1 in my app---and change its Spring property to True.

Next, we need to change the Size property of each of the three-most status labels. I used the same size for both AutoSaveToolStripStatusLabel and Position ToolStripStatusLabel---350, 52---and set ZoomToolStripStatusLabel to 175, 52.

After that, make sure that the BorderSides property of the three right-most status labels (all but AutoSaveToolStripStatusLabel) is set to Left so we get that nice divider between each. And voila.
Fixing Word Wrap
Way back in the second article in this series, about three months ago, I implemented the Word Wrap command, which is simple enough: The TextBox control has a WordWrap property that acts as a toggle for this commonly-used feature. But somewhere along the way, I screwed it up, and the weird thing is, I’m not sure if I documented this change when I implemented application settings in The WinForms Notepad Project: More Settings, About Box Basics (Premium). Point being, you may not even have this issue.

There are two ways to know if you need to fix this. The first is that Word Wrap doesn’t work: You run the app and select Format > Word Wrap and nothing changes; but when you stop and re-run the app the setting has finally changed. The second way is to open Form1.vb [Design], select TextBox1, and then examine its WordWrap property in the Properties pane. If you see a little pink box next to WordWrap in the lis...

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