|
-
Feb 16th, 2000, 10:08 AM
#1
Thread Starter
Junior Member
-
Feb 16th, 2000, 10:41 AM
#2
Addicted Member
Forget a commondialog for fonts here a code i made to do it cuase i never figure out how to use it for ftons so here
Code:
Private Sub Form_Load()
For X = 0 To Screen.FontCount
List1.AddItem Screen.Fonts(X)
Next X
End Sub
Private Sub List1_Click()
RichTextBox1.Font = List1.Text
End Sub
-
Feb 16th, 2000, 10:56 AM
#3
Addicted Member
To use common dialog with rtf, use something like this. Basically, you want to setup the dialog with whatever font is at the current cursor position (selstart). Then show the dialog. You must set the flags property to show the font dialog. This example sets the flags to show printer and screen fonts, and effects (underline, italic, underline, etc)
Private Sub mnuChooseFont_Click()
On Error GoTo cancelerror
'Setup and show font dialog with font at
'current position in RTF so user can see
'what he/she's changing the font from.
CommonDialog.FontName = currentRTF.SelFontName
CommonDialog.FontSize = currentRTF.SelFontSize
CommonDialog.FontBold = currentRTF.SelBold
CommonDialog.FontItalic = currentRTF.SelItalic
CommonDialog.FontUnderline = currentRTF.SelUnderline
CommonDialog.FontStrikethru = currentRTF.SelStrikeThru
CommonDialog.Color = currentRTF.SelColor
CommonDialog.Flags = cdlCFScreenFonts Or cdlCFPrinterFonts Or cdlCFEffects
CommonDialog.ShowFont
'Apply new font to text
currentRTF.SelFontName = CommonDialog.FontName
currentRTF.SelFontSize = CommonDialog.FontSize
currentRTF.SelBold = CommonDialog.FontBold
currentRTF.SelItalic = CommonDialog.FontItalic
currentRTF.SelUnderline = CommonDialog.FontUnderline
currentRTF.SelStrikeThru = CommonDialog.FontStrikethru
currentRTF.SelColor = CommonDialog.Color
Exit Sub 'Successful
cancelerror: 'Error (user canceled)
Exit Sub
End Sub
Hope that helps.
------------------
Micah Carrick
http://micah.carrick.com
[email protected]
ICQ: 53480225
-
Feb 16th, 2000, 11:29 AM
#4
Thread Starter
Junior Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|