CXGRID控件使用說明_第1頁
CXGRID控件使用說明_第2頁
CXGRID控件使用說明_第3頁
CXGRID控件使用說明_第4頁
CXGRID控件使用說明_第5頁
已閱讀5頁,還剩15頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡介

1、TCXGRID 控件:屬性:ActiveLevel: 當(dāng)前層BorderStyle: 窗口風(fēng)格Color: 顏色FocusedView: 當(dāng)前View;Font: 字體LevelTabs: 類似PageControls 頭設(shè)置CaptionAlgnment:標(biāo)題對(duì)齊方式Images:圖標(biāo)Style:風(fēng)格Levels:RootLevelOptions:層選項(xiàng)DetailTabsPosition: 類似PageControls 頭顯示位置;TabsForEmptyDetails: 如果數(shù)據(jù)為空是否顯示TabsT cxGridLevel 組件:屬性:Active: 讀寫激活該層;Controls:

2、讀寫指向TCXGrid;CanBeVisible: 讀取是否能設(shè)置可見;Count: 讀取子層個(gè)數(shù);Displaycaption: 讀取層標(biāo)題;IsMaster: 讀取是否cxgrid 的最上層;Items: 讀取層組,例: Items0訪問第一個(gè)層;Level: 讀取層級(jí)數(shù);VisibleCount: 讀取可見層個(gè)數(shù)VisibleIndex: 讀取可見索引個(gè)數(shù)VisibleItems: 讀取可見層組,例:VisibleItems0訪問第一個(gè)可見層 Caption: 讀寫層標(biāo)題;GridView: 指定或讀取該層的Grid 顯示;ImageIndex: 讀寫圖標(biāo)索引Options: TcxGr

3、idLevelOptions選項(xiàng)DetailFrameColor: 讀或?qū)懨骷?xì)表格顏色DetailFramWidth: 讀或?qū)懨骷?xì)表格DetailTabsPosition: 讀或?qū)慣ab 位置, 類似PageControlsTabs Styles: 樣式Tab: 讀或設(shè)置tab 樣式tabsBackground: 讀或設(shè)置tab 背景樣式Visible: 讀或設(shè)置是否可見方法:Add: 增加一個(gè)Level;Levelsi.Add:增加一個(gè)子Level;T cxGridDBBandedT ableView 組件:屬性:BackGroundBitmaps:背景圖片選項(xiàng)Background:背景圖B

4、andbackground:帶背景圖Bankheader:帶頭背景Content:細(xì)節(jié)區(qū)背景filterBox:過濾區(qū)背景footer:注腳背景group: 組背景header:列頭背景preview:預(yù)覽區(qū)背景Bands:帶列表DataController: 數(shù)據(jù)控制DataSource:數(shù)據(jù)源DetailKeyFieldNames:主從表時(shí)設(shè)置細(xì)表鍵字段名KeyFieldNames: 主從表時(shí)設(shè)置關(guān)鍵字段名MasterKeyFieldNames:主從表時(shí)設(shè)置主表鍵字段名Summary:合計(jì)組FooterSummaryItems:注腳定義FooterSummaryItems:組腳定義Filt

5、erBox:過濾框CustomizeDialog:是否自定義過濾條件Position:過濾框顯示位置Visible:顯示過濾框NavigatorButtons:導(dǎo)航條設(shè)置Append:增加按鈕設(shè)置Enabled:是否禁用該按鈕Visible:是否顯示該按鈕ImageIndex:圖標(biāo)IDCancel:取消按鈕設(shè)置, 具體設(shè)置同Append;ConfirmDelete:刪除時(shí)是否確認(rèn)提示Delete: 具體設(shè)置同Append;Edit: 具體設(shè)置同Append;First: 具體設(shè)置同Append;Insert: 具體設(shè)置同Append;Last: 具體設(shè)置同Append;Next: 具體設(shè)置同A

6、ppend;Filter: 具體設(shè)置同Append;GotoBookmark: 具體設(shè)置同Append;NextPage: 具體設(shè)置同Append;Post: 具體設(shè)置同Append;Prior: 具體設(shè)置同Append;PriorPage: 具體設(shè)置同Append;Refresh: 具體設(shè)置同Append;SaveBookmark: 具體設(shè)置同Append;OptionsBehavior:行為選項(xiàng)AlwaysShowEditor:是否總是顯示編輯條BandHeaderHints:帶頭是否顯示提示CellHints:單元格是否顯示提示ColumnHeaderHints:列頭是否顯示提示Copy

