Word Processor Version.01 EME 4411 Week 5
The Scroll Bars
Important Properties max and min - range of integers the horizontal scroll bar can represent No caption property - use a label value property specifies the current value of the scroll bar. smallchange - click on an arrow Largechange - click a open area between the handle and the arrow
Example Write a program that allows the user to input a number between 1 and 100 We will use a horizontal scroll bar to ensure that the user ONLY adds a legal integer
Design the Interface
Set the Properties Scroll Bar Name = hsbScroll1 Value = 50 smallchange = 1 largechange = 5 LabelName = lblValue Caption = "50" Alignment = Center
Write the Code Private Sub hsbScrollBar1_Change() lblValue.Caption = hsbScrollBar1.Value End Sub
Word Processor.1 Write a simple word processor that allows the user to set the font name with radio buttons, font style with check boxes, and font size with a horizontal scroll bar.
Design the Form
Properties FormfrmWordBackColor = Make it blue Caption = "Word Processor.01" Command Button cmdClearCaption = "&Clear" Command Button cmdExitCaption = "E&xit" Text BoxtxtFontSizeAlignment = Center
Properties (continued) Scroll BarHSBFontSizeLargeChange = 4 Max = 22 Min = 6 SmallChange = 4 Value = 14 Check BoxchkItalicsBackColor = Make it blue Caption= “&Italics” Check BoxchkUnderlineBackColor = Make it blue Caption = “&Underline” Check BoxchkBoldBackColor = Make it blue Caption = "&Bold"
Properties (Continued) Option ButtonoptSchoolbookBackColor = Make it blue Caption = "Schoolbook" FontName = "Century Schoolbook" FontSize = 8.25 Option ButtonoptArialBackColor = Make it blue Caption = "Arial" FontName = "Arial" FontSize = 8.25 Option ButtonoptSansSerifBackColor = Make it blue Caption = "Sans Serif"
Properties (Continued) Text BoxtxtTextFontBold = False MultiLine = True ScrollBars = Vertical LabelLabel3Alignment = Center BackColor= Make it blue Caption = "Font Size:" LabellblFontTypeBackColor = Make it blue Caption = "Font Type:" LabellblFontBackColor = Make it blue Caption = "Select Font:"
Write the Code chkBold If chkBold is false Then set Font bold in text widow to False Else set Font bold in text widow to True
Write the Code chkUnderline If underline value is False Then set Font underline to False Else set Font underline to False
Write the Code optArial If its value is True Then txtText.FontName = "Arial"
Write the Code hsbFontSize set text size caption to HSB’s Font size set text.window font size to HSB Font size
Homework Write Word Processor.1 Have a great week!
Write the Code chkItalics If chkItalics is false set Font Italic in text window to False Else set Font Italic in text window to True