我将xpside示例用代码实现,可无法指定olecontrol1控件的picture属性,请高手指点!
PUBLIC oform1
oform1=Newobject("form1")
oform1.Show
RETURN
DEFINE CLASS Form1 AS form
Top = 116
Left = 81
Height = 356
Width = 442
DoCreate = .T.
Caption = "Form1"
Name = "Form1"
ADD OBJECT Command1 AS commandbutton WITH ;
Top = 60,;
Left = 216,;
Height = 37,;
Width = 169,;
Caption = "添加标题及按钮",;
Name = "Command1"
ADD OBJECT Olecontrol1 AS olecontrol WITH ;
Top = 156,;
Left = 228,;
Height = 100,;
Width = 100,;
Name = "Olecontrol1",;
OLECLASS='MSComctlLib.ImageListCtrl.2'
ADD OBJECT xpside1 AS olecontrol WITH ;
Top = 12,;
Left = 12,;
Height = 336,;
Width = 181,;
ShowTips = .T.,;
Name = "xpside1",;
OLECLASS='Xpside.XpsideMenu'
PROCEDURE Command1.Click
thisform.xpside1.AddFrame("标题1",1,1,200,.t.,)
thisform.xpside1.AddFrame("标题2",0,1,200,.t.,)
thisform.xpside1.AddFrame("标题3",1,0,250,.t.,)
thisform.xpside1.AddButton(0,"按钮1",100,1,.t.,.t.,thisform.olecontrol1.ListImages[1].Picture,'功能1')
thisform.xpside1.AddButton(0,"按钮2",100,1,.t.,.t.,thisform.olecontrol1.ListImages[1].Picture,'功能2')
thisform.xpside1.AddButton(0,"按钮3",100,1,.t.,.t.,thisform.olecontrol1.ListImages[1].Picture,'功能3')
thisform.xpside1.AddButton(1,"按钮1",100,1,.t.,.t.,thisform.olecontrol1.ListImages[2].Picture,'功能1')
thisform.xpside1.AddButton(1,"按钮2",100,1,.t.,.t.,thisform.olecontrol1.ListImages[2].Picture,'功能2')
thisform.xpside1.AddButton(1,"按钮3",100,1,.t.,.t.,thisform.olecontrol1.ListImages[2].Picture,'功能3')
thisform.xpside1.AddButton(2,"按钮1",100,1,.t.,.t.,thisform.olecontrol1.ListImages[3].Picture,'功能1')
thisform.xpside1.AddButton(2,"按钮2",100,1,.t.,.t.,thisform.olecontrol1.ListImages[3].Picture,'功能2')
thisform.xpside1.AddButton(2,"按钮3",100,1,.t.,.t.,thisform.olecontrol1.ListImages[3].Picture,'功能3')
ENDPROC
PROCEDURE init
WITH thisform.olecontrol1
.ListImages[0].Picture='print.ico'
.ListImages[1].Picture='print.ico'
.ListImages[2].Picture='print.ico'
ENDWITH
ENDPROC
PROCEDURE xpside1.Action
*** ActiveX 控件事件 ***
LPARAMETERS frame, button
MessageBox("您点了第" + Alltrim(Str(frame)) + "个内容的第" + Alltrim(Str(button)) + "个项目!")
ENDPROC
ENDDEFINE
.ListImages[0].Picture='print.ico'
.ListImages[1].Picture='print.ico'
.ListImages[2].Picture='print.ico'
改为
.ListImages.Clear
.ListImages.Add(1,'Image1',LoadPicture('d:\a.bmp'))
.ListImages.Add(2,'Image2',LoadPicture('d:\b.bmp'))
.ListImages.Add(3,'Image3',LoadPicture('d:\c.bmp'))