| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 4388 人关注过本帖, 1 人收藏
标题:XP计算器?
取消只看楼主 加入收藏
有容就大
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:东土大唐
等 级:版主
威 望:74
帖 子:9048
专家分:14309
注 册:2011-11-11
结帖率:99.34%
收藏(1)
已结贴  问题点数:20 回复次数:71 
XP计算器?
终于模仿出了XP自带常规计算器的大致界面
图片附件: 游客没有浏览图片的权限,请 登录注册


有几个问题向大牛们请教:
1.form的Icon图标比较滑稽 而且如果插入的RGB的ico图片不是32*32的就插补进去,真的吗?
2.现在对菜单比较陌生  菜单栏我是一个一个添加的label按钮 这样会对后面的界面元素调度增加难度吗
或者根本就不行?
3.那个中间有个M的框框 我是用label做的 但是和系统那个明星看起来差距大啊 它是一个凹陷的貌似浮雕的东西
我怎么做才能达到他那个效果? 把label的属性翻了个遍 没找到丝毫线索 是不是要用其它的控件做?
搜索更多相关主题的帖子: 元素 菜单栏 
2012-09-18 14:09
有容就大
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:东土大唐
等 级:版主
威 望:74
帖 子:9048
专家分:14309
注 册:2011-11-11
收藏
得分:0 
以下是引用TonyDeng在2012-9-18 14:17:23的发言:

Label没有这种效果,Container或CommandButton就可以。
菜单有专门建菜单的命令组。

THANKS 那去了解了解
那第一个 和第三个咋办?

梅尚程荀
马谭杨奚







                                                       
2012-09-18 14:19
有容就大
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:东土大唐
等 级:版主
威 望:74
帖 子:9048
专家分:14309
注 册:2011-11-11
收藏
得分:0 
以下是引用TonyDeng在2012-9-18 14:24:30的发言:

现在是考验你,编写的代码中,当发现使用错了Label的时候,能不能迅速地花最少的代价改成用别的。

一般都是控件隔离的写代码
不过如果我不敢确定个东西 怀疑这个东西 担心这个东西的时候我就会上来向你求证 做到步步为营 免得以后大会战吃亏

梅尚程荀
马谭杨奚







                                                       
2012-09-18 14:29
有容就大
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:东土大唐
等 级:版主
威 望:74
帖 子:9048
专家分:14309
注 册:2011-11-11
收藏
得分:0 
回复 8楼 TonyDeng
这个和易维护性有关?

梅尚程荀
马谭杨奚







                                                       
2012-09-18 14:48
有容就大
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:东土大唐
等 级:版主
威 望:74
帖 子:9048
专家分:14309
注 册:2011-11-11
收藏
得分:0 
回复 12楼 sdta
又在挑逗俺
求真相

梅尚程荀
马谭杨奚







                                                       
2012-09-18 19:01
有容就大
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:东土大唐
等 级:版主
威 望:74
帖 子:9048
专家分:14309
注 册:2011-11-11
收藏
得分:0 
回复 15楼 sdta
嘿嘿 我是想知道 TextBox前的那个Label怎么做成凹陷的形状 ?

梅尚程荀
马谭杨奚







                                                       
2012-09-18 19:18
有容就大
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:东土大唐
等 级:版主
威 望:74
帖 子:9048
专家分:14309
注 册:2011-11-11
收藏
得分:0 
以下是引用lygcw9603在2012-9-18 19:06:21的发言:

明知山有虎,偏向虎山行。

没有买卖 就没有杀害

梅尚程荀
马谭杨奚







                                                       
2012-09-18 19:19
有容就大
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:东土大唐
等 级:版主
威 望:74
帖 子:9048
专家分:14309
注 册:2011-11-11
收藏
得分:0 
以下是引用sdta在2012-9-18 19:51:16的发言:

不是标签,是容器控件
标签添加到容器中

非常感谢你的指点。

梅尚程荀
马谭杨奚







                                                       
2012-09-18 20:04
有容就大
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:东土大唐
等 级:版主
威 望:74
帖 子:9048
专家分:14309
注 册:2011-11-11
收藏
得分:0 
以下是引用hu9jj在2012-9-18 21:18:16的发言:

不愧是有基础的,上手快的很啊!

