|
-
Jan 24th, 2011, 12:55 PM
#1
Thread Starter
Lively Member
Word-like font and size selection
Hello everyone, I'm working on a word processor (yes, the thread with the quit forms and the count times open is the same word processor)
It's called iRobosoft Word. The 3rd version is at sourceforge and the 4th is in RC stage.
The 4th version is quite a major upgrade, but back to the topic.
For font I used:
Code:
Private Sub Rich_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Rich.TextChanged
Font1.Text = Rich.SelectionFont.ToString
End Sub
Font1 = ComboBox1 for Font
Size1 = ComboBox2 for Size
(Sorry can't figure out why the VBCode option is not working)
The output of the command is
[Font: Name=Tahoma, Size=8.25, Units=3, GdiCharSet=0, GdiVerticalFont=False]
which is not understandable to any human except us, VB.NET programers.
I would like the Name only to be displayed in the Font1, and Size in Size1.
That's one thing, I would like to select Font and Size like you do in Word, Corel, Openoffice, etc.
Please help.
The prize for helping will be a thank you, and rep.
For the ones trying to help but doesn't work, they only get the thank you.
-
Jan 24th, 2011, 01:42 PM
#2
Thread Starter
Lively Member
Re: Word-like font and size selection
-
Jan 24th, 2011, 02:04 PM
#3
Thread Starter
Lively Member
Re: Word-like font and size selection
Good news everyone, got installed fonts to display.
Used:
vb Code:
Dim f As System.Drawing.Text.InstalledFontCollection = New System.Drawing.Text.InstalledFontCollection Dim fFamily As FontFamily For Each fFamily In f.Families Font1.Items.Add(fFamily.Name) Next
I would like the set font button to work AND display font name ONLY on Rich_TextChanged. any ideas?
-
Jan 24th, 2011, 02:17 PM
#4
Thread Starter
Lively Member
Re: Word-like font and size selection
This works for font selection:
vb Code:
Private Sub FontToolStripComboBox_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Font1.SelectedIndexChanged Dim ComboFonts As System.Drawing.Font ComboFonts = Rich.SelectionFont Rich.SelectionFont = New System.Drawing.Font(Font1.Text, Rich.SelectionFont.Size, Rich.SelectionFont.Style) End Sub
However it still shows this cryptic (for the typicial user) currently selected font as [Font: Name=Tahoma, Size=8.25, Units=3, GdiCharSet=0, GdiVerticalFont=False]
-
Jan 24th, 2011, 03:13 PM
#5
Thread Starter
Lively Member
Re: Word-like font and size selection
-
Jan 24th, 2011, 04:11 PM
#6
Thread Starter
Lively Member
Re: Word-like font and size selection
How come no one wants to help me?
-
Jan 24th, 2011, 04:26 PM
#7
Re: Word-like font and size selection
Well I would say Revise you question since obviously you've made progress and it's not that no one wants to help they might just be asleep or at work.
And your first and last post are little more than 3 hours apart. don't expect people to be available when it suits you. Usually if one day has passed there will be some sort of answer to your thread, because then everyone that uses the forums has had a chance to look at your problem in their free time
-
Jan 24th, 2011, 04:33 PM
#8
Thread Starter
Lively Member
Re: Word-like font and size selection
I'm sorry BlindSniper. And thanks for finally replying!
So got Font1 combo box and I want to make it change fonts.
I can make it change fonts and display fonts, but I get:
Code:
[Font: Name=Tahoma, Size=8.25, Units=3, GdiCharSet=0, GdiVerticalFont=False].
when I type something.
(I use Font1.Text = Rich.SelectionFont.ToString for that)
The font, size, units etc depend on the RichTextBox but that's not the point. I want to get rid of everything except the Font Name.
I display installed fonts by:
Code:
Dim f As System.Drawing.Text.InstalledFontCollection = New System.Drawing.Text.InstalledFontCollection
Dim fFamily As FontFamily
For Each fFamily In f.Families
Font1.Items.Add(fFamily.Name)
Next
And apply the font using:
Code:
Private Sub FontToolStripComboBox_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Font1.SelectedIndexChanged
Dim ComboFonts As System.Drawing.Font
ComboFonts = Rich.SelectionFont
Rich.SelectionFont = New System.Drawing.Font(Font1.Text, Rich.SelectionFont.Size, Rich.SelectionFont.Style)
End Sub
-
Jan 24th, 2011, 04:40 PM
#9
Thread Starter
Lively Member
Re: Word-like font and size selection
Fixed it using:
Code:
Font1.Text = Rich.SelectionFont.FontFamily.Name.ToString
How do I do the same for size?
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
|