|
-
May 2nd, 2008, 12:04 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] [02/03] font dialog
hi guys..
i would like to thank u guys for the great help extended to me from this forum and i have learned a lot from u guys...i need ur help again...
i am thinking of creating a config file where in i show the dialog box for the font to b selected creating the dialog is ok but i would like to know how do i go further ....like i want to store the font in a table and then set that font in the entier package....
i have created the dialog box as below
Code:
Dim fd As New FontDialog
fd.ShowDialog()
Dim SelectedFont As Font
SelectedFont = fd.Font
the querries r
how do i get the selected font from the dialog box.. the selectedfont cannot b taken in the text file or if the same is to b stored then pls. let me know how...
2ndly when i get the font...how do i set it to the textbox...
i tried
Code:
TextBox1.Font = txtFont.Text
but it gives error....txtfont.text is in blue line...so it wont accept...
pls. help...thankx a lot
-
May 2nd, 2008, 12:24 PM
#2
Re: [02/03] font dialog
You have to store each font as 3 parts: Name, Size, Style
P.S. If someone knows a better way of doing this, I'm all ears.
-
May 2nd, 2008, 12:53 PM
#3
Thread Starter
Hyperactive Member
Re: [02/03] font dialog
 Originally Posted by Jenner
You have to store each font as 3 parts: Name, Size, Style
P.S. If someone knows a better way of doing this, I'm all ears.
thankx for ur quick response jenner...but can u pls. guide me to a example where i can know how to do that ? get the name, size and stype of the font....
thankx a lot for being such a great help...thankx
-
May 2nd, 2008, 01:45 PM
#4
Re: [02/03] font dialog
Since this is [02/03] and you don't have the option of using My.Settings, I'd do as Jenner suggested.
The Font class has Name, Size and Style properties and those are the values you need to store. You can later reconstruct the font by instantiate a new font object and pass those values to the constructor or just set its properties.
-
May 2nd, 2008, 02:26 PM
#5
Thread Starter
Hyperactive Member
Re: [02/03] font dialog
great...i got it....i created 3 text boxes to store the name, size and style but how do i set the font property of a text box...
pls. help...thankx
-
May 2nd, 2008, 02:29 PM
#6
Re: [02/03] font dialog
Code:
Textbox1.Font = New Font(....)
-
May 2nd, 2008, 02:37 PM
#7
Thread Starter
Hyperactive Member
Re: [02/03] font dialog
 Originally Posted by JuggaloBrotha
Code:
Textbox1.Font = New Font(....)
thankx for ur quick response....i tried ur code...
Code:
TextBox3.Font = New Font(txtFont.Text)
but it gives a blue line and states
Code:
overload resolution failed coz no accessible 'New' accepts this no. of argument.
pls. guide....thankx
-
May 2nd, 2008, 02:51 PM
#8
Re: [02/03] font dialog
New Font("Fontname", 18, FontStyle.Regular)
Fontname is the name of the font family.
18 is the point size
FontStyle.Regular is the style.
Look at the intellicode that pops up, it's all right there in front of you!
-
May 2nd, 2008, 03:23 PM
#9
Re: [02/03] font dialog
 Originally Posted by kuldevbhasin
thankx for ur quick response....i tried ur code...
Code:
TextBox3.Font = New Font(txtFont.Text)
but it gives a blue line and states
Code:
overload resolution failed coz no accessible 'New' accepts this no. of argument.
pls. guide....thankx
I'm sorry, I posted the code assuming you actually paid attention to what you're doing.
 Originally Posted by Jenner
Look at the intellicode that pops up, it's all right there in front of you!
-
May 3rd, 2008, 06:08 AM
#10
Thread Starter
Hyperactive Member
Re: [02/03] font dialog
thankx a lot guys.....i got it right....i have done it in the following manner....
Code:
Private Sub btnSelectFont_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelectFont.Click
Dim fd As New FontDialog
fd.ShowDialog()
Dim SelectedFont As Font
SelectedFont = fd.Font
Dim mFontName As String
Dim mFontSize As Integer
Dim mFontStyle As FontStyle
txtFont.Text = SelectedFont.Name
TextBox1.Text = SelectedFont.Size
TextBox2.Text = SelectedFont.Style
mFontName = txtFont.Text
mFontSize = Val(TextBox1.Text)
Select Case Val(TextBox2.Text)
Case 0
mFontStyle = FontStyle.Bold
Case 1
mFontStyle = FontStyle.Italic
Case 2
mFontStyle = FontStyle.Regular
End Select
TextBox3.Font = New Font(mFontName, mFontSize, mFontStyle)
End Sub
thankx a lot for all ur help ...now if i am not asking for more...i would also like to know that can we change the font of the report (crystal report) from the program itself....i mean all the report cols.
thankx a lot.....
-
May 5th, 2008, 05:50 AM
#11
Thread Starter
Hyperactive Member
Re: [02/03] font dialog
can someone pls. guide me for changing the font of the report through the prog.itself pls....
thankx a lot...
-
May 5th, 2008, 11:21 AM
#12
Re: [02/03] font dialog
I would make a new post about that in the Crystal Reports forums if I were you. That's a very different topic.
-
May 6th, 2008, 01:54 AM
#13
Thread Starter
Hyperactive Member
Re: [02/03] font dialog
 Originally Posted by Jenner
I would make a new post about that in the Crystal Reports forums if I were you. That's a very different topic.
done as u instructed....and would mark this as resolved as u guys have helped me and have solved this particcular prob.
thankx a ton to all u guys.....
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
|