已阅读5页,还剩2页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
UltraWinGrid使用心得(C#)2008年10月23日10:49UltraWinGrid行号从0开始CellMultiLineCell多行显示当设定一个Column的CellMultiLine为True时,如果想要格子自动增长(变大),必须设定RowSizing的属性为AutoFree或FreeultraGridColumn31.CellMultiLine = Infragistics.Win.DefaultableBoolean.True;ultraGridBand1.Override.RowSizing = Infragistics.Win.UltraWinGrid.RowSizing.AutoFree;Rowsizing行变化ColumnSizing列变化MultiCellSelectionMode多个Cell的选择SummaryFooterCaption汇总标题汇总的标题,默认为Grand Summaries,可以运行中根据汇总的字段进行更改MergedCell合并相似CellultraGridColumn8.MergedCellEvaluationType = Infragistics.Win.UltraWinGrid.MergedCellEvaluationType.MergeSameText;ultraGridColumn8.MergedCellStyle = Infragistics.Win.UltraWinGrid.MergedCellStyle.Always;SummaryDisplayAreas汇总显示区域显示汇总信息的位置,默认显示在Group项的标题行ugSchedule.DisplayLayout.Override.SummaryDisplayArea = SummaryDisplayAreas.Bottom;HeaderVisibleBand项的Header ugSchedule.DisplayLayout.Bands1.HeaderVisible = true;ugSchedule.DisplayLayout.Bands1.Header.Caption = asfafa;/ugSchedule.DisplayLayout.Override.SummaryDisplayArea = SummaryDisplayAreas.Bottom;/ugSchedule.DisplayLayout.Bands1.Header.Appearance.BackColor = Color.LightBlue;/ugSchedule.DisplayLayout.Bands1.Header.Appearance.BackColor2 = Color.LightBlue;ColHeaderVisible不显示Bands的表头ugSchedule.DisplayLayout.Bands1.ColHeadersVisible = false;Columns标题颜色ugSchedule.DisplayLayout.Bands1.Columns0.Header.Appearance.BackColor = Color.LightCoral;ColumnStyleColumn样式(下拉框)UltraDropDown KindList = new UltraDropDown();/建立一个下拉对象KindList.DataSource = cboLine.DataSource;/绑定数据源e.Layout.BandsOrderHeader.ColumnsKind.ValueList = KindList;/绑定到ColumnActiveRow当前行和选中内容ugSchedule.Selected.Rows0.Cells0.Value.ToString()ugSchedule.RowsugSchedule.ActiveRow.Index.Cells0.Value.ToString ()ugSchedule.RowsSignRow.Activate();Band.Index判断当前行是子行还是父行MessageBox.Show(ugSchedule.ActiveRow.Band.Index.ToString(); Expand展开或关闭关联In C#:/ Expands the current row and its children as wellthis.UltraWebGrid1.Rows0.Expand(true); /展开单个行this.UltraWebGrid1.ExpandAll(true);ugOrder.ActiveRow.Expanded = true;UltraGridBand定义绑定,实现遍历子行int BandRow = 0; UltraGridBand band =ugSchedule.DisplayLayout.BandsSchedule; foreach (UltraGridRow row in band.GetRowEnumerator(GridRowType.DataRow)BandRow+;MessageBox.Show(row.Cells2.Value.ToString (); MessageBox.Show (BandRow.ToString(); /ugSchedule.DisplayLayout.Bands1.AddNew(); int BandRow = 0; UltraGridBand band = ugSchedule.DisplayLayout.BandsSign; foreach (UltraGridRow row in band.GetRowEnumerator(GridRowType.DataRow) BandRow+; row.CellsSignMemo.Activate(); row.CellsSignMemo.Value = row.Index.ToString(); MessageBox.Show(BandRow.ToString();AllowMultiCellOperations回复操作*/ Turn on all of the Cut, Copy, and Paste functionality.e.Layout.Override.AllowMultiCellOperations = AllowMultiCellOperation.All;MemberDescriptionDefaultDefault is resolved to None. NoneNo multi cell operations are allowed. CopyAllows copying of multiple cells to the clipboard. CopyWithHeadersSame as Copy except that an extra row of column headers will be copied as well. CutAllows cutting of multiple cells to the clipboard. Cutting involves first copying of the cell values to the clipboard and then clearing the contents of the copied cells. DeleteAllows clearing contents of multiple cells. Cell contents are set to associated columns UltraGridColumn.DefaultCellValue property settings, which by default is DBNull. PasteAllows pasting of multiple cells from the clipboard. UndoAllows Undo operation. Last multi cell operation will be undone. RedoAllows Redo operation. ReservedReserved. For internal use only. AllAllows all of operations listed in this enum. CellClickActionCELL单击的时候产生的效果MemberDescriptionDefaultUse Default. The setting of the objects parent will be used (Edit if parent has no default.) EditEdit. Selects and highlights the cell that was clicked and puts it in edit mode. RowSelectRow Select. Selects and highlights the entire row of the cell that was clicked. Note that if a cell is displaying a drop down button the clicking onto it will cause the cell to go into edit mode. To prevent the cell from going into edit mode see UltraGridColumn.CellActivation. To prevent the drop down buttons from showing, set the UltraGridColumn.ButtonDisplayStyle property. CellSelectCell Select. Selects and highlights the cell that was clicked. Note that if a cell is displaying a drop down button the clicking onto it will cause the cell to go into edit mode. To prevent the cell from going into edit mode see UltraGridColumn.CellActivation. To prevent the drop down buttons from showing, set the UltraGridColumn.ButtonDisplayStyle property. EditAndSelectTextEdit and Select Text. Puts the cell into edit mode and selects its text, if any. 标题换行标题手动换行ugSchedule.DisplayLayout.Bands0.Columns0.Header.Caption = 第一行+n+第二行; DisplayLayout.Override.WrapHeaderText更改Cell的背景颜色/e.Cell.Appearance.BackColor = Color.LightGreen;/e.Cell.Appearance.BackColor2 = Color.LightGreen;判断是否有子,父行,显示父行的IndexugSchedule.Rows0.HasChild(true) ugSchedule.Rows0.HasParent(true) MessageBox.Show(ugSchedule.Selected.Rows0.ParentRow.Index.ToString(); 列表包含Existsif ( this.ultraGrid1.DisplayLayout.ValueLists.Exists( VL1 ) )return;ValueList增加ValueListprivate void InitializeValueLists()Infragistics.Win.ValueListsCollection lists = this.UltraGrid1.DisplayLayout.ValueLists;Infragistics.Win.ValueList vl = lists.Add(DropDownValidate);for (int i = 0; i 100; i+)vl.ValueListItems.Add(i,i.ToString();vl = lists.Add(Presidents);for (int i = 0; i arrNames.GetLength(0); i+)vl.ValueListItems.Add(i,arrNamesi);SortedColumns手动增加排序并分组public int Add( UltraGridColumn column,bool descending,bool groupBy)Parameterscolumn The column to add to the collection. descending True to sort the column in descending order. False to sort ascending. groupBy True to specify that the column should also be grouped by, as well as sorted.Return ValueThe position into which the new element was inserted.UltraGridBand band = this.ultraGrid1.DisplayLayout.Bands0;/ Sort the rows by Country and City fields. Notice the order in which these columns/ are set. We want to sort by Country and then sort by City and in order to do that/ we have to set the SortIndicator property in the right order.band.ColumnsCountry.SortIndicator = SortIndicator.Ascending;band.ColumnsCity.SortIndicator = SortIndicator.Ascending;/ You can also sort (as well as group rows by) columns by using SortedColumns/ property off the band.band.SortedColumns.Add( ContactName, false, false );AllowRowSummaries手动添加汇总UltraGridBand band = this.ultraGrid1.DisplayLayout.Bands2;/ Set the AllowRowSummaries to either True or BasedOnDataType to allow/ the user to be able to add, remove or modify summaries. This is not/ necessary to create summaries programmatically and only effects the/ users ability to create, remove or modify summaries./按数据类型进行汇总band.Override.AllowRowSummaries = AllowRowSummaries.BasedOnDataType;/ You can also prevent the user from adding, removing or modifying a/ summary on a column basis. Prevent the user from summarizing OrderID/ column.band.ColumnsOrderID.AllowRowSummaries = AllowRowSummaries.False;band.ColumnsProductID.AllowRowSummaries = AllowRowSummaries.False;/ Add summaries. Notice the keys Max and Avg. We will use them to/ identify the summaries later on for example in SummaryValueChanged/ event.SummarySettings maxSummary = band.Summaries.Add( Max, SummaryType.Maximum, band.ColumnsUnit Price );SummarySettings avgSummary = band.Summaries.Add( Avg, SummaryType.Average, band.ColumnsUnit Price );/ Set the format of the summary textmaxSummary.DisplayFormat = Min = 0:#.00;avgSummary.DisplayFormat = Avg = 0:#.00;band.SummariesPairsSum.DisplayFormat=0:#;汇总栏格式,不要前面 汇总类型/ Change the appearance settings for summaries.maxSummary.Appearance.TextHAlign = HAlign.Right;avgSummary.Appearance.TextHAlign = HAlign.Right; / Set the DisplayInGroupBy property of both summaries to false so they dont/ show up in group-by rows.maxSummary.DisplayInGroupBy = false;avgSummary.DisplayInGroupBy = false;/ Set the caption that shows up on the header of the summary footer.band.SummaryFooterCaption = Summary of Unit Price;band.Override.SummaryFooterCaptionAppearance.FontData.Bold = DefaultableBoolean.True;band.Override.SummaryFooterCaptionAppearance.BackColor = Color.DarkBlue;band.Override.SummaryFooterCaptionAppearance.ForeColor = Color.LightYellow;让UltraWinGrid的列以控件形式表现出来进度条显示ugSchedule.DisplayLayout.BandsSchedule.ColumnsProgress.EditorControl = new Infragistics.Win.UltraWinProgressBar.UltraProgressBar();Infragistics.Win.UltraWinProgressBar.UltraProgressBar pbar = new Infragistics.Win
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 选矿集控工诚信知识考核试卷含答案
- 有色金属矿干燥工班组评比能力考核试卷含答案
- 数控车工成果知识考核试卷含答案
- 选矿供料工成果水平考核试卷含答案
- 乳品配料工安全知识竞赛考核试卷含答案
- 2026年家政保洁人员聘用协议
- 2026 九年级下册历史《工业革命》课件
- 〈鸿门宴〉讲义课件
- 合肥三模理综试题及答案
- 无人机数字化管控平台搭建方案
- 2026年北京市西城区初三一模英语试卷(含答案)
- 电力重大事故隐患判定标准2026版解读
- 2026届湖南省常德市芷兰实验校中考联考数学试题含解析
- 2026年38期入团考试题及答案
- 2025年四川省广元市八年级地理生物会考考试真题及答案
- 饲料厂如何进行质量控制
- GB/T 9163-2001关节轴承向心关节轴承
- GB/T 26163.1-2010信息与文献文件管理过程文件元数据第1部分:原则
- 习作:《我学会了-》课件
- 西藏自治区山南市各县区乡镇行政村村庄村名居民村民委员会明细
- 公司各部门工作流程图(通用)
评论
0/150
提交评论