《VFP程序設(shè)計(jì)》練習(xí)表單題_第1頁
《VFP程序設(shè)計(jì)》練習(xí)表單題_第2頁
《VFP程序設(shè)計(jì)》練習(xí)表單題_第3頁
已閱讀5頁,還剩12頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、20XX 級(jí) VFP 程序設(shè)計(jì)練習(xí)(表單題部分 )表單題 (參考答案 )20XX 級(jí) VFP 程序設(shè)計(jì)練習(xí)(表單題部分)一、表單設(shè)計(jì)230100、LOGIN.scx#formForm1AutoCenter = .T.Caption = " 登錄 "#labelLabel1AutoSize = .T.Caption = " 密碼 "#labelLabel2AutoSize = .T.Caption = " 登錄日期 "#textboxText1InputMask = "999999"PasswordChar = &q

2、uot;*"#textboxText2BorderStyle = 0Value = (DATE( )ReadOnly = .T.BackColor = 192,192,192#commandbuttonCommand1 Caption = "確定 "#commandbuttonCommand2 Caption = "取消 "#230101、shape.scx#formForm1Caption = "畫圖 "#shapeShape1Height = 100Width = 70Top = 20Left = 30BorderCol

3、or = 255,0,0#commandCommand1Caption = " 畫圖 "#commandCommand2Caption = " 退出 "#230102、line.scx#formForm1Caption = " 圖形 " #shapeShape1 Height = 100Width = 100BorderWidth = 6 Curvature = 99BackColor = 255,0,255 BorderColor = 255,255,0 #lineLine1BorderWidth = 20BorderColor =

4、 0,0,255 #230103、 imsh2.scx#formForm1BackColor = 200,255,255 #labelLabel1FontName = " 隸書 "FontSize = 18BackStyle = 0Caption = " 日落 "ForeColor = 0,0,255#imageImage1Picture = .fjexam95sunset.jpg Stretch = 1#230104、 sjrq2.scx#formForm1Caption = " 顯示時(shí)間與日期" #pageframePagefra

5、me1 PageCount = 2Page1.Caption = " 時(shí)間 " Page2.Caption = " 日期 " #labellabel1FontSize = 14Caption = (time()#labellabel2FontBold = .T.Caption = (dtoc(date() #230105、 shpr.scx#formForm1Caption = " 形狀變化 " #labelLabel1FontSize = 12Caption = " 圓角曲率 " #spinnerSpinner1

6、KeyboardHighValue = 99 KeyboardLowValue = 0SpinnerHighValue =99.00 SpinnerLowValue =0.00 #shapeShape1BackColor = 255,0,0 #230106、 horse.scx#labelLabel1Caption = " 哈哈鏡 "AutoSize = .T.FontSize = 20#imageImage1Picture = .fjexam95zebra.bmp Stretch = 2Height = 120Width = 80#230107、 Selball2.scx

7、#formForm1AutoCenter = .T.Caption = " 選擇 "#optiongroupOptiongroup1 ButtonCount = 3Option1.Caption = " 選 1 號(hào) " Option2.Caption = "選 2 號(hào) " Option3.Caption= " 選 3 號(hào)" Option1.Top = 5Option2.Top = 5Option3.Top = 5#commandgroupCommandgroup1 ButtonCount = 2Command1.C

8、aption="確 定 "Command2.Caption="取 消 "Command1.Top = 5Command2.Top = 5#230108、 dxxz2.scx#formForm1Caption = "多項(xiàng)選擇"#checkCheck1Caption = "選擇1"AutoSize = .T.#checkCheck2Caption = " 選擇 2"AutoSize = .T.#commandgroup Commandgroup1 Command1.Caption = "

9、確 定 " Command2.Caption = " 取消 " #230109、 combo.scx#formForm1Caption = " 選擇 "#labelLabel1Caption = " 請(qǐng)選擇 "#comboboxCombo1RowSourceType = 1RowSource = "VB,VFP,C語言 " #checkboxCheck1Caption = " 總成績 "#checkboxCheck2Caption = " 平均成績 " #23011

