用VF怎麼做簡易計算器啊,VF編寫簡易計算器

時間 2021-08-13 22:50:49

1樓:匿名使用者

你在計算按鈕上雙擊,在其click事件中輸入**a=thisform.text1.valueb=thisform.

text2.valuen=thisform.optiongroup1.

valuedo  case

case  n=1

thisform.text3.value=a+bcase  n=2

thisform.text3.value=a-bcase  n=3

thisform.text3.value=a*bcase  n=4

thisform.text3.value=a/bendcase

thisform.refresh

2樓:

設計步驟如下(借鑑):

(1)建立應用程式使用者介面。

選擇“新建”表單,進入表單設計器,增加一個文字框控制元件textl、一個標籤控制元件label1和一個命令按鈕組commandgroup1,並將命令按鈕組的buttoncount屬性改為16。

(2)設定物件屬性如下表所示:

commandgroup1中各按鈕的屬性設定

物件 屬性 屬性值 說明

command1~command10 caption 依次改為:1、2、3、4、5、6、7、8、9、0

fontbold .t.

command11~command10 caption 依次改為:.、=、+、-、*、/

fontbold .t.

(3)編寫程式**。

①編寫commandgroup1的click事件**:

if thisform.tag=.t.

thisform.text1.value=allt(right(str(this.value),1))

thisform.tag=〃 〃

else

a=thisform.text1.value

thisform.text1.value=a+allt(right(str(this.value),1))

endif

②編寫“.”按鈕command11的click事件**:

a=thisform.text1.value

thisform.text1.value=a+〃.〃

③編寫“=”按鈕command12的click事件**:

a=thisform.text1.value

thisform.text1.value=allt(str(&a))

thisform.tag=.t.

④編寫“+”按鈕command13的click事件**:

a=thisform.text1.value

thisform.text1.value=a+〃+〃

thisform.tag=〃 〃

⑤編寫“-”按鈕command14的click事件**:

a=thisform.text1.value

thisform.text1.value=a+〃-〃

thisform.tag=〃 〃

⑥編寫“*”按鈕command15的click事件**:

a=thisform.text1.value

thisform.text1.value=a+〃*〃

thisform.tag=〃 〃

⑦編寫“/”按鈕command16的click事件**:

a=thisform.text1.value

thisform.text1.value=a+〃+〃

thisform.tag=〃 〃

vf編寫簡易計算器

3樓:

設計步驟如下(借鑑):

(1)建立應用程式使用者介面。

選擇“新建”表單,進入表單設計器,增加一個文字框控制元件textl、一個標籤控制元件label1和一個命令按鈕組commandgroup1,並將命令按鈕組的buttoncount屬性改為16。

(2)設定物件屬性如下表所示:

commandgroup1中各按鈕的屬性設定

物件 屬性 屬性值 說明

command1~command10 caption 依次改為:1、2、3、4、5、6、7、8、9、0

fontbold .t.

command11~command10 caption 依次改為:.、=、+、-、*、/

fontbold .t.

(3)編寫程式**。

①編寫commandgroup1的click事件**:

if thisform.tag=.t.

thisform.text1.value=allt(right(str(this.value),1))

thisform.tag=〃 〃

else

a=thisform.text1.value

thisform.text1.value=a+allt(right(str(this.value),1))

endif

②編寫“.”按鈕command11的click事件**:

a=thisform.text1.value

thisform.text1.value=a+〃.〃

③編寫“=”按鈕command12的click事件**:

a=thisform.text1.value

thisform.text1.value=allt(str(&a))

thisform.tag=.t.

④編寫“+”按鈕command13的click事件**:

a=thisform.text1.value

thisform.text1.value=a+〃+〃

thisform.tag=〃 〃

⑤編寫“-”按鈕command14的click事件**:

a=thisform.text1.value

thisform.text1.value=a+〃-〃

thisform.tag=〃 〃

⑥編寫“*”按鈕command15的click事件**:

a=thisform.text1.value

thisform.text1.value=a+〃*〃

thisform.tag=〃 〃

⑦編寫“/”按鈕command16的click事件**:

a=thisform.text1.value

thisform.text1.value=a+〃+〃

thisform.tag=〃 〃

4樓:咎蘿醜山彤

簡單的計算器吧

通過鍵盤輸入數

實現+-

*/功能

在表單裡建

六個命令按鈕+-

*/=c(清零)

一個文字框

寫**右鍵

**對form1初始化

過程為init

public

a,b,c,d

d=0文字框**

text1

過程lostfocus

c=thisform.text1.value命令按鈕+(command1)

過程click

a=cc='0'

thisform.text1.value=cb='+'

命令按鈕-(command2)

過程同上

a=cc='0'

thisform.text1.value=cb='-'

乘法的a=c

c='0'

thisform.text1.value=cb='*'

除法的a=c

c='0'

thisform.text1.value=cb='/'

等號的if

b='+'

d=val(a)+val(c)

c=str(d)

thisform.text1.value=dendif

ifb='-'

thisform.text1.value=val(a)-val(c)endif

ifb='*'

thisform.text1.value=val(a)*val(c)endif

ifb='/'

thisform.text1.value=val(a)/val(c)endif

清零的thisform.text1.value='

'完成了不知道好使不

如何利用巨集替換函式在vf裡製作簡易計算器

5樓:匿名使用者

1.建表單

2.建2個文

du本框 text1,text2

3.建1個命令按鈕

zhidao command1

4.在表單版 init 中寫入權:

thisform.text2.value = 05. 在命令按鈕 command1 的 click 中寫入:

local ccmd

ccmd = "thisform.text2.value = " + alltrim(thisform.text1.value)

&ccmd

6.執行表單

7.在 text1 中輸入 1+2*3/4+(5+6)+7^88.按 command1 按鈕

9.text2 中顯示結果 5764814.50

微控制器的簡易計算器,怎麼用51微控制器做簡易計算器? 10

基本功能介紹 簡單的加減乘除的運算。時間顯示功能,而且能實現計算器模組和時間模組之間的任意切換。按鍵音卻換功能。原理 多功能微控制器計算器是一個實現加減乘除的和時間功能的計算器,主要的硬體組成由,一個at89s52微控制器晶片,一個led液晶 1602液晶 一個4 4鍵盤,和4個特殊功能按鍵。一個時...

用vc60編簡易的計算器來個大神解決這個問題

我也是新手,不過我用的是vc6.0 我把你 複製進去,改了一下。可以了。你這 那個 for迴圈裡寫錯了,for迴圈 裡必須要有判斷條件,你沒寫。像for i 0 i 10 i 這樣才是正確寫法,裡面也不需加int的 而且我覺得這裡沒必要用for迴圈。就要加上getchar 這裡我用的是vc 6.0,...

怎麼用C語言程式設計簡單計算器,怎麼用C語言程式設計乙個簡單計算器?

include void main c語言是一門通用計算機程式語言,應用廣泛。c語言的設計目標是提供一種能以簡易的方式編譯 處理低階儲存器 產生少量的機器碼以及不需要任何執行環境支援便能執行的程式語言。儘管c語言提供了許多低階處理的功能,但仍然保持著良好跨平台的特性,以乙個標準規格寫出的c語言程式可...