如何做考试试题的程序设计思路
[attach]82424[/attach]如果是几题可以在表单上作,可是几千题呢?我想肯定要与数据库相联,但前面的单选 按钮在什么上设计?请高手指点思路。 如图:
** Test.prg CREATE CURSOR 试题表 (题目 C(100), 选项 I, 单选 M) INSERT INTO 试题表 VALUES ("题目1xxxxxxxxxxx", 4, "A选1"+0h0D0A+"B选"+0h0D0A+"C选"+0h0D0A+"D选"+0h0D0A+"E选") INSERT INTO 试题表 VALUES ("题目2xxxxxxxxxxx", 3, "A选2"+0h0D0A+"B选"+0h0D0A+"C选"+0h0D0A+"D选") INSERT INTO 试题表 VALUES ("题目3xxxxxxxxxxx", 2, "A选3"+0h0D0A+"B选"+0h0D0A+"C选") INSERT INTO 试题表 VALUES ("题目4xxxxxxxxxxx", 1, "A选4"+0h0D0A+"B选") GO TOP of = CREATEOBJECT("Form1") of.show(1) DEFINE CLASS Form1 as Form Height = 500 ADD OBJECT Grid1 as Grid1 WITH Width=this.Width,Height=this.Height ENDDEFINE DEFINE CLASS Grid1 as Grid ColumnCount = 1 RowHeight = 150 RecordSourceType = 1 RecordSource = "试题表" nRecno = 0 PROCEDURE Init this.Column1.RemoveObject("Text1") this.Column1.AddObject("Contai1", "Contai1") this.Column1.Sparse = .F. this.Column1.Width = 200 **this.Column1.DynamicCurrentControl = ["Contai1"] ENDPROC ENDDEFINE DEFINE CLASS Contai1 as Container Visible = .T. BorderStyle = 0 ADD OBJECT Text1 as Text1 WITH Top=2,Left=2,ControlSource="试题表.题目" ADD OBJECT OptionGroup1 as OptionGroup WITH Top=20,Left=2,BorderStyle=0,ButtonCount=5,ControlSource="试题表.选项" ADD OBJECT OptionText1 as Text1 WITH Top=24,Left=22,ControlSource="GETWORDNUM(试题表.单选, 1)" ADD OBJECT OptionText2 as Text1 WITH Top=42,Left=22,ControlSource="GETWORDNUM(试题表.单选, 2)" ADD OBJECT OptionText3 as Text1 WITH Top=60,Left=22,ControlSource="GETWORDNUM(试题表.单选, 3)" ADD OBJECT OptionText4 as Text1 WITH Top=78,Left=22,ControlSource="GETWORDNUM(试题表.单选, 4)" ADD OBJECT OptionText5 as Text1 WITH Top=96,Left=22,ControlSource="GETWORDNUM(试题表.单选, 5)" PROCEDURE Init this.OptionGroup1.Width = 20 this.OptionGroup1.Height = this.Parent.Parent.RowHeight-25 ENDPROC ENDDEFINE DEFINE CLASS Text1 as TextBox Visible = .T. BackStyle = 0 BorderStyle = 0 ReadOnly = .T. ENDDEFINE
[此贴子已经被作者于2015-11-9 23:45编辑过]