After getting the Ribbon Working and opening some forms I noticed that the title bars on the new forms did not match the title bar of the application. How to get the titles to change. Finally thanks to some suggestions by Tracy Pearson and Dave Crozier on the ProFox lists http://leafe.com/archives/search/profox
Example of the different Title Bars below:
I created a form class with images for the bar, the form icon and buttons for the Close, Zoom and Minimise Buttons,
These are adjusted in the resize event of the form.
Picture of Base Form Class below
This.LockScreen = .T. ThisForm.Image1.Width = ThisForm.Width ThisForm.cmdClose.Left = ThisForm.Width - ThisForm.cmdClose.Width -1 With ThisForm.cmdZoom .Left = ThisForm.cmdClose.Left - .Width - 2 .Top = ThisForm.cmdClose.Top EndWith With ThisForm.cmdMinimize .Left = ThisForm.cmdZoom.Left - .Width - 2 .Top = ThisForm.cmdClose.Top EndWith ThisForm.imgFormIcon.Height = ThisForm.cmdClose.Height With ThisForm.imgBottomBar .Top = ThisForm.image1.Top + ThisForm.Image1.Height .Left = ThisForm.image1.Left .Width = ThisForm.image1.Width EndWith With ThisForm.imgDevider .Top = ThisForm.txtbtns1.Top - 11 .Left = This.Left + 5 .Width = This.Width - 10 EndWith With ThisForm.lblCaption .Left = ThisForm.imgFormIcon.Width + 2 .Width = ThisForm.Width - (ThisForm.Width - This.cmdMinimize.Left) - .Left EndWith This.SetTitleColour && Code to change background of form. This.LockScreen = .F. ThisForm.Refresh()
I set the TitleBar Property off and ran the form.
Now I need to have the background reflect the Ribbon Theme. So after research downloaded VFP Imaging vcx from http://weblogs.foxite.com/vfpimaging/archive/2006/06/22/1906.aspx courtesy of <Cesar Chalom>
This gives a really good graduated theme to the background of your forms.
Initially I set up a timer to run code to check the theme in the Ribbon Bar every 10 milliseconds but this changed the cursor to an hour glass when you hovered over the form. After research I replaced this Idea with getting the Theme Changer to initiate the forms SetTitleColour method.
So SetTitleColour Code.
With Thisform.Image1 If Type("frmMainForm.CBM") = "O" Do Case Case frmMainForm.CBM.ColorScheme = 0 .Picture = '\\Path to images\BlueTitle1.bmp' This.lblCaption.ForeColor = Rgb(0,0,0) This.Gradbackground1.BackColor1 = Rgb(200,216,237) This.Gradbackground1.BackColor2 = Rgb(255,255,255) Case frmMainForm.CBM.ColorScheme = 1 .Picture = '\\Path to images\BlackTitle2.bmp' This.lblCaption.ForeColor = Rgb(0,128,192) This.Gradbackground1.BackColor1 = Rgb(185,191,200) This.Gradbackground1.BackColor2 = Rgb(255,255,255) Case frmMainForm.CBM.ColorScheme = 2 .Picture = '\\Path to images\AquaTitle1.bmp' This.lblCaption.ForeColor = Rgb(0,0,0) This.Gradbackground1.BackColor1 = Rgb(199,205,219) This.Gradbackground1.BackColor2 = Rgb(199,205,219) Case frmMainForm.CBM.ColorScheme = 3 .Picture = '\\Path to images\SilverTitle3.bmp' This.lblCaption.ForeColor = Rgb(0,0,0) This.Gradbackground1.BackColor1 = Rgb(214,220,231) This.Gradbackground1.BackColor2 = Rgb(255,255,255) Endcase Else .Picture = '\\Path to images\bluetitle1.bmp' This.lblCaption.ForeColor = Rgb(0,0,0) Endif Endwith
With Code in a new mainforms OfficeBar method (GetTheme) which is called by the CommandBarsManager method (onVisualThemeChanged) with ThisForm.GetTheme
Local lnCount As Number ,lcRunningForm As Character For lnCount = 1 To _Screen.FormCount lcRunningForm = _Screen.Forms(lnCount).Caption If lcRunningForm <> _Screen.Caption && Set Colour of Themes on Form _Screen.Forms(lnCount).Resize EndIf EndFor