回复 10楼 muyubo
把你的QQ留下,我给你发截图,说的自习些!我的QQ 835860898
程序代码:
CLEAR ALL
CLOSE DATABASES ALL
SET EXCLUSIVE ON
Main()
RETURN
PROCEDURE Main()
LOCAL frm_Main AS Form
frm_Main = CREATEOBJECT("_Main")
frm_Main.Show
READ EVENTS
ENDPROC
DEFINE CLASS _Main AS Form
Caption = "論壇作業"
Width = 600
Height = 400
AutoCenter = .T.
ShowTips = .T.
ADD OBJECT grd_Data AS Grid
ADD OBJECT cmd_Adjust AS CommandButton WITH Caption = "調整價格", Height = 25, Width = 80, ToolTipText = "等級1調升10.0" + CHR(13)+CHR(10) + "等級2調升5.0"
PROCEDURE Load
USE cpjg IN 0
ENDPROC
PROCEDURE Unload
USE IN cpjg
ENDPROC
PROCEDURE Destroy
CLEAR EVENTS
ENDPROC
PROCEDURE Activate
ThisForm.Arrange
ENDPROC
PROCEDURE Resize
ThisForm.Arrange
ENDPROC
PROCEDURE Arrange
WITH ThisForm.cmd_Adjust
.Top = ThisForm.Height - .Height - 5
.Left = 20
ENDWITH
WITH ThisForm.grd_Data
.Top = 0
.Left = 5
.Height = ThisForm.cmd_Adjust.Top - .Top - 5
.Width = ThisForm.Width - .Left - 5
ENDWITH
ENDPROC
PROCEDURE grd_Data.Init
LOCAL aList[FCOUNT("cpjg")]
LOCAL nIndex AS Integer
aList[1] = "代碼"
aList[2] = "品名"
aList[3] = "等級"
aList[4] = "價格"
WITH ThisForm.grd_Data
.DeleteMark = .F.
.RecordMark = .F.
.HighlightStyle = 2
.RecordSourceType = 1
.RecordSource = "cpjg"
.ReadOnly = .T.
.ColumnCount = FCOUNT("cpjg")
FOR nIndex = 1 TO .ColumnCount
.Columns(nIndex).ControlSource = "cpjg." + FIELD(nIndex, "cpjg")
WITH .Columns(nIndex).Header1
.Caption = aList[nIndex]
.Alignment = 2
.FontBold = .T.
ENDWITH
NEXT
.Columns(3).InputMask = "999.99"
.Columns(4).InputMask = "999.99"
ENDWITH
ENDPROC
PROCEDURE cmd_Adjust.Click
LOCAL nCurrentRecord AS Integer, nValue AS Currency
SELECT cpjg
nCurrentRecord = RECNO("cpjg")
SCAN ALL
DO CASE
CASE cpjg.c03 == 1
nValue = 10.0
CASE cpjg.c03 == 2
nValue = 5.0
ENDCASE
REPLACE cpjg.c04 WITH cpjg.c04 + nValue
ENDSCAN
GOTO nCurrentRecord IN cpjg
ThisForm.grd_Data.Refresh
ENDPROC
ENDDEFINE
[ 本帖最后由 TonyDeng 于 2011-6-28 08:11 编辑 ]








