Question { 9085 }
write a program to create a notepad using common dialog
control and rich text box.
Answer
Private Sub Form_Resize()
RTB1.Width = frmMypad.ScaleWidth
RTB1.Height = frmMypad.ScaleHeight
End Sub
Private Sub mnubold_Click()
If RTB1.SelBold = True Then
RTB1.SelBold = False
Else
RTB1.SelBold = True
End If
End Sub
Private Sub mnubullets_Click()
If RTB1.SelBullet = True Then
RTB1.SelBullet = False
Else
RTB1.SelBullet = True
End If
End Sub
Private Sub mnucenter_Click()
RTB1.SelAlignment = 2
End Sub
Private Sub mnucolor_Click()
CD1.ShowColor
RTB1.SelColor = CD1.Color
End Sub
Private Sub mnucopy_Click()
Clipboard.Clear
Clipboard.SetText (RTB1.SelText)
End Sub
Private Sub mnucut_Click()
Clipboard.Clear
Clipboard.SetText (RTB1.SelText)
RTB1.SelText = ""
End Sub
Private Sub mnudate_Click()
RTB1.SelText = Date
End Sub
Private Sub mnudateandtime_Click()
RTB1.SelText = Now
End Sub
Private Sub mnudelete_Click()
RTB1.SelText = ""
End Sub
Private Sub mnuexit_Click()
End
End Sub
Private Sub mnufonts_Click()
CD1.ShowFont
RTB1.SelBold = CD1.FontBold
RTB1.SelFontSize = CD1.FontSize
RTB1.SelFontName = CD1.FontName
RTB1.SelItalic = CD1.FontItalic
End Sub
Private Sub mnuitalic_Click()
If RTB1.SelItalic = True Then
RTB1.SelItalic = False
Else
RTB1.SelItalic = True
End If
End Sub
Private Sub mnuleft_Click()
RTB1.SelAlignment = 0
End Sub
Private Sub mnunew_Click()
RTB1.Text = ""
frmMypad.Caption = "Mypad-Newfile"
End Sub
Private Sub mnuopen_Click()
CD1.ShowOpen
RTB1.FileName = CD1.FileName
frmMypad.Caption = "Mypad-" & CD1.FileTitle
End Sub
Private Sub mnupaste_Click()
RTB1.SelText = Clipboard.GetText
End Sub
Private Sub mnuprint_Click()
CD1.ShowPrinter
End Sub
Private Sub mnuright_Click()
RTB1.SelAlignment = 1
End Sub
Private Sub mnusave_Click()
CD1.DefaultExt = "Doc"
If frmMypad.Caption = "Mypad-Newfile" Then
CD1.ShowSave
End If
RTB1.SaveFile (CD1.FileName)
frmMypad.Caption = "Mypad-" & CD1.FileTitle
End Sub
Private Sub mnusaveas_Click()
CD1.DefaultExt = "Doc"
CD1.ShowSave
RTB1.SaveFile (CD1.FileName)
frmMypad.Caption = "Mypad-" & CD1.FileTitle
End Sub
Private Sub mnutime_Click()
RTB1.SelText = Time
End Sub
Private Sub mnuunderline_Click()
If RTB1.SelUnderline = True Then
RTB1.SelUnderline = False
Else
RTB1.SelUnderline = True
End If
End Sub