Define CLASS tbform1 AS form
Height=250
Width=350
AutoCenter=.T.
Caption="Sample"
oToolbar=""
Procedure init
this.oToolbar=createobject("mytoolbar")
this.oToolbar.left=1
this.oToolbar.top=1
Endproc
Enddefine
Define CLASS mytoolbar AS toolbar
color3=-1
ADD OBJECT lbl1 AS LABEL WITH ;
Caption = "Label", ;
AutoSize = .T., ;
BackStyle = 0
ADD OBJECT cmdColor AS commandbutton WITH ;
HEIGHT = 24,;
WIDTH = 24, ;
Caption = 'C', ;
ToolTipText = 'Color'
PROCEDURE Init
*- Setup and Dock ToolBar
THIS.lbl1.visible=.T.
THIS.cmdColor.visible=.T.
THIS.Caption = "Test toolbar"
THIS.SetAll('FontSize',8)
ENDPROC
PROCEDURE cmdColor.Click
if this.parent.color3<255
this.parent.color3=this.parent.color3+16
else
this.parent.color3=0
endif
_SCREEN.ActiveForm.backcolor=rgb(212,208,this.parent.color3)
ENDPROC
Enddefine
Define CLASS closecmd1 AS commandbutton
Top=226
Left=0
Width=60
Height=24
Caption="Close"
Procedure click
Clear event
Endproc
Enddefine
2.form的init事件中加入
this.windowstate=2
3.form的showwindow屬性設置為2
主窗口的關閉按鈕里加入
on shutdown
clear event
close all
clear all