Report a writing board with VB.NET (1)

zhaozj2021-02-11  242

All source code is downloaded here: http://www.up2e.com/Resource.php Design report for simple letters program with VB.NET (1) ----- by zigz (luhi * up2e.com ) luluhai@eastday.com

Let's take a look at the interface first:

A) use controls

Mainmenu, SavefileDialog, OpenFileDialog, FontDialog, ImageList, PrintDocument, ColorDialog, etc.

2) Key features

1) First talk about the most critical, you can merge multiple font styles, such as one word it can be both bold, it is behind, and it is an overline! Although this can be done with the font dialog, it is really spent on the toolbar button on the toolbar button.

2) Implement text search, replacement. And achieve the drag of the control.

3) Implement the print preview function.

3) Main design

General functions, such as opening files, saving files, copying, paste, cut, etc., you can refer to the code file. Now mainly, some key functions are designed.

1) Tips dialog

Considering that the user saves the user text content when exiting and closing the current text. So if the text content changes, you need to remove the current file when the user closes the current file (such as new text, opening other text or exiting Notepad), reminds whether the user saves the current file. To implement this feature, you need to set a Boolean variable to track the changes in text content in RichTextBox. The RichTextBox control has a TextChanged event. When the text changes, this event will be fired, so use this event to monitor the changes in text. Use a Boolean variable BSAVE as a marker. The change of the text content can be judged if the check of BSAVE is added as long as the appropriate position is added. Figure 1 Save prompt

'Declare a global Boolean variable to mark the changes and save conditions in richtextbox

Dim Bsave as boolean

Private Sub RTBOX_TEXTCHANGED (Byval e as system.eventargs) Handles RTBOX.TEXTCHANGED

'Text changes, set the variable BSAVE to False

BSAVE = FALSE

End Sub

2) Questions about the font list on the user system in ComboBox

Load the font on the user system on the font bar of the Word board ComboBox, in order to realize him, it takes a little time, and finally finds the answer in the HELP comes with VS.NET.

'The code below is load all fonts in the local system to ComboBox

DIM AllFonts as Fontfamily

For Each Allfonts in System.drawing.FontFamily.Families

Comboxfont.Items.add (allfonts.name)

Next Figure 2 font list is endless ...

转载请注明原文地址:https://www.9cbs.com/read-3735.html

New Post(0)