7、CaptionsToClipboard:是否允許復(fù)制標(biāo)題到剪貼板CopyPreviewToClipboard:是否允許復(fù)制預(yù)覽內(nèi)容到剪貼板 ExpandMasterRowOnDblClik:是否允許雙擊行顯示明細(xì)FocusFirstCellOnNewRecord:新增記錄時(shí)是否焦點(diǎn)指向第一列單元格 GoToNextCellOnEnter:按回車是否自動(dòng)跳到下一單元格NavigatorHints:是否顯示導(dǎo)航條提示OptionsCustomize:自定義選項(xiàng)BandHiding:是否顯示帶BandMoving:是否允許拖動(dòng)帶ColumnFiltering:是否允許列過濾ColumnGroupin

8、g:是否允許列分組ColumnHiding:列頭是否隱藏ColumnHorzSizing:是否允許調(diào)整列寬度ColumnMoving:是否允許列拖動(dòng)ColumnSorting:是否允許列排序ColumnVertSizing:是否允許調(diào)整列高度DataRowSizing:是否允許調(diào)整數(shù)據(jù)行高度GroupBySorting:是否允許組排序GroupRowSizing:是否允許調(diào)整組行高度OptionData: 允許數(shù)據(jù)操作Appending: 是否允許增加CancelOnExit: 退出時(shí)是否自動(dòng)取消修改Deleting: 是否允許刪除DeletingConfirmation: 刪除是否提示Edi

9、ting :是否允許編輯Inserting: 是否允許插入OptionsSelection: 單元格操作CellMultiSelect:是否允許選擇多單元格CellSelect: 進(jìn)入單元格是否選擇InvertSelect: 是否允許轉(zhuǎn)換選擇MultiSelect: 是否允許多行選擇HideFocusRectOnExit: 移開是否隱藏焦點(diǎn)UnselectFocusedRecordOnExit:移開是否允許取消焦點(diǎn)OptionsView:表格選項(xiàng)BandCaptionsInColumnAlternateCaption:是否允許在列里修改帶標(biāo)題 BandHeaderHeight: 帶頭高度Ban

10、dHeaderLineCount: 帶頭顯示行數(shù)BandHeaders: 是否顯示帶頭CellAutoHeight:單元格是否自動(dòng)高度CellTextMaxLineCount: 單元格文本最大行數(shù)ColumnAutoWidth: 列是否自動(dòng)寬度DataRowHeight: 數(shù)據(jù)行高度Footer:是否允許顯示注腳FooterAutoHeight: 注腳是否自動(dòng)適應(yīng)高度FooterMultiSummaries:是否允許多注腳GridLineColor:表格行線顏色GridLines:顯示表格行線類型GroupByBox:是否允許拖動(dòng)列到分組區(qū)進(jìn)行分組GroupFooters:顯示組腳類型Head

11、er:是否顯示列頭HeaderAutoHeight:列頭是否自動(dòng)適應(yīng)高度HeaderHeight: 列頭高度IndicatorWidth:是否顯示左邊指示條IndicatorWidth: 指示條寬度Navigator: 是否顯示導(dǎo)航條NavigatorOffSet: 導(dǎo)航條偏移位置ShowColumnFilterButtons: 是否顯示列過濾按鈕ShowEditButtons: 是否顯示編輯按鈕Preview:預(yù)覽選項(xiàng)AutoHeight:是否自動(dòng)適應(yīng)高度Column:要預(yù)覽的列,只能選一列LeftIndent: 左縮進(jìn)點(diǎn)數(shù)MaxLineCount:最大顯示行數(shù)RightIndent:右縮進(jìn)

12、點(diǎn)數(shù)Visible: 預(yù)覽是否可見PopupMenu:彈出菜單Styles:樣式或風(fēng)格組BackGround:背景風(fēng)格Content:明細(xì)風(fēng)格Footer:注腳風(fēng)格Group:組風(fēng)格GroupSummary:組合計(jì)區(qū)風(fēng)格Header:頭風(fēng)格Indicator:指示區(qū)風(fēng)格Preview:預(yù)覽區(qū)風(fēng)格Selection:選擇區(qū)風(fēng)格StyleSheet:風(fēng)格組,選中后自動(dòng)設(shè)置各區(qū)風(fēng)格 方法或函數(shù):CreateColumn:參數(shù):無;功能:新建一列;返回:返回列類型結(jié)果;GetColumnByFieldName :參數(shù):字段名串;功能:取得指定字段列;返回:返回列類型結(jié)果;例:MyTV .GetColu

