| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 736 人关注过本帖
标题:同类控件的子控件的属性,怎么Set All
取消只看楼主 加入收藏
不懂才问
Rank: 15Rank: 15Rank: 15Rank: 15Rank: 15
来 自:大草原
等 级:贵宾
威 望:29
帖 子:1503
专家分:6593
注 册:2010-7-5
结帖率:91.53%
收藏
已结贴  问题点数:20 回复次数:2 
同类控件的子控件的属性,怎么Set All
程序代码:
&&百钱买百鸡.prg

CLEAR ALL 
oForm = CREATEOBJECT("C_fm1")
WITH oForm
    .Caption = "百钱买百鸡(穷解法)"
    .AutoCenter = .T.
    .Show
    .minHeight=380
    .minWidth=375
ENDWITH 
READ EVENTS
CLEAR ALL 
RETURN 

DEFINE CLASS C_fm1 AS Form

    ADD OBJECT cmdExit AS CommandButton WITH Caption = "退出", Height = 25, Width = 85
    ADD OBJECT pgfContent AS PageFrame
    
    PROCEDURE Arrange
        LOCAL lnIndex
        
        WITH This.cmdExit
            .Top = ThisForm.Height - .Height - 5
            .Left = ThisForm.Width - .Width - 6
        ENDWITH 
        
        WITH This.pgfContent
            .Top = 5
            .Left = 5
            .Height = This.cmdExit.Top - 5
            .Width = This.Width - .Left - 5
            .Pages[1].Arrange
            .Pages[2].Arrange
        ENDWITH 
        
    ENDPROC 
    
    PROCEDURE Init
        WITH This.pgfContent
            .AddObject("Page1", "C_Page1")
            .AddObject("Page2", "C_Page2")
        ENDWITH 
    ENDPROC 
    
    PROCEDURE Activate
        This.Arrange
    ENDPROC 
    
    PROCEDURE Resize
        This.Arrange
    ENDPROC 
    
    PROCEDURE Destroy
        CLEAR EVENTS
    ENDPROC 
    
    PROCEDURE cmdExit.Click
        RELEASE ThisForm
    ENDPROC 

ENDDEFINE 

DEFINE CLASS C_Page1 AS Page
    Caption = "问题描述"
    
    ADD OBJECT Label1 AS Label WITH Caption = "百钱买百鸡,"
    ADD OBJECT Label2 As Label WITH Caption = "公鸡、母鸡、小鸡都要买,各能几只?"
    ADD OBJECT Label3 AS Label WITH Caption = "铜钱一百"
    ADD OBJECT Label4 AS Label WITH Caption = "公鸡一只五钱"
    ADD OBJECT Label5 AS Label WITH Caption = "母鸡一只三钱"
    ADD OBJECT Label6 AS Label WITH Caption = "小鸡三只一钱"
    
    PROCEDURE Init
        WITH This
            .SetAll("WordWrap", .T., "Label")
            .SetAll("FontSize", 10, "Label")
            .SetAll("AutoSize", .T., "Label")
        ENDWITH 
    ENDPROC 
    
    PROCEDURE Arrange
        LOCAL lnIndex
        FOR lnIndex = 1 TO This.ControlCount
            WITH This.Controls[lnIndex]
                .Top = 15 + (lnIndex - 1) * (.Height + 5)
                .Left = 10
                .Width = This.Parent.Width - .Left - 10
            ENDWITH 
        NEXT 
    ENDPROC 

ENDDEFINE 

