第三方控件(DevExpress)使用大全个人开发过程中整理收集_第1页
第三方控件(DevExpress)使用大全个人开发过程中整理收集_第2页
第三方控件(DevExpress)使用大全个人开发过程中整理收集_第3页
第三方控件(DevExpress)使用大全个人开发过程中整理收集_第4页
第三方控件(DevExpress)使用大全个人开发过程中整理收集_第5页
已阅读5页,还剩13页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、第三方控件使用大全【张杰章开发过程中整理】、ComboBoxEdit1、如何使其不可编辑TextEditStyle设置为:DisableTextEditor2、如何设置鼠标为手形Cursor设置为:Hand、GridControl1、如何解决单击记录整行选中的问题View-OptionsBehavior-EditorShowMode设置为:Click2、如何新增一条记录、gridView.AddNewRow()、实现gridView_InitNewRow事件3、如何解决GridControl记录能获取而没有显示出来的问题gridView.populateColumns();4、如何让行只能选择

2、而不能编辑(或编辑某一单元格)、View-OptionsBehavior-EditorShowMode设置为:Click、View-OptionsBehavior-Editable设置为:false5、如何禁用GridControl中单击列弹出右键菜单设置RunDesign-OptionsMenu-EnableColumnMenu设置为:false6、如何隐藏GridControl的GroupPanel表头设置RunDesign-OptionsView-ShowGroupPanel设置为:false7、如何禁用GridControl中列头的过滤器过滤器如下图所示:设置RunDesign-Opt

3、ionsCustomization-AllowFilter设置为:false8、如何在查询得到0条记录时显示自定义的字符提示/显示如图所示:方法如下:方法如下:方法一(此方法为设置了数据源绑定时,可用)没有查询到你所想要的数据宋体方法二(此方法为法)没有设置数据源绑定时,使用,一般使用此种方没=有查询到你所想要的数据宋体9、如何显示水平滚动条?设置this.gridView.OptionsView.ColumnAutoWidth=false;10、如何定位到第一条数据/记录?设置this.gridView.MoveFirst()11、如何定位到下一条数据/记录?25、25、26、设置this.

4、gridView.MoveNext()12、如何定位到最后一条数据/记录?设置this.gridView.MoveLast()13、设置成一次选择一行,并且不能被编辑14、如何显示行号?/显示行的序号15、如何让各列头禁止移动?设置gridViewl.OptionsCustomization.AllowColumnMoving=false;16、如何让各列头禁止排序?设置gridView1.OptionsCustomization.AllowSort=false;17、如何禁止各列头改变列宽?设置gridView1.OptionsCustomization.AllowColumnResizin

5、g=false;18、19、20、21、22、23、24、三、navBarControl1、2、3、如何在每一个navBarGroup里添加自己想要的控件设置GroupStyle:ControlContainer如何设置navBarGroup有滚动条设置SkinExplorerBarViewScrollStyle:ScrollBar如休把navBarGroup设置成如下样式如图所示:当前雨量工件区厅史雨量工件区新逢雨量工件区时间日期、站点閤设置navBarGroup的PaintStyleName属性为:SkinNavigationPane四、toolTipController效果图如下1、如何

6、设置显示的时间长短设置this.toolTipController1.AutoPopDelay=2000;2、如何在屏幕上显示如上图所示的效果请选择一条记录提示请选择一条记录提示请选择一条记录提示3、如何设置边框的颜色五、1如何设置为多行,可拉伸设置的为:六、LayoutControl1、如何设置LayoutItem为隐藏设置LayoutItem.Visibility=Never七、TreeList1、如何隐藏TreeList的列头设置TreeListr的OptionsView的ShowColumns属性为:False2、如何八、PictureEdit1、如何禁止PictureEdit的右键菜

7、单?设置PictureEdit的Properties-ShowMenu为:false九、TreeList1、如何让TreeList的每个结点高亮显示?代码如下:privatevoidtreeList1_CustomDrawNodeCell(objectsender,DevExpress.XtraTreeList.CustomDrawNodeCellEventArgse)TreeListnode=senderasTreeList;if(e.Node=node.FocusedNode)e.Graphics.FillRectangle(SystemBrushes.Window,e.Bounds);R

8、ectangler=newRectangle(e.EditViewInfo.ContentRect.Left,e.EditViewInfo.ContentRect.Top,Convert.ToInt32(e.Graphics.MeasureString(e.CellText,treeList1.Font).Width+1),Convert.ToInt32(e.Graphics.MeasureString(e.CellText,treeList1.Font).Height);e.Graphics.FillRectangle(SystemBrushes.Highlight,r);e.Graphic

9、s.DrawString(e.CellText,treeList1.Font,SystemBrushes.HighlightText,r);e.Handled=true;/=/=以下内容为收集=/=一、改变grid的样式。DevExpress.XtraGrid.Design.XAppearancesxapp;xapp=newDevExpress.XtraGrid.Design.XAppearances(System.Environment.GetFolderPath(System.Environment.SpecialFolder.System)+DevExpress.XtraGrid.App

10、earances.xml);xappLoadScheme(样式名字”gridControll.MainView);二、选择单元设置和取所选的值gridView1.OptionsSelection.MultiSelect=ceMultiSelect.Checked;/多行选择gridView1.OptionsSelection.MultiSelectMode=GridMultiSelectMode.CellSelect;gridView1.OptionsSelection.MultiSelectMode=GridMultiSelectMode.RowSelect;/三、gridview的控制/取

11、当前选中的值/取当前选中的值stringGetSelectedRows(GridViewview)stringret=;introwIndex=-1;if(view.OptionsSelection.MultiSelectMode=GridMultiSelectMode.RowSelect)foreach(intiingridView1.GetSelectedRows()DataRowrow=gridView1.GetDataRow(i);if(ret!=)ret+=rn;ret+=string.Format(CompanyName:0(#1),rowCompanyName,i);elsefo

12、reach(GridCellcellinview.GetSelectedCells()if(rowIndex!=cell.RowHandle)if(ret!=)ret+=rn;ret+=string.Format(Row:#0,cell.RowHandle);ret+=rn+view.GetRowCellDisplayText(cell.RowHandle,cell.Column);rowIndex=cell.RowHandle;returnret;/半透明的效果privatevoidicbTranslucentColors_CheckedChanged(objectsender,System

13、.EventArgse)if(icbTranslucentColors.Checked)gridView1.Appearance.SelectedRow.BackColor=Color.FromArgb(30,0,0,240);gridView1.Appearance.FocusedRow.BackColor=Color.FromArgb(60,0,0,240);elsegridView1.Appearance.SelectedRow.Reset();gridView1.Appearance.FocusedRow.Reset();/自动添加一行gridView1.OptionsView.New

14、ItemRowPosition=NewItemRowPosition.Bottom/Top/None;/设置gridView的按钮gridView1.ShowButtonMode=ShowButtonModeEnum.。gridView1.OptionsBehavior.Editable=chEdit.Checked;/设/置按钮是否可用/向选中的空间输入字符串SendKeys.Send(“fsfds”);/控件焦点gridControl1.Focus();四、cardView的设置/是否现实快捷按钮CustomizeButtoncardView1.OptionsView.ShowQuickC

15、ustomizeButton=true/false;/DOCustomizeButton的能否排序和过滤foreach(GridColumncolincardView1.Columns)col.OptionsColumn.AllowSortforeach(GridColumncolincardView1.Columns)col.OptionsFilter.AllowFilter/card的头上的ico显示cardView1.LayoutChanged();/card的头上的标题改变显示cardView1.CardCaptionFormat=”;/cardview显示的单个记录的折叠按钮card

16、View1.OptionsView.ShowCardExpandButton=true;/cardView1.MaximumCardColumns=iSizecardView1.MaximumCardRows=val;cardView1.OptionsBehavior.AutoHorzWidth/多选cardView1.OptionsSelection.MultiSelect=ceMultiSelect.Checked;foreach(intiincardView1.GetSelectedRows()DataRowrow=cardView1.GetDataRow(i);if(ret!=)ret

17、+=rn;ret+=string.Format(0/1:2:$#,0.00,rowTrademark,rowModel,rowPrice);/查看选择中的记录CellMerging(单元格合并的效果)/CellMerging(单元格合并的效果)gridView1.OptionsView.AllowCellMerge=ceMerging.Checked;FixedBands(bandedGridView)/两边固定gridBand3的一列的Fixed属性改成Right,Left,None/固定与非固定列之间的距离用bandedGridView2.FixedLineWidth=(int)numFi

18、xedLineWidth.Value;/设置列的颜色打开RunDesigner选中Columns选中要改变的列里面有AppearanceCell(设置列的外观)和AppearanceHeader设置表格头的外观)或者选中该列查看“属性”里面也有这两个属性。/统计(gridViewbandedGridView通用)分组统计和全部统计:全部统计:在最下面显示统计的结果。RunDesigner-TotalSummary/-General设置显示/-Columns对特定列来设置统计汇总结果是否显示:可以通过gridControl的view的ShowFooter属性来设置表格下面的汇总结果分组统计:以上

19、就是“分组”的显示在每个分组下面来显示汇总结果。通过bandedGridView2.GroupFooterShowMode=GroupFooterShowMode.。设置分组的显示模式。/GridView设置菜单#regionGrideventsprivatevoidgridView1_ShowGridMenu(objectsender,DevExpress.XtraGrid.Views.Grid.GridMenuEventArgse)if(e.MenuType=DevExpress.XtraGrid.Views.Grid.GridMenuType.Column)DevExpress.Xtra

20、Grid.Menu.GridViewColumnMenumenu=e.MenuasDevExpress.XtraGrid.Menu.GridViewColumnMenumenu=e.MenuasDevExpress.XtraGrid.Menu.GridViewColumnMenu;menu.Items.Clear();if(menu.Column!=null)menu.Items.Add(CreateCheckItem(NotFixed,menu.Column,menu.Items.Add(CreateCheckItem(NotFixed,menu.Column,FixedStyle.None

21、,imageList2.Images0);menu.Items.Add(CreateCheckItem(FixedLeft,menu.Column,FixedStyle.Left,imageList2.Images1);menu.Items.Add(CreateCheckItem(FixedRight,menu.Column,FixedStyle.Right,imageList2.Images2);#endregion#regionNewcolumnmenuDXMenuCheckItemCreateCheckItem(stringcaption,GridColumncolumn,FixedSt

22、ylestyle,Imageimage)DXMenuCheckItemitem=newDXMenuCheckItem(caption,column.Fixed=style,image,newEventHandler(OnFixedClick);item.Tag=newMenuInfo(column,style);menu.Items.Add(CreateCheckItem(FixedLeft,menu.Column,FixedStyle.Left,imageList2.Images1);menu.Items.Add(CreateCheckItem(FixedRight,menu.Column,

23、FixedStyle.Right,imageList2.Images2);#endregion#regionNewcolumnmenuDXMenuCheckItemCreateCheckItem(stringcaption,GridColumncolumn,FixedStylestyle,Imageimage)DXMenuCheckItemitem=newDXMenuCheckItem(caption,column.Fixed=style,image,newEventHandler(OnFixedClick);item.Tag=newMenuInfo(column,style);returni

24、tem;voidOnFixedClick(objectsender,EventArgse)DXMenuItemitem=senderasDXMenuItem;MenuInfoinfo=item.TagasMenuInfo;if(info=null)return;info.Column.Fixed=info.Style;classMenuInfopublicMenuInfo(GridColumncolumn,FixedStylestyle)this.Column=column;this.Style=style;publicFixedStyleStyle;publicGridColumnColum

25、n;#endregion/gridviewcardView自动行高行高自动匹配gridView1.OptionsView.RowAutoHeight=ce.Checked;cardView1.OptionsBehavior.FieldAutoHeight=ce.Checked;当文字多的时候(行高自动匹配设置是才有用)repositoryItemMemoEdit1.LinesCount=ce.Checked?0:1;设置自动全部显示该的所有行。图片时(行高自动匹配设置是才有用)repositoryItemPictureEdit1.CustomHeight=ce.Checked?0:40;/Ba

26、ndedGridView自己订制列的方法advBandedGridView1.ColumnsCustomization();advBandedGridView1.DestroyCustomization();advBandedGridView1.OptionsCustomization.AllowChangeColumnParent=edit.Checked;advBandedGridView1.OptionsCustomization.AllowChangeBandParent=edit.Checked;advBandedGridView1.OptionsCustomization.Show

27、BandsInCustomizationForm=edit.Checked;/设置图片动画模式gridView1.OptionsView.AnimationType=G(ridAnimationType)/根据字段来分组模式switch(index)case0:SetInterval(gridColumn1,ColumnGroupInterval.Alphabetical);gridColumn2.GroupInterval=ColumnGroupInterval.Alphabetical;break;case1:SetInterval(gridColumn5,ColumnGroupInter

28、val.DateMonth);break;case2:SetInterval(gridColumn5,ColumnGroupInterval.DateYear);break;case3:SetInterval(gridColumn5,ColumnGroupInterval.DateRange);break;case4:SetSortMode(gridColumn4,ColumnSortMode.Custom);break;default:SetInterval(gridColumn2,ColumnGroupInterval.Value);break;voidSetInterval(GridCo

29、lumncolumn,ColumnGroupIntervalinterval)column.GroupInterval=interval;column.GroupIndex=0;voidSetSortMode(GridColumncolumn,ColumnSortModesortMode)column.SortMode=sortMode;column.GroupIndex=0;改变分组样式gridView1.OptionsView.GroupDrawMode=(GroupDrawMode)/清除分组gridView1.ClearGrouping();foreach(GridColumncolu

30、mningridView1.Columns)column.GroupInterval=ColumnGroupInterval.Default;column.SortMode=ColumnSortMode.Default;/CustomDataSummaries设置GropprivatevoidnumCustom_ValueChanged(objectsender,System.EventArgse)CustomGridView.UpdateSummary();UpdateCaptions(numCustom.Value);privatevoidUpdateCaptions(decimald)C

31、ustomGridView.GroupSummary0.DisplayFormat=(OrderCountWHEREFreight=+d.ToString()+=0);OnSetCaption();gridView2.FormatConditions0.Value1=d;protectedoverridevoidOnSetCaption(stringfCaption)fCaption=countrecordsWHEREFreight=+numCustom.Value.ToString();if(Caption!=null)Caption.Text=string.Format(0(1),Tuto

32、rialName,fCaption);/下面的效果的实现ntWHEREFreight=100=22)r(TotalOrderCount=96)55.281994-8-:125.77199牛38.981994-9-:1.151994-1017,681994-100.561994-1040.261994-101.961994-1063,361994-1115.661994-11249.061994-12101.S51994-1245.031995-1-:34.86iggs-i-:1ZZ.461995-KRunDesignere-StyleConditions-Add-column设置列的Condi

33、tion设置条件valuel,value2是参数值代码:publicvoidsetStyle(GridViewgridView)StyleFormatConditioncn;cn=newStyleFormatCondition(FormatConditionEnum.Equal,gridView.Columnsbd_c,null,false);cn.ApplyToRowtrue;/false对列其作用。cn.Appearance.Fontn=ewFont(AppearanceObjec.tDefaultFont,FontStyle.Bold);cn.Appearance.ForeColor=C

34、olor.Brown;gridView.FormatConditions.Add(cn);/LayoutViewLw.tFh.?!-TwLaLii:LkdUM3-KL41Hwi#-4”白二圉一丄占-=目HFfesdFlMsdDoiunrsAwtnRir*HsyitDokimOuBinTtEittinsjtrwtHViewsu.ixWtcdiijdSsiK血FTTFwnaiodMKUi-dHd二Kjfjfff-氏t期Lw.tFh.?!-TwLaLii:LkdUM3-KL41Hwi#-4”白二圉一丄占-=目HFfesdFlMsdDoiunrsAwtnRir*HsyitDokimOuBinTtEit

35、tinsjtrwtHViewsu.ixWtcdiijdSsiK血FTTFwnaiodMKUi-dHd二Kjfjfff-氏t期I:I.C4sl1|ttbFiftUilirVideoMartDavrrioHl-QnH-DKBti!Hfciltrf?h4AngtaboriomCaulScJaboriomddLeel001BetInnGsdRsctijC-rdCwyLnlsixiJlxriHcde-險lajtfte廿toorSTiartsriar*;RedeniptloiTheTh?PEerfO十書贰th,ng弱.whenheccon-rtriMiri吐dhrUtemrdta-oftuMe.2LiFu

36、iIiyw-.OZ型IBCoki*7日utlaHJuEdiiCIJffthcu-d?AumRi日utlaHJuEdiiCIJffthcu-d?AumRiRowtCi|nttedsra,;c-jidshthe他口直叶?1#inaneipiJs,i.Egthetiaisp-iwc?dti:Pisbosrrmrijth?c-rrt:tlayoutView1.OptionsCarouselMode.PitchAngle=(float)(int)flatFactor.EditValue)/360.0f*2Math.PI);/卡片的高度设置flatFactor.EditValuelayoutView1.O

37、ptionsCarouselMode.PitchAngle=(float)(int)flatFactor.EditValue)/360.0f*2Math.PI);/卡片的高度设置flatFactor.EditValue的值(0-360)layoutView1.OptionsCarouselMode.RollAngle=(float)(int)rollAngle.EditValue)/360.0f*2*Math.PI);/卡片的旋转角度设置rollAngle.EditValue的值(0-360)layoutView1.OptionsCarouselMode.BottomCardScale=(in

38、t)endSizeScale.EditValue)/100.0f;/卡片的距离设置endSizeScale.EditValue的值(0-100)layoutView1.OptionsCarouselMode.BottomCardAlphaLevel=(int)endAlpha.EditValue)/100.0f;/卡片的卡片透明程度设置endAlpha.EditValue的值(0-100)layoutView1.OptionsCarouselMode.BottomCardFading=(int)bottomCardFading.EditValue)/100.0f;/卡片的卡片褪色程度设置bot

39、tomCardFading.EditValue的值(0-100)layoutView1.OptionsCarouselMode.CardCount=(int)cardsCount.EditValue;/卡片的能显示数量设置cardsCount.EditValue的值(0-20)layoutView1.OptionsCarouselMode.InterpolationMode=(InterpolationMode)/修改卡片的方式/layoutDOODOOrundesigner-layout里面设置SizeoriginalCardMinSize=Size.Empty;privatevoidzoo

40、mTrackBarControl1_EditValueChanged(objectsender,EventArgse)if(originalCardMinSize=Size.Empty)originalCardMinSize=layoutView1.CardMinSize;doublekoeff=(int)zoomTrackBarControl1.EditValue)/100.0-0.2;SizenewSize=newSize(originalCardMinSize.Width+(int)(originalCardMinSize.Widthkoeff),originalCardMinSize.

41、Height+(int)(originalCardMinSize.Height*koeff);layoutView1.CardMinSize=newSize;丘惘mn彌whewlsnd5ba.Thsmirtnifonthe曲stowtotnchyjrEcijpl曲nptfcoFsbj出-ssthsiftdirdrdEofths圧牌匚tfA卑bnir,file/设置卡片的大小的(/设置卡片的大小的(zoomTrackBarControl1z(0-100)图中设置layoutView位置的方法T弧g址LkdLHJi:L41Hwi#-4FeedB-rdi-FeedOoiunrsAurtnRxwHei

42、ghtOcilTWlOUBTiUTtEffiiriJSjlJSMt!Vfe.-5I;upistj;iOdSdBCttnRTFewngLjsm.tf?帧m3?冋4轴Bs图圍OHlla呼临阈目口=5anl3T弧g址LkdLHJi:L41Hwi#-4FeedB-rdi-FeedOoiunrsAurtnRxwHeightOcilTWlOUBTiUTtEffiiriJSjlJSMt!Vfe.-5I;upistj;iOdSdBCttnRTFewngLjsm.tf?帧m3?冋4轴Bs图圍OHlla呼临阈目口=5anl3审如Dfflaii:i.c4iIh(IAUlXiFilfif险和QriUonklpBett

43、erI仲SEdijffJ池ki血HJdE空嗨CUfi:b=出FtCrtiJLayoutDetailLW4.Q0厲LW-I-LL4沾J.頤Sp?iinPU6imisSpamiWfljPtFiUpeira:frani-5ipLW4-9-LW-I-LU-L?MAoCOD.F.MfcSrri&F.423.isruiidr+rtwboncbiTotiwfBimu/设置卡片的大小的(/设置卡片的大小的(zoomTrackBarControl1z(0-100)/设置卡片的大小的(/设置卡片的大小的(zoomTrackBarControl1z(0-100)protectedvoidSetMasterTable

44、LeftPlacement()LayoutItemDragControllerdc=newLayoutItemDragController(masterTableItemdetailTableItem,InsertLocation.Before,LayoutType.Horizontal);DoDragItem(dc);SetMasterViewColumnLayout();protectedvoidSetMasterTableRightPlacement()LayoutItemDragControllerdc=newLayoutItemDragController(masterTableItemdetailTableItem,InsertLocation.After,LayoutType.Horizontal);DoDragItem(dc);SetMasterViewColumnLayout();privatevoidSetMasterTableTopPlacement()LayoutItemDragControllerdc=newLayoutIte

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论