Windows obviously saves the location and size of the program's window before the window becomes minimized or maximized. Similarly, when you minimize and then restore the program, it goes back to the same location and size. Let's examine these cases: When you maximize any Windows program and then restore it, the program returns to the same location and size as before it was maximized. Such a scheme would indeed work fine were it not for those window-display options known as minimize and maximize. If you move or resize Notepad, terminate the program, and then run it again, it will appear in the saved location and with the saved size.Īt first, implementing a feature to save the location and size seems to involve merely saving the form's DesktopBounds property in the registry when the program terminates and setting the property from the registry when the program next runs. You can view all the Notepad registry settings in the Registry Editor (Regedit.exe) under HKEY_CURRENT_USER with the key Software\Microsoft\Notepad.īesides saving the Word Wrap setting and the font, Notepad also uses the registry to save its window size and position on the desktop. As you may know, whenever you change the Word Wrap menu item in Notepad or the font that it uses, the new settings are used when you next run Notepad. Here's what it looks like with some text typed in.īefore beginning to implement a menu in Notepad Clone, I want to implement some code that accesses the Windows registry. NotepadCloneNoMenu.es ® 2001 by Charles Petzold //-Īpplication.Run(new NotepadCloneNoMenu()) Ĭonsidering the length of this program, it has a high level of functionality and works much like the Notepad program when the Word Wrap menu item is checked. The constructor concludes by setting several properties appropriate for multiline text boxes. Here's the first module, which creates the text box and uses DockStyle.Fill to make it fill the form's client area. To present the code in manageable chunks, I'm going to build this program up through several levels of inheritance. We're now ready to begin building a clone of Notepad.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |