| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2270 人关注过本帖, 1 人收藏
标题:win7计算器?
只看楼主 加入收藏
TonyDeng
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:304
帖 子:25859
专家分:48889
注 册:2011-6-22
收藏
得分:0 
我用的是Win8,它的窗口标题都是居中的。

授人以渔,不授人以鱼。
2012-09-17 22:46
有容就大
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:东土大唐
等 级:版主
威 望:74
帖 子:9048
专家分:14309
注 册:2011-11-11
收藏
得分:0 
以下是引用TonyDeng在2012-9-17 22:46:11的发言:

我用的是Win8,它的窗口标题都是居中的。

绕了半日原来是这一出
 那你用的VFP是那个版本的啊?

梅尚程荀
马谭杨奚







                                                       
2012-09-17 22:54
TonyDeng
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:304
帖 子:25859
专家分:48889
注 册:2011-6-22
收藏
得分:0 
图片附件: 游客没有浏览图片的权限,请 登录注册

授人以渔,不授人以鱼。
2012-09-17 22:59
TonyDeng
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:304
帖 子:25859
专家分:48889
注 册:2011-6-22
收藏
得分:0 
我用VFP9

授人以渔,不授人以鱼。
2012-09-17 22:59
有容就大
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:东土大唐
等 级:版主
威 望:74
帖 子:9048
专家分:14309
注 册:2011-11-11
收藏
得分:0 
以下是引用TonyDeng在2012-9-17 22:59:48的发言:

我用VFP9

我也用的9.0啊
看来我还是老老实实抱着XP玩吧 不管什么边框了

梅尚程荀
马谭杨奚







                                                       
2012-09-17 23:02
sdta
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:江苏省连云港市
等 级:版主
威 望:335
帖 子:9841
专家分:27213
注 册:2012-2-5
收藏
得分:0 
图片附件: 游客没有浏览图片的权限,请 登录注册

坚守VFP最后的阵地
2012-09-17 23:07
有容就大
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:东土大唐
等 级:版主
威 望:74
帖 子:9048
专家分:14309
注 册:2011-11-11
收藏
得分:0 
以下是引用sdta在2012-9-17 23:07:53的发言:

挑逗俺啊
求真相

梅尚程荀
马谭杨奚







                                                       
2012-09-17 23:13
sdta
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:江苏省连云港市
等 级:版主
威 望:335
帖 子:9841
专家分:27213
注 册:2012-2-5
收藏
得分:0 
难怪西天取不回真经
PADC()研究透彻了,问题就解决了

[ 本帖最后由 sdta 于 2012-9-17 23:22 编辑 ]

坚守VFP最后的阵地
2012-09-17 23:16
TonyDeng
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:304
帖 子:25859
专家分:48889
注 册:2011-6-22
收藏
得分:0 
用空格凑呗

授人以渔,不授人以鱼。
2012-09-17 23:17
TonyDeng
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:304
帖 子:25859
专家分:48889
注 册:2011-6-22
收藏
得分:0 
程序代码:
CLEAR ALL 

PUBLIC ga_Keys[28]
ga_Keys[1]  = CREATEOBJECT("Key_t", "MC", "MC")
ga_Keys[2]  = CREATEOBJECT("Key_t", "MR", "MR")
ga_Keys[3]  = CREATEOBJECT("Key_t", "MS", "MS")
ga_Keys[4]  = CREATEOBJECT("Key_t", "M1", "M+")
ga_Keys[5]  = CREATEOBJECT("Key_t", "M2", "M-")
ga_Keys[6]  = CREATEOBJECT("Key_t", "BS", "←")
ga_Keys[7]  = CREATEOBJECT("Key_t", "C1", "CE")
ga_Keys[8]  = CREATEOBJECT("Key_t", "C2", "C")
ga_Keys[9]  = CREATEOBJECT("Key_t", "sign", "±")
ga_Keys[10] = CREATEOBJECT("Key_t", "sqrt", "√")
ga_Keys[11] = CREATEOBJECT("Key_t", "7", "7")
ga_Keys[12] = CREATEOBJECT("Key_t", "8", "8")
ga_Keys[13] = CREATEOBJECT("Key_t", "9", "9")
ga_Keys[14] = CREATEOBJECT("Key_t", "/", "/")
ga_Keys[15] = CREATEOBJECT("Key_t", "%", "%")
ga_Keys[16] = CREATEOBJECT("Key_t", "4", "4")
ga_Keys[17] = CREATEOBJECT("Key_t", "5", "5")
ga_Keys[18] = CREATEOBJECT("Key_t", "6", "6")
ga_Keys[19] = CREATEOBJECT("Key_t", "*", "*")
ga_Keys[20] = CREATEOBJECT("Key_t", "inverse", "1/x")
ga_Keys[21] = CREATEOBJECT("Key_t", "1", "1")
ga_Keys[22] = CREATEOBJECT("Key_t", "2", "2")
ga_Keys[23] = CREATEOBJECT("Key_t", "3", "3")
ga_Keys[24] = CREATEOBJECT("Key_t", "-", "-")
ga_Keys[25] = CREATEOBJECT("Key_t", "=", "=")
ga_Keys[26] = CREATEOBJECT("Key_t", "0", "0")
ga_Keys[27] = CREATEOBJECT("Key_t", ".", ".")
ga_Keys[28] = CREATEOBJECT("Key_t", "+", "+")