13、mnByFieldName('First' .Visible := False;CleaarItems:參數(shù):無;功能:清除全部顯示列;返回:無CreateItem:參數(shù):無;功能:建一顯示列;返回:列類型值StoreToIniFile:導(dǎo)出布局到Ini 文件StoreToRegistry:導(dǎo)出布局到注冊(cè)表StoreToStream:導(dǎo)出布局到流體RestoreFromIniFile: 從Ini 文件恢復(fù)布局RestoreFromRegistry:從注冊(cè)表恢復(fù)布局RestoreFromStream:從流體恢復(fù)布局FindItemByID:根據(jù)ID 號(hào)查找列FindItemByN

14、ame:根據(jù)列名查找列FindItemByTag:根據(jù)Tag 查找列IndexofItem:返回列的序號(hào)CreateViewInfo:建表格TCXGRID 用法指南假設(shè)已設(shè)定以下變量MycxGrid: TcxGrid;MycxGridLevel: TcxGridLevel;MyTV : TcxGridDBTableView;MyDataSource: TDataSource;方法:一、 建層和層視圖MycxGrid := TcxGrid.Create(self;MycxGridLevel := MycxGrid.Levels.Add; /建層MyTV:= TcxGridDBTableView(

15、MycxGrid.createview(TcxGridDBTableView;/建視圖 MycxGridLevel.Control := MycxGrid;/指定關(guān)系MycxGridLevel.GridView := MyTV;/指定視圖TcxGridDataController(GetDetailDataController(FocusedRecordIndex, 0.GridView;/得到下層視圖二、設(shè)定表格位置和大小MycxGrid.ParentWindow := self.Handle;MycxGrid.Top := 0;MycxGrid.Height := 200;MycxGrid

16、.Width := 400;MyTV .Preview.visible := true;三、 設(shè)定數(shù)據(jù)源及分配全部字段MyTV .DataController.DataSource := MyDataSource;MyTV .DataController.DeleteAllItems; /清除全部字段MyTV .DataController.CreateAllItems; /建全部顯示字段四、 動(dòng)態(tài)增加顯示列及列訪問variIndex: integer;vCol: TcxGridDBColumn;vImgCom: TcxImageComboBoxItem;i,j: integer;for i:

17、= 0 to Mydatasource.dataset.FieldCount -1 dobeginvCol := MyTV.CreateColumn;vCol.DataBinding.FieldName:=Mydatasource.dataset.Fieldsi.FieldName;if (i = 1 thenbeginvCol.PropertiesClassName := 'TcxImageComboBoxProperties' /分區(qū)分大小寫 vCol.DataBinding.V alueType := 'String'for j := 0 to 5 dob

18、eginvImgCom:=TcxImageComboBoxProperties(vCol.Properties.Items.Add;vImgCom.Description := IntToStr(j;vImgCom.V alue := IntToStr(j;end;end;end;showmessage(MyTV.Columns0.Caption;/列標(biāo)題訪問showmessage(MyTV.Columns0.DataBinding.FieldName;/列字段名訪問MyTV .Columns0.SortIndex := 0;MyTV .Columns0.SortOrder := soAsce

19、nding; /列升序排序MyTV .Columns0.SortIndex := -1;MyTV .Columns0.SortOrder := soNone; /取消列排序MyTV .DataController.Search.Locate(MyTV.GetColumnByFieldName(FieldName.Index, 查找值;/ 列值搜索MyTV .DataController.FocusedRowIndex := MyTV.DataController.FocusedRowIndex - 1;/記錄回翻, 即Prior;DBView.DataController.FocusedRow

20、Index := DBView.DataController.FocusedRowIndex + 1; /記錄后翻, 即Next;Aa:=MyTV.datacontroller.values1,1 ;/ 訪問第二行第二列的值MyTV .Columns0.DataBinding.ValueTypeClass := TcxStringValueType;/設(shè)置列字段類型, 其他如整型TcxIntegerValueType,浮點(diǎn)型TcxFloatValueType;/設(shè)置列風(fēng)格:MyFirstColumnStyle := TcxStyle.Create(Self;MyFirstColumnStyle

21、.Color := clAqua;MyFirstColumnStyle.TextColor := clBlue;MyTV .Columns1.Styles.Content := MyFirstColumnStyle;/設(shè)置列下拉框選擇列表及類型varA:TDataSource:B:TcxlookupcomboboxProperties;beginA:=TDataSource.create(self;B:=tcxlookupcomboboxproperties.create(self;A.Dataset:=Dic_ry_xb;/此處指定數(shù)據(jù)源。B.listdource:=A;/此處指明字段的li

22、stsource 屬性。B.keyfieldnames:='a' /此處指明字段的關(guān)鍵字段B.listfieldnames:='b' /此處指明字段的返回值。B.listcolumns.items0.caption:='x; /此處默認(rèn)是會(huì)建立一個(gè)字段,但是顯示的表頭是name ,所以此處讓它顯示為自己想要的中午顯示。MYTVc1_sex_code.Properties:=B; /此處指明是那個(gè)字段。end;五、 設(shè)置列外觀MyTV .OptionsView.ColumnAutoWidth := true /列自動(dòng)寬度MyTV .OptionsView.

23、CellAutoHeight := true /單元自動(dòng)高度MyTV .OptionsView.Footer := true /表格合計(jì)行顯示MyTV .OptionsView.Header := true / 表格頭顯示MyTV .OptionsView.Indicator := true /顯示指示條MyTV .OptionsView.GroupByBox:=true /顯示分組框MyTV .Preview := True /顯示預(yù)覽區(qū)六、 設(shè)置表格樣式var MyStyleSheet:TcxGridTableViewStyleSheet;MyStyle :TcxStyle;beginMy

24、StyleSheet := TcxGridTableViewStyleSheet.Create(;MyStyle := TcxStyle.Create(self;MyStyle.Color := clBlack;MyStyle.TextColor := clWrite;MyTV .Styles.Background := MyStyle; /設(shè)置背景樣式MyStyleSheet.AddStyles(MyStyle;/分配樣式cxStyleRepository.CreateStyleSheet(MyStyleSheet;MyTV .Styles.StyleSheet := cxStyleRepo

25、sitory; /分配樣式End;七、 設(shè)置Preview 列前提條件是設(shè)置footer=true;MyTV .Preview.column := MyTVField1;/設(shè)置預(yù)覽列MyTV . Preview.MaxLineCount := 4;/設(shè)置預(yù)覽列最大顯示行數(shù)MyTV.Preview.LeftIndent :=150; /顯示左縮進(jìn)MyTV.Preview.RightIndent :=150;/顯示右縮進(jìn)八、 Footer 設(shè)置V ar ASummary: TcxDataSummary;MyFooterItems :TcxDataFooterSummaryItems;Acolumn

26、 :TcxGridDBColumn;ASummary := MyTV.DataController.Summary; /提取Footer;MyFooterItems := ASummary.FooterSummaryItems; /提取FooterItems;/增加FooterItemsWith TcxGridDBTaleSummaryItem(MyFooterItems.add doBegintryTryBeginupdate;Column := TcxGridDBColumn(MyTV.VisibleColumns0; /Footer顯示列位置AColumn := TcxGridDBCol

27、umn(MyTV.VisibleColumns0;If assigned(AColumn thenFieldName := AColumn.dataBinding.FieldName; /Footer計(jì)算字段Kind := TcxSummaryKind(skSum;/skNone=無.skSum=合計(jì);skMax=取最大值,/skCount=/記錄數(shù),skAverage=平均數(shù)FinallyEndupdate;End;ExceptShowmessage(error ;MyFooterItems.ItemsMyFooterItems.Count-1.Free;/報(bào)錯(cuò)釋放剛加入的End;End;/

28、刪除FooterItemsMyFooterItems := TcxGridDBTableSummaryItem(MyFooterItems0;If MyFooterItems.FieldByName<> thenFor i:= 0 to MyTV.VisibleColumnCount -1 doBeginAColumn := TcxGridDBColumn(MyTV.VisibleColumnsi;If AColumn.DataBinding.FieldName = MyFooterItems.FieldName thenBreak;End;If Assigned(MyFooterItems.Column thenMyFooterItems.Items0.Free;九、 建BandV

溫馨提示

  • 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)論