Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change Form's Font size on fly.

Status
Not open for further replies.

newtofoxpro

Programmer
Sep 16, 2007
301
IN
oRepForm = CREATEOBJECT("FORM")
WITH oRepForm
.ControlBox = .f.
.BorderStyle = 1
.TitleBar = 0
.fontName = 'Letter Gothic'
.fontSize = 9
.Left =0
.Top =0
.Height = 500
.Width = 1000
.Show()
ENDWITH
create cursor tmpcomp1 (line03d M)
appe blank
replace line03d WITH "I am using Visual Foxpro 8"
@ 0,0 say 'Text Preview' font 'Arial',12
@ 1.6,0 edit line03d size wrow()-1.6,wcol() scroll NOMODIFY
ON KEY LABEL + do MaxZoom
READ modal
oRepForm.Release()
RELEASE oRepForm
RETURN

FUNCTION MaxZoom
****************
ORepForm.FontSize = 12
RETURN

When I press + Key-Button it should change form font size so it would applicable to @ edit ..

Thanks & Best Regards.
 
I strongly recommend against using the @ commands. Use VFP's controls instead--you'll have a lot more control over how things work. With a VFP editbox, all you have to do to change the fontsize is change one property:

* If this code is in an EditBox method:
This.FontSize = 12

* If the code is in a form method:
ThisForm.edtNameofEditbox.FontSize = 12

For a big picture view of how to let users control font sizes, check out my article:


Tamar
 
Thanks Tamar I have solved this way...

PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.Show
RETURN
DEFINE CLASS form1 AS form
ControlBox = .f.
BorderStyle = 1
Height = 1509
Width = 2040
Name = "form1"
ADD OBJECT edit1 AS editbox WITH ;
Height = 1000, ;
Left = 0, ;
Top = 0, ;
Width = 2040, ;
Name = "Edit1", ;
ReadOnly = .T., ;
Value="I am using Visual Foxpro 8", ;
FontName = 'Letter Gothic', ;
FontSize = 8
PROCEDURE edit1.KeyPress
LPARAMETERS nKeyCode, nShiftAltCtrl
DO case
CASE nKeyCode=27
thisform.Release()
CASE nKeyCode=43 && +
this.FontSize = 12
CASE nKeyCode=45 && -
this.FontSize = 8
ENDCASE
ENDPROC
ENDDEFINE
 
@Tamar, As per your advice I build and Above post code is working..
When I add

ReadOnly = .T

Editbox backcolor changed with gray color. This may be true that showing object as read only.

But I wish to change this gray color to white.

Do you know your change this BackColor ?

Thanks & Best Regards.

 
But I wish to change this gray color to white.

I'm not sure which control you are referring to. But, in general, you need to change the DisabledBackColor property. You might also consider adjusting the DisabledForeColor. Between them, those properties should give the effect you want.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
I don't think DisabledBackColor will affect ReadOnly = .T., but you can use Enabled = .F. instead of ReadOnly = .T. and then the Disabled colors will work.

Tamar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top