|
-
Jul 14th, 2002, 12:53 PM
#1
Thread Starter
Hyperactive Member
CommonDialong font/color
Hello. Ok this is the code i have so far
VB Code:
Private Sub xpcmdbutton9_Click()
CommonDialog1.Flags = cdlCFBoth
CommonDialog1.ShowFont
End Sub
Private Sub xpcmdbutton10_Click()
CommonDialog1.Flags = cdlCFBoth
CommonDialog1.ShowColor
End Sub
What i want to happen is when the user selects their font, the textbox next to the command button displays their selected font name. And when the user selects their color, the backcolor of the label changes to that selected color. How do i do this?
Gamezfreak
Visual Basic 6 Enterprise Edition
Borland C++ Builder 6 Enterprise Edition
-
Jul 14th, 2002, 01:00 PM
#2
The picture isn't missing
Private Sub xpcmdbutton9_Click()
CommonDialog1.Flags = cdlCFBoth
CommonDialog1.ShowFont
Text1.Font.Name = CommonDialog1.FontName
End Sub
Private Sub xpcmdbutton10_Click()
CommonDialog1.Flags = cdlCFBoth
CommonDialog1.ShowColor
LAbel1.BackColor = CommonDialog1.Color
End Sub
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Jul 14th, 2002, 01:03 PM
#3
-
Jul 14th, 2002, 01:06 PM
#4
Thread Starter
Hyperactive Member
Thankyou, and how do i change to font of the textbox to the font selected?
Gamezfreak
Visual Basic 6 Enterprise Edition
Borland C++ Builder 6 Enterprise Edition
-
Jul 14th, 2002, 01:09 PM
#5
Frenzied Member
VB Code:
Text1.Font.Name = CommonDialog1.FontName
Text1.Font.Bold = CommonDialog1.FontBold
Text1.Font.Italic = CommonDialog1.FontItalic
Text1.Font.Underline = CommonDialog1.FontUnderline
Text1.Font.StrikeThough = CommonDialog1.FontStrikeThru
Text1.Font.Size = CommonDialog1.FontSize
MicroBasic
Dragon Shadow Trainer
There is no good or evil in the world...only programmers and fools .
-
Jul 14th, 2002, 01:15 PM
#6
The picture isn't missing
Originally posted by gamezfreakuk
Thankyou, and how do i change to font of the textbox to the font selected?
i already showed you how
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Jul 14th, 2002, 01:16 PM
#7
Thread Starter
Hyperactive Member
Thankyou!
Gamezfreak
Visual Basic 6 Enterprise Edition
Borland C++ Builder 6 Enterprise Edition
-
Jul 14th, 2002, 01:24 PM
#8
Thread Starter
Hyperactive Member
Ok new question, How do i save the font and font color to the registry so that the users font setttings are saved? I know how to use savesetting and getsetting (that is used with most of the login area of the program) but i am stuck on this can you help?
Gamezfreak
Visual Basic 6 Enterprise Edition
Borland C++ Builder 6 Enterprise Edition
-
Jul 14th, 2002, 01:25 PM
#9
The picture isn't missing
waht do you mean? just save the font color and the font name in it. the font color is just a number and the font name is a string of text.
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Jul 14th, 2002, 01:27 PM
#10
Thread Starter
Hyperactive Member
Huh?!?!
I mean like say the user picks "Arial" as their font and "Red" as their font color, how do i save these values to the registry, so that next time my app loads the textbox will display "Arial" (in the font arial) and the label's backcolor will be red.
Gamezfreak
Visual Basic 6 Enterprise Edition
Borland C++ Builder 6 Enterprise Edition
-
Jul 14th, 2002, 01:30 PM
#11
The picture isn't missing
save a key called "FontName" with string called "Arial" and a Key name "Color" with a string called "1667774595". then load the text and the color what part don't you get? you said you knew how to use savesetting and getsetting
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Jul 14th, 2002, 01:31 PM
#12
Frenzied Member
Well
VB Code:
SaveSettings("MyApp", "Font", "Name", CommonDialog1.FontName)
'SaveSettings("MyApp", "Font", "Size", CommonDialog1.FontSize)
'SaveSettings("MyApp", "Font", "Bold", CommonDialog1.FontBold)
'SaveSettings("MyApp", "Font", "Italic", CommonDialog1.FontItalic)
'SaveSettings("MyApp", "Font", "Underline", CommonDialog1.FontUnderline)
'SaveSettings("MyApp", "Font", "StrikeThru", CommonDialog1.FontStrikeThru)
SaveSettings("MyApp", "Font", "Color", Str(CommonDialog1.Color))
VB Code:
Text1.Text = GetSettings("MyApp", "Font", "Name", Arial)
Label1.BackColor = Val(GetSettings("MyApp", "Font", "Color", Str(vbBlack)))
Last edited by Microbasic; Jul 14th, 2002 at 01:42 PM.
MicroBasic
Dragon Shadow Trainer
There is no good or evil in the world...only programmers and fools .
-
Jul 14th, 2002, 01:37 PM
#13
Thread Starter
Hyperactive Member
I know this might sound retarded but how do get back those settings?
So that the textbox's font will be the saved font ect.
Gamezfreak
Visual Basic 6 Enterprise Edition
Borland C++ Builder 6 Enterprise Edition
-
Jul 14th, 2002, 01:43 PM
#14
-
Jul 14th, 2002, 01:46 PM
#15
Thread Starter
Hyperactive Member
VB Code:
Text1.Text = GetSettings("MyApp", "Font", "Name", Arial)
Label1.BackColor = Val(GetSettings("MyApp", "Font", "Color", Str(vbBlack)))
before i try this code, aint that a bit wrong, because if the user chooses "Comic Sans Ms" then the textbox will still display Arial
Gamezfreak
Visual Basic 6 Enterprise Edition
Borland C++ Builder 6 Enterprise Edition
-
Jul 14th, 2002, 01:49 PM
#16
The picture isn't missing
the last argument for GetSetting is what it would give you do if there wasnt an entry.
it should have been in quotes though
Text1.Text = GetSettings("MyApp", "Font", "Name", "Arial")
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Jul 14th, 2002, 01:58 PM
#17
The picture isn't missing
and remove the 'S' at the end of savesetting(s) and getsetting(s).
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Jul 14th, 2002, 02:00 PM
#18
Thread Starter
Hyperactive Member
Sorry you will have to explain this to me: -
I want it when the program is next loaded the textbox is formatted with all the settings that the user saved before (eg Font = Arial, Bold)
Or whatever font they saved.
Gamezfreak
Visual Basic 6 Enterprise Edition
Borland C++ Builder 6 Enterprise Edition
-
Jul 14th, 2002, 02:00 PM
#19
Frenzied Member
Originally posted by BuggyProgrammer
and remove the 'S' at the end of savesetting(s) and getsetting(s).
Oops
MicroBasic
Dragon Shadow Trainer
There is no good or evil in the world...only programmers and fools .
-
Jul 14th, 2002, 02:12 PM
#20
The picture isn't missing
now... i've attached a projct with what you mean. it will work. i've tested it.
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Jul 14th, 2002, 02:17 PM
#21
Thread Starter
Hyperactive Member
Thankyou, I dont need the zip file i have done it now, but thankyou very much please dont shout at me again
Gamezfreak
Visual Basic 6 Enterprise Edition
Borland C++ Builder 6 Enterprise Edition
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
|