10、0、 edit.scx#formForm1Caption = " 顯示 "#editboxEdit1FontName = " 楷體 _GB2312" Alignment = 2Value = 居中顯示#textboxText1Value = (date()FontBold = .T.ForeColor = 100,0,100 BackColor = 200,200,255 #二、表單編程230200、 lbtjsc.scx參考解答:對(duì)象 command1(添加按鈕)的click 事件a=thisform.text1.valuethisform.list1

11、.additem(a)對(duì)象 command2(刪除按鈕)的click 事件for i=thisform.list1.listcount to 1 step -1if thisform.list1.selected(i)thisform.list1.removeitem(i)endifendfor230201、 ddcx.scx參考解答:設(shè)置對(duì)象text1 的 value 屬性為 “=date() ”對(duì)象 command1(查詢按鈕)的click 事件rq=thisform.text1.valuethisform.grid1.recordsource="sele訂單號(hào) ,簽訂日期 ,金

12、額from orders ;where 簽訂日期 <=rq into cursor ls"thisform.refresh230202、 xscx.scx參考解答:對(duì)象 command1(查詢按鈕)的click 事件a=alltrim(bo1.value)b=alltrim(bo2.value)thisform.grid1.recordsource="selectxsb.商品號(hào) ,商品名 ,上半年利潤,下半年利潤,上半年利潤 +下半年利潤from xsb,spdmb ;where xsb.商品號(hào) =spdmb.商品號(hào)and 部門號(hào) =a and 年度 =b into

13、cursor lsb"thisform.refresh230203、login2.scx參考解答:對(duì)象 command1(確定按鈕)的click 事件xh=alltrim(bo1.value)mm=alltrim(thisform.text1.value)select 姓名fromstulog where alltrim( 學(xué)號(hào) )=xhand alltrim( 密碼 )=mmintocursor lsbthisform.label3.visible=.t.sele lsbif reccount()=0thisform.label3.caption="密碼錯(cuò)誤 "

14、elsego topthisform.label3.caption="歡迎 "+alltrim( 姓名 )+" 同學(xué) "endifthisform.refresh230204、adds.scx參考解答:對(duì)象 command1(統(tǒng)計(jì)按鈕)的click 事件repl all金額with單價(jià) *數(shù)量thisform.refresh對(duì)象 check1(復(fù)選框)的click 事件if this.value=1mand1.enabled=.t.elsemand1.enabled=.f.endif230205、gspf.scx參考解答:對(duì)象 combo1(選擇歌手姓名

15、組合框)的interactivechange 事件a=alltrim(this.value)thisform.grid1.recordsource="select評(píng)委編號(hào) ,分?jǐn)?shù)from gsb,pfb ;where gsb.歌手編號(hào) =pfb. 歌手編號(hào) and alltrim( 歌手姓名 )=a into cursor lsb" select avg( 分?jǐn)?shù)) from lsb into array abcthisform.text1.value=abc(1,1)thisform.refresh230206、tsxz.scx參考解答:對(duì)象optiongroup1的 cl

16、ick 事件sele avg( 單價(jià) ),sum( 數(shù)量 ) frombook1 where 種類=bo1.valueintoarray sz ifthis.value=1thisform.text1.value=sz(1,1)elsethisform.text1.value=sz(1,2)endifthisform.refresh230207、ddpx.scx參考解答:對(duì)象 command1(生成表按鈕)的click事件if thisform.optiongroup1.value=1sele 職員號(hào) ,avg(金額 ) as 平均金額from orders group byorder by平

17、均金額into table px_aelsesele 職員號(hào) ,avg(金額 ) as 平均金額from orders group by職員號(hào)職員號(hào);order by平均金額desc into table px_bendif230208、 ddtj.scx參考解答:對(duì)象 command1(統(tǒng)計(jì)按鈕 )的 click 事件if thisform.optiongroup1.value=1thisform.grid1.recordsource="select客 戶 號(hào) ,count( 訂 單 號(hào) ),sum( 金 額 ) ;fromordersgroup by 客戶號(hào)into cursor

18、 ls"endifif thisform.optiongroup1.value=2thisform.grid1.recordsource="select職 員 號(hào) ,count( 訂 單 號(hào) ),sum( 金 額 ) ;fromordersgroup by 職員號(hào)into cursor ls"endifthisform.refresh230209、 rccx.scx參考解答:對(duì)象 command1(顯示按鈕 )的 click 事件bh=bo1.valuethisform.list1.rowsource="sele姓名 ,成果名稱 ,成果類別from rc

19、da,cjda;wherercda. 人 才 編 號(hào) =cjda. 人 才 編 號(hào)andrcda. 人 才 編 號(hào) =bhintocursorls"thisform.refresh230210、teach1.scx參考解答:對(duì)象 combo1 的 init 事件this.listindex=1對(duì)象 combo1 的 click 事件sele avg(基本工資 ) from ddm1,teach1 where ddm1.系號(hào) =teach1.系號(hào);and 系名 =this.valueinto array aif thisform.check1.value=0thisform.text1

20、.value=""elsethisform.text1.value=a(1,1)endifthisform.refresh230300、calchar.scx參考解答:對(duì)象 command1(統(tǒng)計(jì)按鈕)的click 事件t=0a=thisform.text1.valuefor i=1 to len(a)x=substr(a,i,1)if x!=space(1)t=t+1endifendforthisform.text2.value=t230301、 chadate.scx參考解答:對(duì)象 text1 的 value 值改為對(duì)象 spinner1 的 upclick 事件thi

21、sform.text1.value=thisform.text1.value-1 thisform.refresh對(duì)象 spinner1 的 downclick 事件thisform.text1.value=thisform.text1.value+1 thisform.refresh230302、js2.scx參考解答:對(duì)象 command1(計(jì)算按鈕)的 click 事件 a=thisform.text1.value b=thisform.text2.valueif bo1.value="+"c=a+bendifif bo1.value="-"c=a

22、-bendifif bo1.value="*"c=a*bendifif bo1.value="/"if b<>0c=a/belsec=" 除數(shù)不能為0"endifendifthisform.text3.value=c230303、calc.scx參考解答:對(duì)象 command1(計(jì)算按鈕)的click 事件x=thisform.text1.valuedo casecase x<=-10y=2*(sin(x)+1)case x<=10y=(abs(x)-5)/3otherwisey=x/7-8endcasethi

23、sform.text2.value=y230304、xsys.scx參考解答:對(duì)象 command1(更新按鈕)的click 事件r=thisform.spinner1.valueg=thisform.spinner2.valueb=thisform.spinner3.valuethisform.shape1.backcolor=rgb(r,g,b)if r=255 and g=0 and b=0thisform.shape1.curvature=0elseif r=0 and g=255 and b=0thisform.shape1.curvature=50elseif r=0 and g=

24、0 and b=255thisform.shape1.curvature=99elsethisform.shape1.curvature=1endifendifendifthisform.refresh230305、stfn.scx參考解答:對(duì)象 command1(偶數(shù)字符串按鈕) 的 click 事件s=alltrim(thisform.text1.value)n=len(s)js= ”for i=1 to nc=substr(s,i,1)if c>="0" and c<="9"d=val(c)if d%2=0js=js+cendifendifendforthisform.text2.value=jsthisform.refresh230306、 addcal.scx參考解答:對(duì)象 command1(添加按鈕 )的 click 事件s=thisform.text1.valuen=str(len(s)a=s+space(1)+alltrim(n)thisform.list1.additem(a)thisform.text1.setfocu

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論