PUBLIC gc_Expression, gc_Result
gc_Expression = ""
gc_Result = ""

SET DECIMALS TO 4
ON ERROR DO errHandler WITH ERROR( ), MESSAGE( ), MESSAGE(1), PROGRAM( ), LINENO( )
Main()
ON ERROR 

CLEAR ALL
RETURN 

PROCEDURE errHandler(merror, mess, mess1, mprog, mlineno)
    MESSAGEBOX("表达式错误:" + mess)
ENDPROC 

PROCEDURE Main()
    LOCAL lo_MainForm
    lo_MainForm = NEWOBJECT("C_FORM")
    lo_MainForm.Show
    READ EVENTS
ENDPROC 

DEFINE CLASS Key_t AS Custom
    ID = ""                && 键标识
    Caption = ""        && 键标签
   
    PROCEDURE Init(tc_ID, tc_Caption)
        WITH This
            .ID = tc_ID
            .Caption = tc_Caption
        ENDWITH
    ENDPROC
   
ENDDEFINE 

DEFINE CLASS C_BUTTON AS CommandButton
    Width = 40
    Height = 32
    FontName = "Terminal"
   
    *- 键名属性
    Key = ""
   
    PROCEDURE Init(t_Key)
        WITH This
            .Key = t_Key
            .Caption = .Key.Caption
        ENDWITH
    ENDPROC
   
    PROCEDURE Click
        DO CASE
            CASE ISDIGIT(This.Key.ID) .OR. INLIST(This.Key.ID, "+", "-", "*", "/")
                gc_Expression = gc_Expression + This.key.Caption
            CASE This.Key.ID == "BS"
                gc_Expression = LEFT(gc_Expression, LEN(gc_Expression) - 1)
            CASE This.Key.ID == "C2"
                gc_Expression = ""
                gc_Result = ""
            CASE This.Key.ID == "="
                gc_Result = TRANSFORM(&gc_Expression)
            CASE This.Key.ID == "sqrt"
                gc_Result = TRANSFORM(SQRT(&gc_Expression))
        ENDCASE
        ThisForm.Refresh
    ENDPROC
   
ENDDEFINE 

DEFINE CLASS C_FORM AS Form
    Caption = "计算器"
    MaxButton = .F.
    BorderStyle = 1
    AutoCenter = .T.
   
    ADD OBJECT ContentBox   AS Container WITH Width = 240, Height = 50
    ADD OBJECT ButtonsPanel AS Container WITH Width = 240, Height = 250, BorderWidth = 0
   
    PROCEDURE ContentBox.Init
        WITH This
            .SpecialEffect = 1
            .AddObject("lbl_Expression", "Label")
            .lbl_Expression.Top = 2
            .AddObject("lbl_Result", "Label")
            .lbl_Result.Top = 25
            .SetAll("Left", 2)
            .SetAll("Width", 220)
            .SetAll("Height", 20)
            .SetAll("FontSize", 12)
            .SetAll("Alignment", 1)
            .SetAll("Visible", .T.)
        ENDWITH
    ENDPROC
   
    PROCEDURE ContentBox.Refresh
        This.lbl_Expression.Caption = gc_Expression
        This.lbl_Result.Caption = gc_Result
    ENDPROC
   
    PROCEDURE ButtonsPanel.Init
        LOCAL lc_KeyName
        LOCAL la_Padding[5]
        LOCAL ln_Index, ln_Top, ln_Left
       
        la_Padding[1] = 0
        la_Padding[2] = 0
        la_Padding[3] = 0
        la_Padding[4] = 0
        la_Padding[5] = 10
       
        ln_Top = la_Padding[1]
        ln_Left = la_Padding[4]
        FOR ln_Index = 1 TO ALEN(ga_Keys,1)
            lc_KeyName = "Key_" + PADL(ln_Index, 2, '0')
            This.AddObject(lc_KeyName, "C_BUTTON", ga_Keys[ln_Index])
            WITH This.&lc_KeyName
                IF .Key.ID == '0'
                    .Width = 2 * .Width + la_Padding[5]
                ENDIF
                IF .Key.ID == '='
                    .Height = 2 * .Height + la_Padding[5]
                ENDIF
                IF INLIST(ln_Index, 6, 11, 16, 21, 26)
                    ln_Top = ln_Top + .Height + la_Padding[5]
                    ln_Left = la_Padding[4]
                ENDIF
                .Top = ln_Top
                .Left = ln_Left
                .Visible = .T.
                ln_Left = ln_Left + .Width + la_Padding[5]
            ENDWITH
        NEXT
       
    ENDPROC
   
    PROCEDURE Init
        WITH This
            .ContentBox.Top = 5
            .ContentBox.Left = 20
            .ButtonsPanel.Top = .ContentBox.Top + .ContentBox.Height + 10
            .ButtonsPanel.Left = 20
            .Width = .ButtonsPanel.Width + 40
            .Height = .ButtonsPanel.Top + .ButtonsPanel.Height + 5
        ENDWITH
    ENDPROC
   
    PROCEDURE Destroy
        CLEAR EVENTS
    ENDPROC
   
ENDDEFINE

授人以渔,不授人以鱼。
2012-09-17 23:18
快速回复:win7计算器?
数据加载中...
 
   



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

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