经典实例---带底图的MDI窗口

一、创建主菜单m_main。

二、创建主窗口w_main,并将其属性Window  Type设置为mdihelp!,将MenuName属性设置为m_main。

三、创建图片窗口w_pic,并在该窗口中放置picture控件,起名为p_1;设置w_pic的属性,把Window  Type的属性设置为popup!,选择visible,其它属性全部取消。

四、编写w_pic代码:

    ⑴、定义实例变量(instance variables)

           boolean     isfullscreen

           integer      oldwidth,oldheight

    ⑵、编写open()事件:

          isfullscreen=true

          oldwidth=p_1.width

          oldheight=p_1.height

    ⑶、编写resize()事件

         if     isfullscreen   then

               p_1.x=0

               p_1.y=0

               p_1.resize(newwidth,newheight)

         else

               p_1.resize(oldwidth,odlheight)

               integer    ax,ay

               ax=(newwidth-oldwidth)/2

               if    ax<0    then   ax=0

               ay=(newheight-oldheight)/2

               if   ay<0     then   ay=0

               p_1.x=ax

               p_1.y=ay

          end   if 

    ⑷、定义function:   init(string   as_picture,boolean  as_isfullscreen)  return (none)

          参数:

                  access:public            return   type:none                   function name:init  

                  pass  by:value            argument  type:string            argument  name:as_picture

                  pass  by:value            argument  type:boolean        argument  name:as_isfullscreen

         代码:

                 p_1.originalsize=ture

                 p_1.picturename=as_picture

                 oldheight=p_1.height

                 oldwidth=p_1.width

                 p_1.originalsize=false

                 this.resize(this.width,this.height)

五、编写w_main代码:

    ⑴、定义实例变量(instance variables)

            w_pic   mdipicture

            string    mdipicturename

            boolean    mdiisfullscreen

    ⑵、定义function:   setpicture()

            参数:

                       access:public              return  type:(none)                    function   name:setpicture

                       pass  by:value             argument  type:string               argument   name:as_picture

                       pass  by:value             argument  type:boolean           argument   name:as_isfullscreent

            代码:

                       mdipicturename=as_picture

                       mdiisfullscreen=as_isfullscreen

                       if    isvalid(mdipicture)    then

                             mdipicture.init(mdipicturename,mdiisfullscreen)

                             mdipicture.resize(this.width,this.height)

                       end  if

    ⑶、编写resize()事件:

            if    isvalid(mdipicture) = false    then

                  opensheet(mdipicture,this)

                  mdipicture.init(mdipicturename,mdiisfullscreen)

                  mdipicture.x=0

                  mdipicture.y=0

              end  if

              mdipicture.resize(newwidth,newheight)

六、编写application的open()事件

        open(w_main)

        w_main.setpicture("back.bmp",true)

 

图1:最小化窗口

图片

图2:最大化窗口

 图片

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值