那家伙是有点悟性的
============================
几位老大这么说让俺受宠若惊啊 其实全靠大牛们指点 我受益匪浅 我功倍事半 我内牛满面

梅尚程荀
马谭杨奚







                                                       
2012-09-18 21:52
有容就大
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:东土大唐
等 级:版主
威 望:74
帖 子:9048
专家分:14309
注 册:2011-11-11
收藏
得分:0 
我这个的思路也是一个表单+一个容器 不过一个大的容器里面包含了1个小容器 3个命令按钮组
图片附件: 游客没有浏览图片的权限,请 登录注册

1是容器 显示是否存储TextBox的结果 存则显示一个M符号
2 3 4 都是命令按钮组
5是个大容器
先付上自己写的代码吧 有几个问题求解
程序代码:
*****************************************************************
*--主函数
set clock on
set talk off
main_form = CreateObject("c_form")
main_form.show
read events
return
*--程序结束
*****************************************************************

*****************************************************************
*--类       c_form
*-- 父类:  form
*-- 基类:    form
define class c_form as Form
    BorderStyle = 1
    width = 256
    height = 215
    AutoCenter = .T.
    Maxbutton = .F.
    Caption = " 计算器"
    Icon = 'D:\VFP\ico\rr.ico'

    add object menu_edit as label with Height = 20, Width = 50,  Caption = "编辑(\<E)"
    add object menu_view as label with Height = 20, Width = 50,  Caption = "查看(\<V)"
    add object menu_help as label with Height = 20, Width = 50,  Caption = "帮助(\<H)"

    add object f_body as body                         


procedure Arrange
    with thisform.menu_view
         .Top = ThisForm.menu_edit.Top
         .Left = ThisForm.menu_edit.Left + ThisForm.menu_edit.Width
    endwith
   

    with thisform.menu_help
         .Top = ThisForm.menu_edit.Top
         .Left = ThisForm.menu_view.Left + ThisForm.menu_view.Width
    endwith
   

     with thisform.f_body
         .Top = ThisForm.menu_edit.Top + ThisForm.menu_edit.Height
         .Left = ThisForm.menu_edit.Left
         .Height = ThisForm.Height - ThisForm.menu_edit.Height
    endwith
endproc

       procedure Activate
          thisform.Arrange
       endproc

       procedure f_body.num_ thisform.f_body.b_text.value = '7'
          MessageBox("haha!")
       endproc
      

       procedure f_body.mem_ thisform.f_body.m_flag.mem_disp_text.Caption = "M"
       endproc


procedure destroy
*!*         a = MessageBox("真的要退出吗?", 1 + 32, "退出")
*!*         if a == 1
         clear events
endproc

enddefine
*
*--end_define: c_form
*****************************************************************    


*****************************************************************
*--类      body
*-- 父类:  container
*-- 基类:  container
define class body as Container
       Caption = ""
       BorderColor = Rgb(222, 222, 222) 

       Width = 256
      

       add object b_text as TextBox with Top = 4, Left = 8, value = 0, Alignment = 1,;
                            Height = 20, Width = This.Width - 2 * This.b_text.Left,;
                            BorderStyle = 0
       add object m_flag as mem_disp with Top = 35, Left = 14                      

       add object num_opr as num_btn with Top = 68, left = 55, Height = 300, Width = 200  

       add object cls_opr as cls_btn with Top = 35, left = 55 

       add object mem_opr as mem_btn with Top = 68, left = 8                

                           

                           

*!*           procedure num_*!*             this.b_text.value = '7'
*!*              MessageBox("haha!")
*!*           endproc
*!*          

*!*           procedure mem_*!*             * this.b.value = '7'
*!*              *m_flag.mem_disp_text.Caption = "M"
*!*              MessageBox("haha!")
*!*           endproc
      

enddefine

*
*--end_define: body
*****************************************************************


*****************************************************************
*--类      num_btn
*-- 父类:  CommandGutton
*-- 基类:  CommandGutton
define class num_btn as CommandGroup
    ButtonCount = 20
    BackStyle = 0
    BorderStyle = 0
   

    procedure init
         local sp as Integer
         sp = 4
         with  .Themes = .F.
             .Top = 0
             .left = 0
             .Height = 27
             .Width = 35
             .Caption = '7'
             .ForeColor = Rgb(0, 0, 255)
         endwith

        

         with  .Themes = .F.
             .Top = Top
             .left = Left +  + sp
             .Height =  .Width =  .Caption = '8'
             .ForeColor = Rgb(0, 0, 255)
         endwith

        

          with  .Themes = .F.
             .Top = Top
             .left = Left +  + sp
             .Height =  .Width =  .Caption = '9'
             .ForeColor = Rgb(0, 0, 255)
         endwith

        

         with  .Themes = .F.
             .Top = Top
             .left = Left +  + sp
             .Height =  .Width =  .Caption = '/'
             .ForeColor = Rgb(255, 0, 0)
         endwith

        

         with  .Themes = .F.
             .Top = Top
             .left = Left +  + sp
             .Height =  .Width =  .Caption = 'sqrt'
             .ForeColor = Rgb(0, 0, 255)
         endwith

        

         with  .Themes = .F.
             .Top = Top +  + sp
             .left = Left
             .Height =  .Width =  .Caption = '4'
             .ForeColor = Rgb(0, 0, 255)
         endwith

        

         with  .Themes = .F.
             .Top = Top
             .left = Left +  + sp
             .Height =  .Width =  .Caption = '5'
             .ForeColor = Rgb(0, 0, 255)
         endwith

        

         with  .Themes = .F.
             .Top = Top
             .left = Left +  + sp
             .Height =  .Width =  .Caption = '6'
             .ForeColor = Rgb(0, 0, 255)
         endwith

        

         with  .Themes = .F.
             .Top = Top
             .left = Left +  + sp
             .Height =  .Width =  .Caption = '*'
             .ForeColor = Rgb(255, 0, 0)
         endwith

        

         with  .Themes = .F.
             .Top = Top
             .left = Left +  + sp
             .Height =  .Width =  .Caption = '%'
             .ForeColor = Rgb(0, 0, 255)
         endwith

        

         with  .Themes = .F.
             .Top = Top +  + sp
             .left = Left
             .Height =  .Width =  .Caption = '1'
             .ForeColor = Rgb(0, 0, 255)
         endwith

        

         with  .Themes = .F.
             .Top = Top
             .left = Left +  + sp
             .Height =  .Width =  .Caption = '2'
             .ForeColor = Rgb(0, 0, 255)
         endwith

        

         with  .Themes = .F.
             .Top = Top
             .left = Left +  + sp
             .Height =  .Width =  .Caption = '3'
             .ForeColor = Rgb(0, 0, 255)
         endwith

        

         with  .Themes = .F.
             .Top = Top
             .left = Left +  + sp
             .Height =  .Width =  .Caption = '-'
             .ForeColor = Rgb(255, 0, 0)
         endwith

        

         with  .Themes = .F.
             .Top = Top
             .left = Left +  + sp
             .Height =  .Width =  .Caption = '1/x'
             .ForeColor = Rgb(0, 0, 255)
         endwith

        

         with  .Themes = .F.
             .Top = Top +  + sp
             .left = Left
             .Height =  .Width =  .Caption = '0'
             .ForeColor = Rgb(0, 0, 255)
         endwith

        

           with  .Themes = .F.
             .Top = Top
             .left = Left +  + sp
             .Height =  .Width =  .Caption = '+/-'
             .ForeColor = Rgb(0, 0, 255)
         endwith

        

           with  .Themes = .F.
             .Top = Top
             .left = Left +  + sp
             .Height =  .Width =  .Caption = '.'
             .ForeColor = Rgb(0, 0, 255)
         endwith

        

          with  .Themes = .F.
             .Top = Top
             .left = Left +  + sp
             .Height =  .Width =  .Caption = '/'
             .ForeColor = Rgb(255, 0, 0)
         endwith

        

           with  .Themes = .F.
             .Top = Top
             .left = Left +  + sp
             .Height =  .Width =  .Caption = '='
             .ForeColor = Rgb(255, 0, 0)
         endwith       

    endproc

 

enddefine

*
*--end_define: num_btn
*****************************************************************



*****************************************************************
*--类      cls_btn
*-- 父类:  CommandGroup
*-- 基类:  CommandGroup
define class cls_btn as CommandGroup
     ButtonCount = 3
     BackStyle = 0
     BorderStyle = 0
     Width = 240
     Height = 25
    

     procedure init
         local sp as Integer
         sp = 5
         with  .Themes = .F.
             .Top = 0
             .left = 0
             .Height = 25
             .Width = 60
             .Caption = 'BackSpace'
             .ForeColor = Rgb(255, 0, 0)
         endwith

        

         with  .Themes = .F.
             .Top = Top
             .left = Left +  + sp
             .Height =  .Width =  .Caption = 'CE'
             .ForeColor = Rgb(255, 0, 0)
         endwith

        

         with  .Themes = .F.
             .Top = Top
             .left = Left +  + sp
             .Height =  .Width =  .Caption = 'C'
             .ForeColor = Rgb(255, 0, 0)
         endwith

     endproc
    

enddefine       

*
*--end_define: cls_btn
*****************************************************************


*****************************************************************
*--类      mem_btn
*-- 父类:  CommandGroup
*-- 基类:  CommandGroup
define class mem_btn as CommandGroup
     ButtonCount = 4
     BackStyle = 0
     BorderStyle = 0
     Width = 35
     Height = 240
    

    procedure init
        local sp as Integer
         sp = 4
         with  .Themes = .F.
             .Top = 0
             .left = 0
             .Height = 27
             .Width = 35
             .Caption = 'MC'
             .ForeColor = Rgb(255, 0, 0)
         endwith 

        

          with  .Themes = .F.
             .Top = Top +  + sp
             .left = Left
             .Height =  .Width =  .Caption = 'MR'
             .ForeColor = Rgb(255, 0, 0)
         endwith
        

         with  .Themes = .F.
             .Top = Top +  + sp
             .left = Left
             .Height =  .Width =  .Caption = 'MS'
             .ForeColor = Rgb(255, 0, 0)
         endwith
        

         with  .Themes = .F.
             .Top = Top +  + sp
             .left = Left
             .Height =  .Width =  .Caption = 'M+'
             .ForeColor = Rgb(255, 0, 0)
         endwith
    endproc
            

enddefine

*
*--end_define: mem_btn
*****************************************************************


*****************************************************************
*--类      mem_btn
*-- 父类:  CommandGroup
*-- 基类:  CommandGroup
define class mem_disp as Container
    Width = 25
    Height = 25
    BackStyle = 0
    BorderWidth = 1
    SpecialEffect = 1
   

    add object mem_disp_text as TextBox with Top = 1, Left = 1, Height = 23, Width = 23,;
                                  BackStyle = 0, BorderWidth = 0, Caption = 'M',;
                                  FontSize = 10, Rotation = 1, BorderStyle = 0
                                                                           

enddefine
*
*--end_define: mem_btn
***************************************************************** 
问题
1. 我在body大容器 也就是容器5里写事件代码click的时候引用不了body里其他的object? 但是可以相应一个messagebox()   函数 ~~ 但是把这个事件写到C_Form下(总表单)就能正常
  按理说body是自定义的一个类 在里面写他的方法函数怎么不成 而且他里面的控件都是一个级别的 经过他调用怎么会有问题? 这样的写法有错?
程序代码:
*!*           procedure num_*!*             this.b_text.value = '7'

*!*              MessageBox("haha!")

*!*           endproc

*!*          

*!*           procedure mem_*!*             * this.b.value = '7'

*!*              *m_flag.mem_disp_text.Caption = "M"

*!*              MessageBox("haha!")

*!*           endproc 
  错误提示找不到b_text对象 我把this去掉也不成 换成thisform也不行
  很不愿意在C_Form里写body的事件代码 啊
  难道是还要在body里加个init事件但是又怎么弄呢 貌似都先add object了啊
2 在那个小容器 也就是套在容器5里的容器1里添加了一个TextBox控件
    add object mem_disp_text as TextBox with Top = 1, Left = 1, Height = 23, Width = 23,;
                                  BackStyle = 0, BorderWidth = 0, Caption = 'M',;
                                  FontSize = 10, Rotation = 1, BorderStyle = 0
很显然我已经给他的Caption = ‘M’了 为什么运行程序无法显示 MS的click事件也不起作用?
可以看下界面图
图片附件: 游客没有浏览图片的权限,请 登录注册

凹陷那个方框里 怎么弄都没有东西?
      



[ 本帖最后由 有容就大 于 2012-9-18 22:43 编辑 ]

梅尚程荀
马谭杨奚







                                                       
2012-09-18 22:37
快速回复:XP计算器?
数据加载中...
 
   



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

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