报告老师,我低头不是因为我在装低调,是你问的问题,我真的不会答,,,
*---------------------- * 仿Get容器類 *---------------------- DEFINE CLASS MyGet AS Container BorderWidth = 0 BackStyle = 0 CanArrange = .T. PROCEDURE Arrange LOCAL lnIndex This.Height = 0 This.Width = 0 FOR lnIndex = 1 TO This.ControlCount WITH This.Controls(lnIndex) .Top = 0 IF .Height > This.Height This.Height = .Height ENDIF IF lnIndex > 1 .Left = This.Controls(lnIndex - 1).Left + This.Controls(lnIndex - 1).Width + 5 ELSE .Left = 0 ENDIF This.Width = .Left + .Width ENDWITH NEXT ENDPROC ENDDEFINE
*---------------------- * 自定義Grid容器類 *---------------------- DEFINE CLASS myGrid AS Grid Themes = .F. && 禁用XP主題 DeleteMark = .F. && 不顯示刪除標記欄 *--------------------------- * 設置列內容 * 參數:aColumns -- 列內容數組 * Column1 -- 欄標題 * Column2 -- 欄數據綁定源 * Column3 -- 欄寬度 * Column4 -- 顯示格式 * Column5 -- 輸入格式 *--------------------------- PROCEDURE Set_Columns(taColumns[], tcSource) LOCAL lnIndex WITH This .RecordSourceType = 1 .RecordSource = tcSource .ColumnCount = ALEN(taColumns, 1) FOR lnIndex = 1 TO .ColumnCount WITH .Columns(lnIndex) WITH .Header1 .Caption = taColumns[lnIndex,1] .FontBold = .T. .Alignment = 2 ENDWITH .ControlSource = taColumns[lnIndex,2] IF !EMPTY(taColumns[lnIndex,3]) .Width = taColumns[lnIndex,3] ENDIF IF !EMPTY(taColumns[lnIndex,4]) .Format = taColumns[lnIndex,4] ENDIF IF !EMPTY(taColumns[lnIndex,5]) .InputMask = taColumns[lnIndex,5] ENDIF ENDWITH NEXT ENDWITH ENDPROC ENDDEFINE
DEFINE CLASS MyForm AS Form *----------------------- * 控件佈局方法 * 用法:派生窗體的Arrange方法應先用DODEFAULT()調用父類方法 *----------------------- PROCEDURE Arrange FOR EACH obj IN This.Controls FOXOBJECT IF (VARTYPE(obj.CanArrange) == "L") .AND. obj.CanArrange obj.Arrange ENDIF NEXT ENDPROC PROCEDURE Activate This.Arrange ENDPROC PROCEDURE Resize This.Arrange ENDPROC PROCEDURE Destroy CLEAR EVENTS ENDPROC ENDDEFINE
*------------------------- * 排列控件 *------------------------- PROCEDURE Arrange DODEFAULT() && 先調用父類方法 WITH This.Label1 .Left = (This.Width - .Width) / 2 ENDWITH WITH This.Check1 .Top = This.Label1.Top + This.Label1.Height + 5 .Left = 20 ENDWITH WITH This.BillID .Top = This.Check1.Top .Left = This.Width - .Width - 20 gcBill_ID = "test" ENDWITH WITH This.Line1 .Top = This.BillID.Top + This.BillID.Height + 5 .Left = 10 .Width = This.Width - .Left - 10 ENDWITH WITH This.Provision .Top = This.Line1.Top + This.Line1.Height + 5 .Left = 20 ENDWITH WITH This.ProcessDate .Top = This.Provision.Top .Left = This.Width - .Width - 20 ENDWITH WITH This.Line2 .Top = This.Provision.Top + This.Provision.Height + 5 .Left = 10 .Width = This.Width - .Left - 10 ENDWITH WITH Top = This.Height - .Height - 5 .Left = This.Width - .Width - 20 ENDWITH WITH This.Grid1 .Top = This.Line2.Top + This.Line2.Height + 5 .Left = 20 .Height = Top - .Top - 5 .Width = This.Width - .Left - 20 ENDWITH ENDPROC
[此贴子已经被作者于2016-1-3 22:44编辑过]