- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
FLEXDataGrid背景颜色调试
FLEX DataGrid背景颜色调试
在Flex运用中经常提到的有关DataGrid问题是如何改变DataGrid单元格 cell ,列 column 和行 row 的背景颜色 backgroundcolor
这里对这3种颜色做一个总结。 1. 设置行 row 的背景色
主要是通过对DataGrid扩展,对protected函数drawRowBackground 进行重写,具体代码如下:
override protected function drawRowBackground s:Sprite, rowIndex:int, y:Number, height:Number,color:uint, dataIndex:int :void if dataIndex dataProvider.length super.drawRowBackground s,rowIndex,y,height,color,dataIndex ; return; if dataProvider.getItemAt dataIndex .col3 2000 //set color accordint to datas super.drawRowBackground s,rowIndex,y,height,0xC0C0C0,dataIndex ; else super.drawRowBackground s,rowIndex,y,height,color,dataIndex ; 这段代码中根据DataGrid的数据源进行判断来设置背景色,但是它有个缺陷,就是这个具体的背景色我们无法自己灵活指定。因此派生出新的CustomRowColorDataGrid,具体代码如下:
package cwmlab.controls import mx.controls.*; import flash.display.Shape; import mx.core.FlexShape; import flash.display.Graphics; import flash.display.Sprite; import mx.rpc.events.AbstractEvent; import mx.collections.ArrayCollection; import flash.events.Event; /** * This is an extended version of the built-in Flex datagrid. * This extended version has the correct override logic in it * to draw the background color of the cells, based on the value of the * data in the row. **/ public class CustomRowColorDataGrid extends DataGrid private var _rowColorFunction:Function; public function CustomRowColorDataGrid super ; /** * A user-defined function that will return the correct color of the * row. Usually based on the row data. * * expected function signature: * public function F item:Object, defaultColor:uint :uint **/ public function set rowColorFunction f:Function :void this._rowColorFunction f; public function get rowColorFunction :Function return this._rowColorFunction; /** * Draws a row background * at the position and height specified using the * color specified. This implementation creates a Shape as a * child of the input Sprite and fills it with the appropriate color. * This method also uses the backgroundAlpha style property
您可能关注的文档
最近下载
- 国考易错1000题言语理解与表达.pdf VIP
- DB5101T 217-2025 成都市城市绿化养护技术规程.docx VIP
- 集电线路施工技术标方案.docx VIP
- 标准图集-20S515-钢筋混凝土及砖砌排水检查井.pdf VIP
- 建设工程工程量清单计价标准.pdf VIP
- 《老年人能力评估》精品课件——项目八 老年人能力等级评定及报告填写.pptx
- 5g终端介绍----第4部分5g终端测试体系及测试方法.pdf VIP
- GB 55032-2022 建筑与市政工程施工质量控制通用规范.docx VIP
- 2021广西文化艺术中心项目-质量策划.docx VIP
- 中级育婴员技能操作考试全套题集.pdf VIP
文档评论(0)