DEFINE CLASS C_Page2 AS Page
     Caption = "解答"
     
     ADD OBJECT label1 AS editBox WITH Top = 5, Left = 5,WordWrap=.t.
     ADD OBJECT grid1 as Grid WITH columnCount=6,left=5
     ADD OBJECT grid2 as Grid WITH columnCount=6,left=5
     
     PROCEDURE Arrange
         WITH This.label1
             .Height =( .Parent.Parent.PageHeight-20) / 3
             .Width = .Parent.Parent.PageWidth-10
             .readOnly=.t.
             .value="  根据题意,可列方程:cocks+hens+chicks=100,5*cocks+3*hens+chicks/3=100。"+;
             "可见,这是一组不定方程。对于不定方程,要先确定一个变量的范围,才能对其求解。"+;
             "由问题,容易初步判定cocks,hens,chicks的取值范围:"+CHR(13)+;
             "cocks:019,hens:033,chicks:0100"+CHR(13)+;
             "  基本的解题思路是:依次取cocks值域中的一个值,然后求其余两数,看是否合题意,合乎者为解。"
         ENDWITH 
         WITH this.grid1
             .Height =( .Parent.Parent.PageHeight-20) / 3
             .Width = .Parent.Parent.PageWidth-10
             .top=.parent.label1.height+10
         ENDWITH
         WITH this.grid2
             .Height =( .Parent.Parent.PageHeight-20) / 3
             .Width = .Parent.Parent.PageWidth-10
             .top=.parent.label1.height+.parent.grid1.height+15
         ENDWITH
        WITH This
            .SetAll(".Header1.caption","穷举次数", "Grid")  &&???两个表格控件的标题都一样,怎么一起搞定呢?
        ENDWITH 
     ENDPROC
     
     PROCEDURE init
     
        CREATE CURSOR tempBqbj;
            (穷举次数 i,;
            公鸡数 i,;
            母鸡数 i,;
            小鸡数 i,;
            所用金额 n(5,2),;
            是解否 l)
            
        i=0
        FOR c=0 TO 19
            FOR h=0 TO 33
                ch=100-c-h
                temp=5*c+3*h+ch/3
                i=i+1
                IF temp=100
                    INSERT INTO tempBqbj VALUES(i,c,h,ch,temp,.t.)
                ELSE 
                    INSERT INTO tempBqbj VALUES(i,c,h,ch,temp,.f.)
                ENDIF
            ENDFOR
        ENDFOR
        
         this.grid1.recordSourceType=4
         this.grid1.recordSource="sele * from tempBqbj into cursor aaa"
         this.grid2.recordSourceType=4
         this.grid2.recordSource="sele * from tempBqbj where 是解否=.t. into cursor fff"
     ENDPROC  
     
ENDDEFINE 
搜索更多相关主题的帖子: color 
2015-11-22 14:48
不懂才问
Rank: 15Rank: 15Rank: 15Rank: 15Rank: 15
来 自:大草原
等 级:贵宾
威 望:29
帖 子:1503
专家分:6593
注 册:2010-7-5
收藏
得分:0 
里面的例子  是六个Label是Page的子控件   

可我想设置的是Page下面的两个Grid的Header1  中间隔着一级控件  语法是什么啊?

报告老师,我低头不是因为我在装低调,是你问的问题,我真的不会答,,,
2015-11-23 07:53
不懂才问
Rank: 15Rank: 15Rank: 15Rank: 15Rank: 15
来 自:大草原
等 级:贵宾
威 望:29
帖 子:1503
专家分:6593
注 册:2010-7-5
收藏
得分:0 
程序代码:
        WITH This
          
            .grid1.column1.header1.caption="穷举次数"
            .grid2.column1.header1.caption="穷举次数"
            .grid1.column2.header1.caption="公鸡数"
            .grid2.column2.header1.caption="公鸡数"
            .grid1.column3.header1.caption="母鸡数"
            .grid2.column3.header1.caption="母鸡数"
            .grid1.column4.header1.caption="小鸡数"
            .grid2.column4.header1.caption="小鸡数"
            .grid1.column5.header1.caption="所需金额"
            .grid2.column5.header1.caption="所需金额"
            .grid1.column6.header1.caption="是解否"
            .grid2.column6.header1.caption="是解否"
            .setAll("caption","测试","header")
*!*                FOR EACH oColumn IN grid.columns
*!*                    ocolumn.setall("caption","穷举次数","header1")
*!*                ENDFOR 
        ENDWITH    

报告老师,我低头不是因为我在装低调,是你问的问题,我真的不会答,,,
2015-11-23 13:28
快速回复:同类控件的子控件的属性,怎么Set All
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.021777 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved