Guidance
指路人
g.yi.org
software / rapidq / Examples / Algorithm & Maths / uc.rq

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
'Unit Change

'Ver0.1 by zadamaxi@yahoo.com.cn

'Do unit change, include:
'1. M to Feet
'2. kG to lb
'3. cm to Inch

     $INCLUDE "RAPIDQ.INC"

     DECLARE SUB TabChange
     DECLARE SUB MtoFeet
     DECLARE SUB FeettoM
     DECLARE SUB lbtokG
     DECLARE SUB kGtolb
     DECLARE SUB CMtoInch
     DECLARE SUB InchtoCM
     DECLARE SUB MyExit

     FeetPerM=3.28084
     lbPerkG=2.20462
     InchPerCM=0.3937

     CREATE MainForm AS QFORM
      Center
      Height = 300
      Width = 350
      CAPTION = "Unit Change"
      CREATE Tab AS QTABCONTROL
       AddTabs "MtoFeet","kGtolb","CMtoinch","Exit"
       Width = MainForm.ClientWidth
       Height = MainForm.ClientHeight
       OnChange = TabChange
       HotTrack = True
    '00000000000000000000000000000000000000000000
       CREATE Panel0 AS QPANEL
        Top = 40
        Left = 5
        Width = Tab.ClientWidth - 10
        Height = Tab.ClientHeight - 50
        BevelInner = bvLowered
        CREATE label1 AS QLABEL
         Top = 20
         Left = 10
         CAPTION = "M"
        END CREATE
        CREATE label2 AS QLABEL
         Top = 60
         Left = 10
         CAPTION = "Feet"
        END CREATE

        CREATE edit1 AS QEDIT
         Top = 20
         Left = 40
         Text = "1"
         OnChange=MtoFeet
        END CREATE

        CREATE edit2 AS QEDIT
         Top = 60
         Left = 40
         Text = STR$(FeetPerM)
         OnChange=FeettoM
        END CREATE

       END CREATE
    '11111111111111111111111111111111111111111111111111
       CREATE Panel1 AS QPANEL
        Top = 40
        Left = 5
        Width = Tab.ClientWidth - 10
        Height = Tab.ClientHeight - 50
        BevelInner = bvLowered
        Visible = False
        CREATE label3 AS QLABEL
         Top = 20
         Left = 10
         CAPTION = "kG"
        END CREATE
        CREATE label4 AS QLABEL
         Top = 60
         Left = 10
         CAPTION = "lb"
        END CREATE

        CREATE edit3 AS QEDIT
         Top = 20
         Left = 40
         Text = "1"
         OnChange=kGtolb
        END CREATE

        CREATE edit4 AS QEDIT
         Top = 60
         Left = 40
         Text = STR$(lbPerkG)
         OnChange=lbtokG
        END CREATE
       END CREATE

    '222222222222222222222222222222222222222222222222
       CREATE Panel2 AS QPANEL
        Top = 40
        Left = 5
        Width = Tab.ClientWidth - 10
        Height = Tab.ClientHeight - 50
        BevelInner = bvLowered
        Visible = False
        CREATE label5 AS QLABEL
         Top = 20
         Left = 10
         CAPTION = "cm"
        END CREATE
        CREATE label6 AS QLABEL
         Top = 60
         Left = 10
         CAPTION = "Inch"
        END CREATE

        CREATE edit5 AS QEDIT
         Top = 20
         Left = 40
         Text = "1"
         OnChange=CMtoInch
        END CREATE

        CREATE edit6 AS QEDIT
         Top = 60
         Left = 40
         Text = STR$(InchPerCM)
         OnChange=InchtoCM
        END CREATE
       END CREATE

    '333333333333333333333333333333333333333333333333
       CREATE Panel3 AS QPANEL
        Top = 40
        Left = 5
        Width = Tab.ClientWidth - 10
        Height = Tab.ClientHeight - 50
        BevelInner = bvLowered
        Visible = False

        CREATE label7 AS QLABEL
         Top = 20
         Left = 10
         CAPTION = "Unit Change Ver0.1"+CHR$(13)+"zadamaxi@yahoo.com.cn 2001.9"
        END CREATE

        CREATE butn1 AS QBUTTON
         Top = 60
         Left = 40
         CAPTION = "Exit"
         OnClick=MyExit
        END CREATE
       END CREATE
      END CREATE
     END CREATE


     SUB TabChange
      SELECT CASE Tab.TabIndex
      CASE 0
       Panel0.Visible = True
       Panel1.Visible = False
       Panel2.Visible = False
       Panel3.Visible = False
      CASE 1
       Panel1.Visible = True
       Panel0.Visible = False
       Panel2.Visible = False
       Panel3.Visible = False
      CASE 2
       Panel2.Visible = True
       Panel1.Visible = False
       Panel0.Visible = False
       Panel3.Visible = False
      CASE 3
       Panel3.Visible = True
       Panel1.Visible = False
       Panel2.Visible = False
       Panel0.Visible = False
      END SELECT
     END SUB

'11111
     SUB MtoFeet
      Edit2.text=STR$(VAL(Edit1.text)*FeetPerM)
     END SUB

     SUB FeettoM
      Edit1.text=STR$(VAL(Edit2.text)/FeetPerM)
     END SUB

'22222
     SUB kGtolb
      Edit4.text=STR$(VAL(Edit3.text)*lbPerkG)
     END SUB

     SUB lbtokG
      Edit3.text=STR$(VAL(Edit4.text)/lbPerkG)
     END SUB

'33333
     SUB CMtoInch
      Edit6.text=STR$(VAL(Edit5.text)*InchPerCM)
     END SUB

     SUB InchtoCM
      Edit5.text=STR$(VAL(Edit6.text)/InchPerCM)
     END SUB

     SUB MyExit
      END
     END SUB

     MainForm.SHOWMODAL
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Sun 2022-9-25  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2009-07-25 17:30:54