This is very simple to implement but the impact is cool.
Ready? Then follow these 7 steps (some are optional):
1. Initially hide the tabs of the PageFrame
2. Themes property should be set to .F.
3. Change the tabs’ Backstyle to 0 (transparent). Note that while tabs are shown (default), VFP will not allow you to change the backstyle that is why we need to hide those first.
4. Add a container inside pages so the inner part of the pageframe will appear normal and only those outside of that container will appear transparent
5. Optionally, you can change the style of the container into 3 (Themed) which adds effect to the Glass-like interface you wanted to achieve
6. Change the forecolor of the tabs to mix properly with the background
7. Finally, show the tabs again.
And that is it. Told you it is very simple. Enjoy!
And here are the codes:
Source code
Local oForm As Form
oForm = Createobject('GlassPage')
oForm.Show(1)
Return
Define Class GlassPage As Form
AutoCenter = .T.
Height = 370
Width = 341
Caption = "Glass PageFrame"
Picture = Addbs(Getenv("WinDir"))+"Prairie Wind.bmp"
Add Object label1 As Label With;
left = 24,;
Top = 23,;
Width = 300,;
WordWrap = .T.,;
AutoSize = .T.,;
BackStyle = 0,;
FontSize = 8,;
FontName = "Tahoma",;
ForeColor = RGB(255,255,255),;
Caption = "This simple demonstration will show how to make a PageFrame "+;
"tranparent. Seems nice to combine with Windows 7 Glass Effect. "+;
CHR(13)+CHR(10)+CHR(13)+CHR(10)+;
"Additional Effect has been implemented on the container inside the pageframe "+;
"via Style property (as shown on page1)."
Add Object GlassPage As PageFrame With ;
Left = 22, Top = 120, Width = 295, Height = 200, PageCount = 2,;
Themes = .F., Tabs = .F., TabStyle = 1
ADD OBJECT command1 as commandbutton WITH ;
left = 22, top = 330, Caption = "\<Change Background", AutoSize = .T.
Procedure Load
Endproc
Procedure Init
With Thisform.GlassPage.Page1
.BackStyle = 0
.Caption = "Master"
.ForeColor = Rgb(255,255,0)
.AddObject("Cont1","Container")
With .Cont1
.Top = 10
.Left = 10
.Visible = .T.
.BackStyle = 1
.Width = 270
.Height = 145
.SpecialEffect = 1
.Style = 3
Endwith
Endwith
With Thisform.GlassPage.Page2
.BackStyle = 0
.Caption = "Transactions"
.ForeColor = Rgb(255,255,0)
.AddObject("Cont1","Container")
With .Cont1
.Top = 10
.Left = 10
.Visible = .T.
.BackStyle = 1
.Width = 270
.Height = 145
.SpecialEffect = 1
.BackColor = RGB(202,202,255)
Endwith
Endwith
Thisform.GlassPage.Tabs=.T.
ENDPROC
PROCEDURE Command1.Click
thisform.Picture = GETPICT()
ENDPROC
Enddefine
No comments:
Post a Comment